Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
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/1liwla2
Is it good idea to use debug_toolbar to learn ORM and SQL?

I have recently found out about this tool and it has enormously helped me in understanding ORM and the SQL magic behind it

/r/django
https://redd.it/1lj5ccd
D What's happening behind Google's AI Overviews?

Curious to know what happens behind the scenes of the AI Overview widget. The answers are good and the latency with which responses are returned is impressive.

Based on the citations displayed, I could infer that it is a RAG based system, but I wonder how the LLM knows to respond in a particular format for a given question.

/r/MachineLearning
https://redd.it/1lj3e0i
How can I give out a webapp but not the source code?


I want to give someone a django app I made to use locally but I dont want them to be able to reproduce or make changes to the code. Whats a good way to do so?

Ive seen Obfuscation (pyarmor) and making Licens Keys is a good way to go but have no real knowledge of that process. Also saw Pyinstaller might be an option but again, no Idea. Any advice or usefull links are appreciated.

BONUS QUESTION: How can I make the install process fool proof for the user? Just as far as installing python and requirements goes along with the project in one install file.


/r/django
https://redd.it/1ljgvev
PyPDFForm v3.0.0 has released

Hello r/Python! About a year ago I made a post about an open source project I have been working on for about 5 years called PyPDFForm. It is a Python library that specializes in PDF form manipulations, providing essential functionalities such as inspect/edit form fields, filling forms, creating form fields, and many more.

The project received some very positive feedback from the community and has been evolving since then. Right now it's at about 14k monthly pip installs and I'm constantly getting new issues opened for different requests for the library. And because of the rise of its usage there are some groundbreaking major changes needed to happen to the library in order to address some of its legacy problems.

So it is my pleasure to announce that, just this morning, PyPDFForm has released its v3.0.0 major update. I wrote a long paragraph explaining why V3 is necessary. But here I will highlight some of the key changes in it:

1. Complete native PDF form filling. This is the legacy issue that V3 fixes. Instead of what used to be a watermark based approach, now every PDF form filled using PyPDFForm will be the same as if being filled by hand.
2. Best compatibility with Adobe Acrobat you will

/r/Python
https://redd.it/1ljas6t
Best WebSocket Library

Hi everyone! I am developing an application that requires real-time data fetching from an API, for which I need to use the WebSocket protocol. As of June 2025, what is the best library to implement WebSockets in Python? As of now, the module that handles fetching data from the API isn't very complex β€” its only requirement is to be able to smoothly handle around 50-100 concurrent connections with the API, where the rate of data flow is about 10 bytes per second for each connection. While the per-connection data-flow rate is expected to remain at only 10 bytes, the number of open concurrent connections may grow up to 3000, or even more. Thus, scalability is a factor that I need to consider.

I searched this sub and other related subs for discussions related to the websockets library, but couldn't find any useful threads. As a matter of fact, I couldn't find a lot of threads specifically about this library. This was unexpected, because I assumed that websockets was a popular library for implementing WebSockets in Python, and based on this assumption, I further assumed that there would be a lot of discussions related to it on Reddit. Now I

/r/Python
https://redd.it/1ljdlmw
Ranking Alternatives to Streamlit

Hey!

What's the best Streamlit alternative for you?
Here's the ones I've got for the moment - you can checkout the leaderboard here  https://streamlit-alt-leaderboard-davia.vercel.app
Gradio
Reflex
NiceGUI
Davia
Dash
Voila
Appsmith
Shiny
Panel

Would love to know which one you're using and why ! Also let me know if I'm missing one :)

/r/Python
https://redd.it/1ljn5t8
What do you use to test the django project? Unit test,Integration test, e2e test is what I'm talking about.

I currently have unit tests in ```tests.py``` generated by ```python "manage.py" startapp name``` (ignore double quotes reddit tried to turn it into a link).

Now I'm looking for recommendations or what you have used to do the integration testing, and e2e testing!

/r/django
https://redd.it/1ljmbhx
FastAPI is usually the right choice

Digging through the big 3, it feels like FastAPI is going to be the right choice 9/10 times (with the 1 time being if you really want a full-stack all-in-one thing like Django) https://judoscale.com/blog/which-python-framework-is-best

/r/Python
https://redd.it/1ljrsti
Used Flask to Make a Game Mashup App

