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
Single process, multiple interpreters, no GIL contention - pre-Python3.12

Hey y'all. Over the past week I figured out how to run subinterpreters without a locking GIL in py3.8. Longish post here about how - https://basisrobotics.tech/2025/05/26/python/ but TL;DR:

1. Use `dlmopen` to manually open `libpython3.8.so` for each interpreter you like

2. Find a way to inject the pthread_ APIs into that handle

3. Fix a bunch of locale related stuff so that numpy and other things import properly

4. Don't actually do this, why would you want to do this, it's probably going to break some mystery way anyhow

/r/Python
https://redd.it/1kvy7nf
Codel: Search code from all over the internet

This is an attempt of making a useful website people can use and publishing it, enjoy!

codel-search.vercel.app

Here's the github link too!

\-> https://github.com/usero1a/codel-python-public

/r/flask
https://redd.it/1kw0ngz
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/1kw9et4
MicroPie (ultra thin ASGI framework) version 0.9.9.8 Released

Few days ago I released the latest 'stable' version of my MicroPie ASGI framework. MicroPie is a fast, lightweight, modern Python web framework that supports asynchronous web applications. Designed with flexibility and simplicity in mind.

Version 0.9.9.8 introduces minor bug fixes as well as new optional dependency. MicroPie will now use orjson (if installed) for JSON responses and requests. MicroPie will still handle JSON data the same if orjson is not installed. It falls back to json from Python's standard library.

We also have a really short Youtube video that shows you the basic ins and outs of the framework: https://www.youtube.com/watch?v=BzkscTLy1So

For more information check out the Github page: https://patx.github.io/micropie/

/r/Python
https://redd.it/1kwd9ml
CometChat API integration for Django

So for a little bit of background, I am currently an intern and I was tasked with choosing a backend framework for a new project. My co-interns are more comfortable with Python (due to school projects) so they want to go with Django. However, my supervisor is more on Laravel/PHP. I was considering to go with Laravel/PHP for the guidance advantages. My co-interns and I did learn Laravel/PHP but some of them are really struggling since we are only given a week to take everything in.

We had a discussion and my supervisor wants to know if CometChat API would be compatible with Django. I have been researching and the only resources I could find were with Laravel/PHP. My supervisor needs a final answer regarding the chosen backend framework (Django or Laravel) tomorrow, so I really need advice from experts who have more experience.

/r/django
https://redd.it/1kwccpq
Skylos- Another dead code sniffer (but hear me out)

Hey everyone! 👋

We've been working on Skylos, a Python static analysis tool that helps you find and remove dead code from your projs (again.....). We are trying to build something that actually catches these issues faster and more accurately (although this is debatable because different tools catch things differently). The project was initially written in Rust, and it flopped, there were too many false positives and the speed was just 2 seconds faster than vulture, a close competitor. Now we have completely rewritten the entire codebase in Python. We have also included how we do our benchmarking, so any feedback is welcome. It can be found in the root directory titled BENCHMARK.md

# What Skylos Does:

Detects unreachable functions and methods
Finds unused imports (even aliased ones)
Identifies unused classes
Spots unused variables
Detects unused parameters (just added this!)
Smarter heuristics to avoid false positives

# Target Audience:

Python developers working on medium to large codebases
Teams looking to reduce technical debt
Open source maintainers who want to keep their projects clean
Anyone tired of manually searching for dead code

# Key Features:

bash
# Basic usage
skylos /path/to/your/project



/r/Python
https://redd.it/1kwakjj
Set Up User Authentication in Minutes — With or Without Managing a User Database


Github: lihil
Official Docs: lihil.cc

## What My Project Does

As someone who has worked on multiple web projects, I’ve found user authentication to be a recurring pain point. Whether I was integrating a third-party auth provider like Supabase, or worse — rolling my own auth system — I often found myself rewriting the same boilerplate:

- Configuring JWTs

- Decoding tokens from headers
- Serializing them back
- Hashing passwords
- Validating login credentials

And that’s not even touching error handling, route wiring, or OpenAPI documentation.

So I built lihil-auth, a plugin that makes user authentication a breeze. It supports both third-party platforms like Supabase and self-hosted solutions using JWT — with minimal effort.

### Supabase Auth in One Line

If you're using Supabase, setting up authentication is as simple as:

from lihil import Lihil
from lihil.plugins.auth.supabase import signin_route_factory, signup_route_factory

app = Lihil()
app.include_routes(
signin_route_factory(route_path="/login"),
signup_route_factory(route_path="/signup"),
)

