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
There is such a thing as "too much TQDM"

TIL that 20% of the runtime of my program was being dedicated to making cute little loading bars with fancy colors and emojis.

Turns out loops in Python are not that efficient, and I was putting loops where none were needed just to get nice loading bars.

/r/Python
https://redd.it/1lthva4
D Remembering Felix Hill and the pressure of doing AI research

Before he left our world by a few days around Oct 2024, I showed Felix Hill an essay I had written about my time in graduate school doing NLP circa 2017-2019.

He encouraged me to share it publicly saying, “It looks good and makes a lot of sense..if you post it it will surely help you and others”

I didn’t have the courage to post about such a personal experience. But as Dostoyevsky would say “much unhappiness has come into the world because of bewilderment and things left unsaid.”

The article garnered the attention of Jeff Dean and he echoed similar feedback.

Here is the article:

https://medium.com/@tahaymerghani/the-dark-side-of-academia-mental-health-mentorship-and-the-unspoken-struggles-of-an-nlp-c25adbd9a2e6

If it resonates, i’m happy to chat. You’ll find a way to reach me.

/r/MachineLearning
https://redd.it/1ltejq6
How are you using just (Justfile) local workflows for Python projects?

Hynek Schlawack just put out another great video on uv (https://youtu.be/TiBIjouDGuI?si=lBfoBG8rgUFcS3Sx), this time also discussing how he uses the just tool to store commands in a cross-platform portable way to do everyday tasks like installing/refreshing virtual environments, running tests/code checks, and development tasks like sending requests.

Is this getting common in Python land? I know it is among Rustaceans (where I first saw it a few months ago), anyone have good examples they wrote/saw, or experiences? Very curious to hear more: Hynek’s style of usage is quite different to how I have been using them. Links to example Justfiles welcome!

I am mainly using them for pre-commit/pre-push checks and to make CI setup ‘self-documenting’ (i.e. clear what is run, from where)

/r/Python
https://redd.it/1ltr3n1
Resolving inconsistent speeds on Railway

Hi everyone!

I have a Django+HTMX app - easypumf.com \- hosted on Railway (Hobby tier), and HTTP request load times are quite inconsistent. "Waiting for server response" times are often very slow (1-15 seconds), but can then be normal (150-250ms) for no apparent reason. There is no real pattern to speeds (so it's not like it is getting faster after a few refreshes). I also do not have the "serverless" option enabled.

My app has no such problem in my local environment. This issue affects every request, including simple partial HTML page loads with no DB connections or large static files. I tried: 1) using cache_control and Cloudflare to cache static pages; 2) adding a Procfile to increase the numbers of workers; 3) refactoring to minimise DB connections. Nothing worked so far.

I tried reaching out to Railway's support site, but I don't have much hope there.

Can anyone help me figure this out? I'd greatly appreciate it :)

/r/django
https://redd.it/1ltqukh
I had no idea changing a Django Project Name was that easy; I recorded the process in case others are afraid of trying...

Up until very recently I was super nervous about changing a Django project's name. I always thought it would mess everything up, especially with all the imports and settings involved.

But once I actually tried it, I realized it is a very simple process.. It only takes a few minutes (if not seconds). I put together a short tutorial/demonstration in case anyone else is feeling the same anxiety about it.

In the video, I walk through renaming a freshly cloned Django starter project.

Here is the link:
https://youtu.be/Ak4XA5QK3\_w

I would love to hear your thought &&/|| suggestions.



/r/django
https://redd.it/1lty35t
Using Celery to manage background tasks with Flask

It has been a long time writing blogs. We intend to share knowledge in a esay to understand format. Kindly visit the link below to understand the same.

https://flask-india.hashnode.dev/using-background-tasks-with-celery-in-flask#heading-lets-get-started

/r/flask
https://redd.it/1ltbjda
Flask Error

from flask import Flask

app = Flask(name)

@app.route("/")
def home():
return "Offline Flask is working!"

if name == "main":
print("Starting Flask server...")
app.run(debug=True)



after running I tried http://127.0.0.1:5000/ in browser and it is not showing anything

I am new this and tried a simple thing


