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
ANN django-smart-ratelimit: A simple, flexible rate-limiting library for Django

Hey everyone! I just released django-smart-ratelimit v0.3.0—a lightweight, configurable rate-limiting solution for Django projects. I’d love to get early feedback from the community.

# 🔍 What it does

Per-view, per-IP and global limits out of the box
Supports function-based and class-based views
Pluggable storage backends (cache, Redis, etc.)
Simple decorator and mixin API
Multiple Algorithms (sliding\_window, fixed\_window, and more soon)

# 🚀 Quickstart

pip install django-smart-ratelimit

#
views.py
from django_smart_ratelimit.decorator import ratelimit

@rate_limit(key='ip', rate='10/m', block=True)
def my_view(request):
return HttpResponse("Hello, rate-limited world!")

PYPI Link [
https://pypi.org/project/django-smart-ratelimit/](https://pypi.org/project/django-smart-ratelimit/)

Full docs and examples 👉 [
https://github.com/YasserShkeir/django-smart-ratelimit](https://github.com/YasserShkeir/django-smart-ratelimit)

# 🛣️ Roadmap

Check out the full feature roadmap here:
[
https://github.com/YasserShkeir/django-smart-ratelimit/blob/main/FEATURES\_ROADMAP.md](https://github.com/YasserShkeir/django-smart-ratelimit/blob/main/FEATURES_ROADMAP.md)

# Feedback & Contributions

Tried it in your project? Let me know how it went!
Found a bug or want an enhancement? Open an issue or PR on GitHub.
General questions? Ask below and I’ll be happy to help.

Thanks for your time—looking forward to your thoughts!
— Yasser (creator)

/r/django
https://redd.it/1lsvvdg
Built a Python-based floating HUD for developers.

Hey everyone,

I recently finished a project called DevHUD, a floating heads-up display for desktop built with Python (using PyQt5). It’s designed to stay on top of your workspace and provide quick access to useful tools without disrupting your workflow.

# What My Project Does

DevHUD displays system stats, clipboard history, GitHub activity, a focus timer, theme settings, and music player all in a compact, always-on-top interface. It’s meant to help developers reduce context switching and stay focused without leaving their active window.

# Target Audience

DevHUD is intended for developers and power users who want lightweight productivity tools that stay out of the way. While it’s still early in development, it’s stable enough for personal use and I’m actively seeking feedback to improve it.

# Comparison

Unlike full-fledged productivity dashboards or browser-based extensions, DevHUD is a desktop-native, Python-based app built with PyQt5. It focuses only on core features without unnecessary bloat, and runs quietly in the corner, kind of like a HUD in a game, but for your dev setup. Its simplicity and modular design are what set it apart.

Links:
GitHub: https://github.com/ItsAkshatSh/DevHUD
Website: https://devhud.vercel.app
YouTube Series: https://www.youtube.com/@CodingtillIgotoanisland

Would love feedback on the tool, UI, or code structure, happy to discuss or answer questions.

Thanks!

/r/Python
https://redd.it/1lt1tav
My first web app w/Flask

Repo:
https://github.com/SalvoLombardo/mascagnidemo

I just finished my first full web app built with Flask after about five months of learning on my own. It’s a simple app for a small music association that runs yearly subscription campaigns.
I’ve studied a lot in the last 5 months but I know this is just the start. There are some features that are missing but I spent around 2-3 weeks and I’m exhausted and I need to go further in my path.

——
https://mascagni-demo-e0f00e6ab048.herokuapp.com
user:admin
demo
pass:demo
If you want to try some functionality, right now doesn’t have too much data in the db, just the necessary
———-


Some quick highlights:
• User auth (register/login/logout)
• Admin panel with full CRUD
• Modular design with Flask Blueprints
• Custom forms with Flask-WTF
• Basic security: CSRF protection and bcrypt password hashing

One interesting thing is the way the app handles subscribers — no unique phone/email constraints — because the association wanted to keep it close to their paper-based workflow in a small town.
Admins create campaigns and assign ticket batches, and operators sell tickets only after that. Operators can edit only their own data, while admins have full control.

I’d love any feedback or suggestions — I’m still learning and would appreciate input from anyone experienced.
Thanks!


/r/flask
https://redd.it/1lsfwtb
We built an AI-agent with a state machine instead of a giant prompt

Hola Pythonistas,

Last year we tried to bring an LLM “agent” into a real enterprise workflow. It looked easy in the demo videos. In production it was… chaos.

* Tiny wording tweaks = totally different behaviour
* Impossible to unit-test; every run was a new adventure
* One mega-prompt meant one engineer could break the whole thing • SOC-2 reviewers hated the “no traceability” story

We wanted the predictability of a backend service and the flexibility of an LLM. So we built NOMOS: a step-based state-machine engine that wraps any LLM (OpenAI, Claude, local). Each state is explicit, testable, and independently ownable—think Git-friendly diff-able YAML.

Open-source core (MIT), today.

* GitHub: [https://github.com/dowhiledev/nomos](https://github.com/dowhiledev/nomos)
* Documentation: [https://nomos.dowhile.dev](https://nomos.dowhile.dev)

Looking ahead: we’re also prototyping Kosmos, a “Vercel for AI agents” that can deploy NOMOS or other frameworks behind a single control plane. If that sounds useful, Join the waitlist for free paid membership for limited amount of people.

[https://nomos.dowhile.dev/kosmos](https://nomos.dowhile.dev/kosmos)

Give us some support by contributing or simply by starring our project and Get featured in the website instantly.

Would love war stories from anyone who’s wrestled with flaky prompt agents. What hurt the most?

/r/Python
https://redd.it/1lsw6ka
ImGui Bundle: (web) apps in pure Python

I am the author of ["Dear ImGui Bundle"](https://pthom.github.io/imgui_bundle/index.html), a fully open-source GUI framework for Python,
using the “Immediate Gui” paradigm.

I recently made it available on the Web via Pyodide, and I thought it was worth sharing to the broader Python community.
Read the following article to learn more about it, and how it compares to other Python web frameworks like Streamlit or Gradio.

> [**(Web) Apps in pure Python using ImGui Bundle**](https://code-ballads.net/dear-imgui-bundle-build-real-time-python-web-applications-with-zero-fuss/)


## What "Dear ImGui Bundle" Does

* ImGui Bundle brings to Python the Immediate Mode GUI paradigm, which enables rapid prototyping of interactive applications
with a code that is highly readable and maintainable.
* Provide python bindings for the C++ “immediate-mode” GUI library **Dear ImGui**, as well as scientific utilities and many widgets.
* Run natively on a PC *or* in the browser via Pyodide, with the same code

## Target Audience

* Data-viz prototypers
* Scientific tools
* real-time tools needing 60 FPS interactivity
* Anyone who wants to deploy tools to the web without touching JS/CSS

## Comparison
| Feature | Dear ImGui Bundle | Streamlit / Gradio |
|---------|------------------|--------------------|
| Rendering | GPU immediate-mode | HTML/CSS → DOM |
| Event model | Synchronous frame loop | Async client-server |
| Browser deploy | Pyodide (no server) | Needs backend

/r/Python
https://redd.it/1ltalg4
Monday Daily Thread: Project ideas!

# Weekly Thread: Project Ideas 💡

Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.

## How it Works:

1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.

## Guidelines:

* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.

# Example Submissions:

## Project Idea: Chatbot

**Difficulty**: Intermediate

**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar

**Description**: Create a chatbot that can answer FAQs for a website.

**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)

# Project Idea: Weather Dashboard

**Difficulty**: Beginner

**Tech Stack**: HTML, CSS, JavaScript, API

**Description**: Build a dashboard that displays real-time weather information using a weather API.

**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)

## Project Idea: File Organizer

**Difficulty**: Beginner

**Tech Stack**: Python, File I/O

**Description**: Create a script that organizes files in a directory into sub-folders based on file type.

**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)

Let's help each other grow. Happy

/r/Python
https://redd.it/1ltfxpq
Why do you use Flask?

What do you do that needs Flask? Tell me Abt it

/r/flask
https://redd.it/1ltdloi
Part-time/3-4 months freelance backend

Hey guys i’m looking for a part-time or a freelance 3/4 months job. I’m a backend engineer with experience in django and node.js for frameworks, Docker and AWS for deployment and infrastructure , Databases: Redis, PG , Mysql, mssql ,in addition to experience with fine-tuning transformer models. If anyone has anything of sorts can you hit me up and i’ll send you my cv. Thanks!

/r/django
https://redd.it/1lt7drg
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