Here signin_route_factory and signup_route_factory generate the /login and /signup routes for you, respectively. They handle everything from user registration to login, including password hashing and JWT generation(thanks to supabase).

You can customize credential type by configuring sign_up_with parameter, where you might want to use phone instead of email(default option) for signing up users:

These routes immediately become available in your OpenAPI docs (/docs), allowing you to

/r/Python
https://redd.it/1kwftsz
Django lovers, did you try Litestar?

Hi there!

I've worked with Django for many years and loved it. Then I tried FastAPI to make a fair comparison and despite some positive points (like strict typing), I was a bit disapointed by the overall experiance because I constantly needed to reinvent the wheel for no real reason.

Then I found litestar and thought it's a perfect sweet spot between FastAPI and Django. Very modern, but with batteries included.

I wrote a blog post about it, if you want to find out why I think it's better than FastAPI: https://www.david-dahan.com/blog/litestar-is-the-fastapi-killer

/r/django
https://redd.it/1kv5h89
Project I just built my first project and I was wondering if I could get some feedback. :)

What My Project Does: Hello! I just created my first project on Python, its called Sales Report Generator and it kinda... generates sales reports. :)

You input a csv or excel file, choose an output folder and it can provide files for excel, csv or pdf. I implemented 7 different types of reports and added a theme just to see how that would go.

Target Audience: Testers? Business clerks/managers/owners of some kind if this was intended for publishing.

Comparison: I'm just trying new things.

As I mentioned, its my very first project so I'm not expecting for it to be impressive and would like some feedback on it, I'm learning on my own so I relied on AI for revising or whenever I got stuck. I also have no experience writing readme files so I'm not sure if it has all the information necessary.

The original version I built was a portable .exe file that didn't require installation, so that's what the readme file is based on.

The repository is here, I would like to think it has all the files required, thanks in advance to anyone who decides to give it a test.

/r/Python
https://redd.it/1kwqo6f
Blog: ReThinking Django Template: Part 1

Ever feel like your Python code is super neat, but your Django templates are a total mess? You're not alone. As a full-stack Django developer, I've seen a lot of projects where the backend is clean, but the templates are hard to read and maintain.

HTML tags, template tags, long Tailwind CSS classes, and even JavaScript and SVG strings all mixed together can make a template a nightmare.

It's time to change that.

This is the first in my series, "ReThinking Django Template." We'll explore better ways to write your templates so they're easier to understand and keep up. For this first post, we're tackling a big one: how to handle JavaScript in your Django templates.

Ready to make your templates much cleaner?

Read ReThinking Django Template: Part 1 Here!

/r/django
https://redd.it/1kwok9y
Deploying Django on Cpanel

A friend of mine who's new to Django had a rough time trying to deploy his project on cPanel. After struggling for 4 days, he asked me for help. I walked him through the whole process — from setting up the Python app to handling static files in production.

To make it easier for others who might face the same issue, I recorded a step-by-step video
How to Deploy https://youtu.be/6\_HH5k76A2s?si=S4Mgp2OEU8pScMhj
How to serve static files https://youtu.be/qxtDxIJJIFw?si=H43VPtAgZqOLUGaI

Let me know what you think — and feel free to drop any suggestions or improvements!

/r/djangolearning
https://redd.it/1kuedkk
New meaty chapter on SimPy Architecture & Patterns – Stop simulations looking like a dog's dinner!

Alright, if you're interested in simulation in Python (ideally with SimPy) then this one is for you.

If you've ever had a simulation model that's started to resemble a particularly tricky knot or perhaps a bowl of spaghetti after a toddler's had a go... You know, the kind where changing one thing makes three other things wobble precariously? We've all been there, no shame in it!

Well, despair no more! I've just bolted a brand-new chapter onto my book, **"Simulation in Python with SimPy,"** and this one's all about **Simulation Architecture and Patterns;** basically, how to build your models so they're less of a headache and more of a well-oiled machine.

**So, what's in the tin?** I cover the essentials to keep your code clean and your mind clear:

* **Basic SimPy Processes:** For when you need to get things moving, quick and simple.
* **Object-Oriented Architecture (OOA):** Getting a bit more grown-up, perfect for when your simulations have many moving parts that need to behave themselves.
* **Entity Component System (ECS):** Fancy a bit of that game-dev magic? ECS is brilliant for those really complex beasts where entities have all sorts of different hats they wear. (There's a beefy gas station example in a Colab

/r/Python
https://redd.it/1kwsgkw
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

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