/r/flask
https://redd.it/1lsjhhl
Deepface authentication - library and demo site

I recently published under the MIT License a Django app for face recognition authentication using DeepFace and pgvector. It's intended for audiences where the same group of people authenticate frequently without remembering their passwords, or want minimal keyboard usage. It uses the camera built in to your laptop or screen - in the same way you might use MS Teams, Google Meet, or WhatsApp.
It works fine with a good CPU, but will fly with a GPU.
I would probably use it with the default settings, but there are options you can experiment with in different environments. Because of the use of pgvector, which is currently not indexed, but can be very simply, it should be possible to support many thousands of user.
Github stars and comments appreciated.
https://github.com/topiaruss/django-deepface

/r/django
https://redd.it/1lu7hou
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/1lua5dh
Radiate - evolutionary/genetic algorithm engine

Hello! For the past 5 or so years I've been building `radiate` \- a genetic/evolutionary algorithm written in rust. Over the past few months I've been working on a python wrapper using pyo3 for the core rust code and have reached a point where I think its worth sharing.

**What my project does**:

* Traditional genetic algorithm implementation.
* Single & Multi-objective optimization support.
* Neuroevolution (graph-based representation - [evolving neural networks](http://www.scholarpedia.org/article/Neuroevolution)) support. Simmilar to [NEAT](https://nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf).
* Genetic programming support ([tree-based representation](https://en.wikipedia.org/wiki/Gene_expression_programming#:~:text=In%20computer%20programming%2C%20gene%20expression,much%20like%20a%20living%20organism.))
* Built-in support for parallelism.
* Extensive selection, crossover, and mutation operators.
* Opt-in speciation for maintaining diversity.
* Novelty search support. (This isn't available for python quite yet, I'm still testing it out in rust, but its looking promising - coming soon to py)

**Target Audience** 
Production ready EA/GA problems.

**Comparison** I think the closest existing package is [PyGAD](https://pygad.readthedocs.io/en/latest/). I've used PyGAD before and it was fantastic, but I needed something a little more general purpose. Hence, radiate's python package was born.

**Source Code**

* [Github](https://github.com/pkalivas/radiate).
* [User Guide](https://pkalivas.github.io/radiate/).
* [Python specific examples](https://github.com/pkalivas/radiate/tree/master/py-radiate/examples).

I know EA/GAs have a somewhat niche community within the AI/ML ecosystem, but hopefully some find it useful. Would love to hear any thoughts, criticisms, or suggestions!

/r/Python
https://redd.it/1lu8wvp
Tired of forgetting local git changes? I built a tool to track the status of all your local repos at

As someone who juggles many small projects—both personal and for clients—I often find myself with dozens of local git repositories scattered across my machine. Sometimes I forget about changes I made in a repo I haven’t opened in a few days, and that can lead to lost time or even lost work.



To solve this, I built gits-statuses: a simple tool that gives you a bird’s-eye view of the status of all your local git repositories.



It scans a directory (recursively) and shows you which repos have uncommitted changes, unpushed commits, or are clean. It’s a quick way to stay on top of your work and avoid surprises.



There are two versions:

Python: cross-platform and easy to integrate into scripts or cron jobs
PowerShell: great for Windows users who want native terminal integration

Check it out here: https://github.com/nicolgit/gits-statuses

Feedback and contributions are welcome!

/r/Python
https://redd.it/1luiz8o
D Stop building monolithic AI agents - Pipeline of Agents pattern

Context: Needed to build scan → attack → report workflow for cybersecurity. First attempt was typical "everything in one graph" disaster.

The mess: One LangGraph trying to do everything. Unmaintainable. Untestable. Classic big ball of mud but with AI.

The fix: Pipeline of Agents

Sequential execution with clean interfaces
State isolation between child graphs
Each agent independently developable/testable
Follows actual software engineering principles

Technical details: Used LangGraph wrapper nodes to convert parent state to child state. Only pass minimal required data. No global state sharing.

Result: Actually maintainable AI architecture that doesn't make you hate your life.

Full breakdown with Python implementation: https://vitaliihonchar.com/insights/how-to-build-pipeline-of-agents

Question: Are others finding similar patterns necessary as AI systems get more complex?

/r/MachineLearning
https://redd.it/1lumxa6
Project Using LDV-style compression to create an innovation machine

I'm experimenting with a method to increase the conceptual density of ideas by compressing science and engineering concepts into minimal-vocabulary statements using the Longman Defining Vocabulary (LDV) - the core 2,000 building block words of the English language.

The hypothesis: reducing lexical complexity increases the chance that a language model will recombine latent structural similarities between otherwise distant concepts, when prompted accordingly ( I've got a whole program on these prompts as well).

That is, I'm trying to build a genuine innovation machine, bit by byte.

Rather than maximizing fluency, the goal is to preserve mechanistic structure using ~2,000 basic English words. This trades off precision and abstraction in favor of semantic alignment, similar to how concept bottlenecks work in neuro-symbolic systems.

The Why:

LLMs today are surprisingly poor at discovering cross-domain connections. When pushed, they tend to revert to well-trodden academic hallucinations, the kinds you find in introductions and conclusions of academic papers.

A compressed lexical environment, like LDV, exposes the mechanical spine of each idea. The hope is that this makes unexpected adjacencies more accessible.

Examples:

LDV-style input: 3 mechanisms

1. “A bucket with a hole lets water out slowly.”
→ time-delay or pressure bleed-off

2. “A button lets water go from one part to another.”
→ valve or

/r/MachineLearning
https://redd.it/1lun8s3
PatchMind: A CLI tool that turns Git repos into visual HTML insight. no cloud, no bloat

# What My Project Does

**PatchMind** is a modular Python CLI tool that analyzes local Git repos and generates a self-contained HTML report. It highlights patch-level diffs, file tree changes, file history, risk scoring, and blame info — all visual, all local, and no third-party integrations required.

# Target Audience

Primarily intended for developers who want fast, local insight into codebase evolution — ideal for solo projects, CI pipelines, or anyone sick of clicking through slow Git web UIs just to see what changed.

# Comparison

Unlike tools like GitHub’s diff viewer or GitKraken, PatchMind is entirely local and focused on generating reports you can keep or archive. There’s no sync, no telemetry, and no server required — just run it in your terminal, open the HTML, and you’re good.

It’s also **zero-config**, supports **risk scoring**, and can show **inline blame summaries** alongside patch details.

**How Python Is Involved**
The entire tool is written in Python 3.10+, using:

* `GitPython` for Git interaction
* `jinja2` for templating HTML
* `pyyaml`, `rich`, and `pytest` for config, CLI output, and tests

**Install:**

pip install patchmind

**Source Code:**
🌐 [GitHub - Darkstar420/patchmind](https://github.com/Darkstar420/patchmind)

Let me know what you think — or just use it and never look back. It’s under Apache-2.0, so

/r/Python
https://redd.it/1luifni
How to learn Django?

Do I follow documentation or a youtube series or anything else. I have been following the python roadmap on roadmap.sh and i am planning on learning django as my main framework for python.

P.S: I suck at reading documentation, so if you can suggest how to read documentations too.

/r/django
https://redd.it/1luvtga
Favorite ML paper of 2024? D

What were the most interesting or important papers of 2024?

/r/MachineLearning
https://redd.it/1luvynh
Lost Chapter of Automate the Boring Stuff: Audio, Video, and Webcams

https://inventwithpython.com/blog/lost-av-chapter.html

The third edition of Automate the Boring Stuff with Python is now available for purchase or to read for free online. It has updated content and several new chapters, but one chapter that was left on the cutting room floor was "Working with Audio, Video, and Webcams". I present the 26-page rough draft chapter in this blog, where you can learn how to write Python code that records and plays multimedia content.

/r/Python
https://redd.it/1luv77k
Beginner's Guide

Hello! I have finished learning Python. I want to make a website on Django. Please, recommend beginner's guide: books or web resources that thoroughly discuss website creation. I liked A Complete Beginner's Guide to Django (2017) by Vitor Freitas. Completed the whole thing and deploy one training site. But maybe there are more up-to-date instructions/books. Thank you! P.S. Django documentation is always open.

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