Python Daily – Telegram
Python Daily
2.56K subscribers
1.49K photos
53 videos
2 files
39K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
D Does this NeurIPS 2025 paper look familiar to anyone?

This NeurIPS 2025 paper seems very much like another well-known paper but appears to be renaming everything. Some parts are down to the word matches. Just to make sure I'm not going crazy, as an experiment, I'm not going to post the original paper just to see if others make the connection:

The Indra Representation Hypothesis
https://openreview.net/forum?id=D2NR5Zq6PG

Since comments are asking for the other paper:

The Platonic Representation Hypothesis
https://arxiv.org/abs/2405.07987

/r/MachineLearning
https://redd.it/1phillh
Opinion on using pyinfra

I recently came across pyinfra and I love it so far. It is way more intuitive than ansible or any of those Cloud DevOps tools. At least for small projects it seems to be the perfect fit and even beyond it I think.

Pyinfra is already around for a while and seems to be well maintained. But I don’t think it has the attention it deserves.

Do you know it? And what is your opinion why to use it / not use it…

Here is the link to the docs: https://pyinfra.com

/r/Python
https://redd.it/1phgso7
DRF/React security

Hi folks, just reading about the current security vulnerability with server side components and React/Next. As I understand it sends a fake post request and needs to Node to handle the request?

This exploit isn't something that would effect a React/DRF setup, is it? Just want to be 100% sure!

/r/django
https://redd.it/1phg6xq
MÉTODOS HTTP: O RESTAURANTE WEB

/r/flask
https://redd.it/1phchw4
Turning Django Q2 into a "Headless" Task Queue – I built a REST API wrapper to enable custom dashboards

Hi everyone,

I've been diving deep into **Django Q2** recently. While it's fantastic, I found myself frustrated that I couldn't easily display task status or retry jobs from outside the Django Admin (like in a client-facing React dashboard or a mobile app for ops).

Instead of hardcoding a solution for just one project, I decided to turn it into a learning exercise on how to build and maintain a proper reusable app.

**Introducing** `django-q-monitor`

It’s a plug-and-play DRF wrapper that decouples monitoring from the backend.

**What it does:**

* 📊 **Read-only endpoints:** Lists Tasks and Schedules (JSON formatted).
* 🔄 **Interactive Actions:** POST to `retry` a specific task or DELETE to `cleanup` old history.
* 🛡️ **Security:** Respects DRF permission classes (defaults to `IsAdminUser`, but you can swap it for Token auth).

**Why I'm posting:** This is officially **my first package published on PyPI**. I learned a ton about `pyproject.toml` and packaging standards during the process.

I’ve tried to keep the code clean and strictly typed. I would appreciate any feedback on the **project structure** or suggestions on how to make the **ViewSets** more efficient/extensible.