Hi, everyone! I made a web app to practice Python and Flask https://gamemashup-production.up.railway.app/use. It combines two games you provide and fuses them together into a new game. It's free, open source, and doesn't collect information. You can check it out as well as the source code.
https://github.com/SodaCatStudio/GameMashup

/r/flask
https://redd.it/1ljt288
docker-pybuild: Embed Dockerfiles directly in your Python scripts

Hey r/Python! I wanted to share a small proof-of-concept I created that lets you build Docker images directly from Python scripts with embedded Dockerfiles.

# What My Project Does

docker-pybuild is a Docker CLI plugin inspired by PEP-723 (which allows you to specify Python version and dependencies in script metadata). It extends this concept to include a complete Dockerfile in your Python script's metadata.

# Target Audience

It's pretty much just a proof-of-concept at this point, but I thought someone might find it handy.

# Comparison

I'm not really aware of any similar projects, but I'd be happy to hear if someone knows of any alternatives.

# Example

# /// script
# requires-python = ">=3.11"
# dependencies =
# "requests<3"
#
# tool.docker
# Dockerfile = """
# FROM python:3.11
# RUN pip install pipx
# WORKDIR /app
# COPY application.py /app
# ENTRYPOINT "pipx", "run", "/app/application.py"
# """
# ///


/r/Python
https://redd.it/1lk3jst
My response to Tim Peters: The Zen of Spite

β€’ There are fifteen inconsistent ways to do anything, and all of them are half-documented.

β€’ If the method isn’t available on the object, try the module, or the class, or both.

β€’ Readability counts - but only after you guess the correct paradigm.

β€’ Special cases aren't special enough to break your pipeline silently.

β€’ Errors should never pass silently - unless you're too lazy to raise them.

β€’ In the face of ambiguity, add a decorator and pretend it’s elegant.

β€’ There should be one - and preferably only one - obvious way to do it. (Except for strings. And sorting. And file IO. And literally everything else.)

β€’ Namespaces are one honking great idea - let’s ruin them with sys.path hacks.

β€’ Simple is better than complex - but complex is what you'll get from `utils.py`.

β€’ Flat is better than nested - unless you're three layers deep in a method chain.

β€’ Now is better than never - especially when writing compatibility layers for Python 2.

β€’ Although never is often better than *right* now - unless you're handling NoneType.

β€’ If the implementation is hard to explain, call it Pythonic and write a blog post.

β€’ If the implementation is easy to explain, rename it three times and

/r/Python
https://redd.it/1lkabe1
Switching from Flask to Django β€” what should I learn beyond the basics?

Hey everyone,

I've previously worked with Flask for backend development and I'm now shifting to Django for a new project. The frontend is built using React, and I'll be connecting it to a Django backend (separate folders).

Due to time constraints, I’m going through a 1-hour Django crash course to get up to speed. I understand the basics of models, views, and routing, but I’m wondering:

>

Specifically, I’ll be handling Firebase Authentication on the frontend, and passing the idToken to Django for verification and protected routes.

Any advice on:

API development best practices in Django?
CORS and handling frontend/backend communication?
Firebase token verification in Django?
How to structure Django apps cleanly for APIs?

Appreciate any tips, gotchas, or resources that helped you when doing a similar stack. πŸ™Œ

/r/djangolearning
https://redd.it/1lk4kmg
Django tip Very Important Consolidate Your Migrations (Squash Migrations)

/r/django
https://redd.it/1lk6ffv
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏒

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1lklnhr
πŸš€ A Beautiful Python GUI Framework with Animations, Theming, State Binding & Live Hot Reload

πŸ”— GitHub Repo: [WinUp](https://github.com/mebaadwaheed/winup)

**What My Project Does**

**WinUp** is a modern, component-based GUI framework for Python built on PySide6 with:

* A real reactive state system (`state.create`, `bind_to`)
* **Live Hot Reload** (LHR) – instantly updates your UI as you save
* Built-in theming (light/dark/custom)
* Native-feeling UI components
* Built-in animation support
* Optional PySide6/Qt integration for low-level access

No QML, no XML, no subclassing Qt widgets β€” just clean Python code.

**Target Audience**

* Python developers building desktop tools or internal apps
* Indie hackers, tinkerers, and beginners
* Anyone tired of Tkinter’s ancient look or Qt's verbosity

**Comparison with Other Frameworks**

|Feature|WinUp|Tkinter|PySide6 / PyQt6|Toga|DearPyGui|
|:-|:-|:-|:-|:-|:-|
|Syntax|Declarative|Imperative|Verbose|Declarative|Verbose|
|Animations|Built-in|No|Manual|No|Built-in|
|Theming|Built-in|No|QSS|Basic|Custom|
|State System|Built-in|Manual|Signal-based|Limited|Built-in|
|Live Hot Reload|βœ… Yes|❌ No|❌ No|βœ… Yes|❌ No|
|Learning Curve|Easy|Easy|Steep|Medium|Medium|

**Example: State Binding with Events**

import winup
from winup import ui

def App():
counter = winup.state.create("counter", 0)
label = ui.Label()
counter.bind_to(label, 'text', lambda c: f"Counter Value: {c}")

def increment():
counter.set(counter.get() + 1)



/r/Python
https://redd.it/1lkwvz9
Good Open Source / Good First Issue Repos for Django

Greetings everyone,

So I'm looking forward to keep learning Django but I would totally love to collaborate on projects that aren't made from scratch since I once heard that in the real world we probably won't be building apps from scratch.


I'm seeking if anyone here knows about or has one open source project I could jump in? Maybe like fixing some bugs or adding some featured that haven't been added, at the moment I'm still pursuing my degree and I got one year left so I believe this is my best option for real life experience as well as professional experience in the field, I can still afford to collaborate without getting payed so I would totally aprreciate if you guys know about anything :)

Thank you very much, have a nice day!

/r/django
https://redd.it/1lklmdf
Flask session not being retrieved properly

Dear flask users,

I have developed (vide-coded) a flask-based [webapp](https://www.sieversstudyhall.com/) to practice German grammar. It is hosted on pythonanywhere.

The code is here: [https://github.com/cbjcamus/Sievers-Study-Hall](https://github.com/cbjcamus/Sievers-Study-Hall)

I don't want to use logins because I'm tired of having to create an account on every website I visit. I'm therefore relying on server-based sessions to store each user's progress.

Here is the behavior I get:

* While a user practice German, the progress is stored correctly.
* While the browser stays opened, the progress is mostly stored from one day to the next.
* /!\\ When one opens a browser, uses the app, closes the browser, and opens the same browser the next day, the progress hasn't been saved.

Concerning the last point, it is the case with every browser I've tried (Chrome, Firefox, Edge, Brave), and for each browser the "third-party cookies" are accepted and the "Delete cookies when the browser is closed" isn't checked.

The behavior I would like to have:

* A user opens a browser, uses the app, closes the browser, and opens the same browser on the same device the next day, the progress has been saved.
* If a user doesn't use the app for three months on the same browser and device, the progress is erased -- timedelta(days=90)

I'm

/r/flask
https://redd.it/1lkvgqg
Kajson: Drop-in JSON replacement with Pydantic v2, polymorphism and type preservation

# What My Project Does

Ever spent hours debugging "Object of type X is not JSON serializable"? Yeah, me too. **Kajson** fixes that nonsense: just swap `import json` with `import kajson as json` and watch your Pydantic models, **datetime objects**, enums, and entire class hierarchies serialize like magic.

* **Polymorphism that just works**: Got a `Pet` with an `Animal` field? Kajson remembers if it's a `Dog` or `Cat` when you deserialize. No discriminators, no unions, no BS.
* **Your existing code stays untouched**: Same `dumps()` and `loads()` you know and love
* **Built for real systems**: Full Pydantic v2 validation on the way back in - because production data is messy

# Target Audience

**This is for builders shipping real stuff**: FastAPI teams, microservice architects, anyone who's tired of writing yet another custom encoder.

**AI/LLM developers doing structured generation**: When your LLM spits out JSON conforming to dynamically created Pydantic schemas, Kajson handles the serialization/deserialization dance across your distributed workers. No more manually reconstructing BaseModels from tool calls.

**Already battle-tested**: We built this at Pipelex because our AI workflow engine needed to serialize complex model hierarchies across distributed workers. If it can handle our chaos, it can handle yours.

# Comparison

**stdlib json**: Forces you to write custom encoders for

/r/Python
https://redd.it/1ll1djh