* **Repo:**[https://github.com/previa1998/django-q-monitor](https://github.com/previa1998/django-q-monitor)
* **PyPI:** `pip install django-q-monitor`

Thanks for checking it out!

/r/django
https://redd.it/1phbccw
How do I fully integrate Xero Accounting with a Django REST Framework backend? Need guidance.

I’m currently building a Django + Django REST Framework project and I want to integrate **Xero Accounting Software** into my backend.

I’m confused about what “full integration” actually means.
Do we *install* Xero somehow in Django, or is everything done only through API calls?

If anyone has:

* tutorials
* code examples
* best practices
* sample projects
* or advice on pitfalls

it would be super helpful.

/r/django
https://redd.it/1phzw8i
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1phsmy3
TIL Python’s random.seed() ignores the sign of integer seeds

I just learned a fun detail about random.seed() after reading a thread by Andrej Karpathy.

In CPython today, the sign of an integer seed is silently discarded. So:

random.seed(5) and random.seed(-5) give the same RNG stream
More generally, +n and -n are treated as the same seed

/r/Python
https://redd.it/1pi7aso
CVPR Submission id changed D

When I logged into my Openreview CVPR author console, I found that my submission id has been changed from 9k+ to 42k+ . Interestingly, the openreview has applied some black colored mask on multiple pages of the pdf, probably to hide original id mentioned at the header in every page. Did anyone else notice that??

/r/MachineLearning
https://redd.it/1phygsa
How Pyrefly Works With Pydantic (Video)

https://www.youtube.com/watch?v=zXYpSQB57YI

Pyrefly now includes experimental support for Pydantic, a popular Python library for data validation and parsing. This feature aims to provide improved static type checking and IDE integration for Pydantic models. In this video we cover the basics of what is supported and how you can start using Pyrefly with your Pydantic code!

This is a reupload, the original one that went up last week had an error

/r/Python
https://redd.it/1piabju
messaging system within my project

What’s the best way to integrate simple messaging system within my project?
I found out there are a django-messages but not have any support for newer versions of django

Is there any legit easy to install and ready to operate messaging system without the need to instant messages?

/r/django
https://redd.it/1pic5fu
What is the marker of a project root for uv to create the .venv there?

By default uv will create a venv folder at the project root if none is present. During operation also uv is smart enough to find the correct venv if invoked in a sub folder.

Naively I thought that uv, when invoked, would check for a valid pyproject.toml, and the travnverse the tree path upward until it would find one.

Then I learned about uv workspace and discovered of being wrong:

- a workspace is composed by a parent pyproject.toml and many children pyproject.toml.
- the venv and lock file are created only at the parent folder (all the children share the same dependecies)
- the children pyproject.toml do not shows any information about being a member of the workspace
- only the parent pyproject.toml keeps a list of the child members of the workspace.

I tried to ask few AI, but their response is between too generic or wrong ish. I had a look at the source code, but I'm no familiar with rust at all, and there is a lot of it.

I ask because I kinda need the same functionality, find a specific env file at the root of a project, if present. I got it working, but mostly

/r/Python
https://redd.it/1pij98g
I built a local first tool that uses AST Parsing + Shannon Entropy to sanitize code for AI

I keep hearing about how people are uploading code with personal/confidential information.


So, I built ScrubDuck. It is a local first Python engine, that sanitizes your code before you send it to AI and then can restore the secrets when you paste AI's response back.

What My Project Does (Why it’s not just Regex):

I didn't want to rely solely on pattern matching, so I built a multi-layered detection engine:

1. AST Parsing (ast module): It parses the Python Abstract Syntax Tree to understand context. It knows that if a variable is named db_password, the string literal assigned to it is sensitive, even if the string itself ("correct-horse-battery") looks harmless.
2. Shannon Entropy: It calculates the mathematical randomness of string tokens. This catches API keys that don't match known formats (like generic random tokens) by flagging high-entropy strings.
3. Microsoft Presidio: I integrated Presidio’s NLP engine to catch PII like names and emails in comments.
4. Context-Aware Placeholders: It swaps secrets for tags like <AWS_KEY_1> or <SECRET_VAR_ASSIGNMENT_2>, so the LLM understands what the data is without seeing it.

How it works (Comparison):

1. Sanitize: You highlight code -> The Python noscript analyzes it locally -> Swaps secrets for placeholders -> Saves a map in memory.
2.

/r/Python
https://redd.it/1piick8
Template repo with uv, ruff, pyright, pytest (with TDD support) + CI and QoL Makefile

I've been using python from big monorepos to quick noscripts for a while now and landed on this (fairly opinionated) spec to deal with the common issues primarily around the loose type system.

Aims to not be too strict to facilitate quick iterations, but strict enough to enforce good patterns and check for common mistakes. TDD support with pytest-watch + uv for fast dependency management.


- Sensible defaults for ruff and pyright out of the box configured in pyproject.toml
- Basic uv directory structure, easy to use from quick hacks to published packages
- make watch <PATH> the main feature here - great for TDD, run in a background terminal and by the time you look over/tab tests have re-run for you.
- Makefile with standardised commands like make sync (dependencies) and other QoL.


Anyone looking for template uv repo structures, integrating ruff, pyright and pytest with CI.

Beginners looking for a "ready to go" base that enforces best-practices.

> Quite nice together with claude code or agentic workflows - make them run make check and make test after any changes and it tends to send them in a loop that cleans up common issues. Getting a lot more out of claude code this way.

---

Repo here


Same (outdated) concept

/r/Python
https://redd.it/1pi4rmg
Tasks Managements, Test Runner, Documentation Hub and Time Tracking VSCode/Cursor Extension

What My Project Does

Save any command once and run it forever – Eliminate the need to retype deployment noscripts or build commands.
Run tests without leaving your code – Benefit from automatic test discovery, inline test execution commands, and instant feedback.
Navigate documentation efficiently – Search across all markdown files and jump to specific sections seamlessly.
Track time effortlessly – Utilize automatic timers per Git branch, commit logging, and session management.

Target Audience
Developers that use vscode or cursor.

Comparison
We do have the built in test discovery but it way over complicated and hard to use, you can use the vscode tasks, but it not easy to run and configure, you can use a time tracking tool outside vscode, but now you can do everything without leaving the vscode window.

Free and open source, it is available now on the VS Code Marketplace and Open VSX Registry.
Search "Tasks, Tests & Doc Hub" in your VS Code extensions or access:

Vscode -> https://marketplace.visualstudio.com/items?itemName=LeonardoSouza.command-manager

Cursor -> https://open-vsx.org/extension/LeonardoSouza/command-manager

https://github.com/Leonardo8133/Leos-Shared-Commands

/r/Python
https://redd.it/1piiyzr
Finished My Agentic RAG Tutorial - Everything in Python, Fully Local

### 💡 What My Project Does

After 6 months of intensive study on RAG systems, I've completed a comprehensive educational repository for Agentic RAG. The entire system is in Python and runs fully locally, eliminating API costs!

This is a complete end-to-end example that demonstrates how all the pieces of an advanced agent architecture work together.

---

### 🎯 Target Audience

Anyone curious about how Agentic RAG actually works and wants to learn by building, rather than just reading theory.

### 🆚 The Comparison: Why This Is Different

Most RAG tutorials are scattered or skip the hard parts. This project provides a complete, working implementation that tackles the complexity head-on, offering:

End-to-End Functionality: All components (chunking, vector store, agents) work together seamlessly.
🔒 Zero Dependency Cost: No API keys or expensive cloud services required.
🐍 Pure Python Stack: No JavaScript, just Python and your local machine.

### 🧠 What You'll Learn (Architectural Deep Dive)

This is a deep dive into the architecture, including:

PDF → Markdown conversion
Hierarchical chunking (parent/child)
Hybrid embeddings (dense + sparse)
Vector storage with Qdrant
Query rewriting & human-in-the-loop interaction
Context management with summarization
Multi-agent map-reduce – Parallel sub-queries for complex questions
Fully working agentic RAG with LangGraph
Pure Python UI with Gradio for

/r/Python
https://redd.it/1picui1
DTOs or classes with objects and methods

Which is preferred in Python?

DTOs or classes that encapsulate data and methods?

Wondering about this as I'm from a C# background where we rarely used classes that encapsulate data and methods. My current job (Python) goes way heavier on OOP than my previous.

/r/Python
https://redd.it/1piug7a
A Roadmap for AIML from scratch !!

*YT Channels:*

*Beginner Level (for python till classes are sufficient) :*

* Simplilearn
* Edureka
* edX

Advanced Level (for python till classes are sufficient):

* Patrick Loeber
* Sentdex

*Flow:*

coding => python => numpy , pandas , matplotlib, scikit-learn, tensorflow

Stats (till Chi-Square & ANOVA) → Basic Calculus → Basic Algebra

Check out *"stats"* and *"maths"* folder in below link

*Books:*

Check out the *“ML-DL-BROAD”* section on my GitHub: [Github | Books Repo](http://github.com/Rishabh-creator601/Books)

* Hands-On Machine Learning with Scikit-Learn & TensorFlow
* The Hundred-Page Machine Learning Book

>

Please let me How is it ? and if in case i missed any component

/r/Python
https://redd.it/1piwygn
Frist: Property base age, calendar windows and business calendar ages/windows using properties.

🐍 What Frist Does

Frist (a German word related to scheduling) is a package that allows for calculation of ages on different time scales, if dates fit into time/calendar windows (last 3 minutes, this week) and determine age and windows for business/working days.

At no time do you perform any "date math", interact with datetime or date fields or timespans or deltas. Ages are all directly accessed via time scale properties and time windows are accessed via method calls that work across all supported time scales (second, minute, hour, day, week, month, quarter, fiscal quarter, year, fiscal year). Objects in Frist are meant to be immutable.

Time windows are by default "half-open intervals" which are convenient for most cases but there is support for a generalized between that works like the Pandas implementation as well as a thru method that is inclusive of both end points.

All of the initializers allow wide data types. You can pass datetime, date, int/float time stamps and strings, which all are converted to datetimes. Ideally this sets you up to never write conversion code, beyond providing a non-ISO date format for "non-standard" string inputs.

The code is type annotated and fully doc-stringed for a good

/r/Python
https://redd.it/1pilirz
Should I generate images on the client or server side ?

In my django website I have a model called event , that has as attributes background image and overlay image .
My business flow is as follows :
The user uploads a picture
I open the background picture
I paste the user 's picture on it
I then paste the overlay picture

So I use pillow in the backend , but I feel this might be doing unnecessary and causing me too much memory and time . When I could just use the user 's browser and render the images .


After I changes my code to do this on the client side using canvas , I noticed my memory usage went down by 10 MB , due to me not opening the background picture in memory and then pasting imag3s in it.


Is this wise from performance pov ?

/r/django
https://redd.it/1piidtl