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
AsyncMQ – Async-native task queue for Python with Redis, retries, TTL, job events, and CLI support

What the project does:

AsyncMQ is a modern, async-native task queue for Python. It was built from the ground up to fully support asyncio and comes with:

Redis and NATS backends
Retry strategies, TTLs, and dead-letter queues
Pub/sub job events
Optional PostgreSQL/MongoDB-based job store
Metadata, filtering, querying
A CLI for job management
A lot more...

Integration-ready with any async Python stack


Official docs:
https://asyncmq.dymmond.com

GitHub:
https://github.com/dymmond/asyncmq

Target Audience:

AsyncMQ is meant for developers building production-grade async services in Python, especially those frustrated with legacy tools like Celery or RQ when working with async code. It’s also suitable for hobbyists and framework authors who want a fast, native queue system without heavy dependencies.

Comparison:

Unlike Celery, AsyncMQ is async-native and doesn’t require blocking workers or complex setup.

Compared to RQ, it supports pub/sub, TTL, retries, and job metadata natively.

Inspired by BullMQ (Node.js), it offers similar patterns like job events, queues, and job stores.

Works seamlessly with modern tools like asyncz for scheduling.

Works seamlessly with modern ASGI frameworks like Esmerald, FastAPI, Sanic, Quartz....

In the upcoming version, the Dashboard UI will be coming too as it's a nice to have for those who enjoy a nice look and feel on top of these tools.

Would love feedback, questions, or

/r/Python
https://redd.it/1kefrsj
Built a plug-and-play firewall for Flask apps – looking for feedback and testers!


Hey everyone,

I’ve developed FlaskGuard, a plug-and-play firewall library for Flask applications. It aims to protect your app from common web vulnerabilities like SQL injection, XSS, path traversal, and more.

Key Features:
• Detects and blocks malicious requests
• Configurable rules and whitelist
• Easy integration with Flask applications
• Logging for blocked requests with color-coded output
• Detection for various attack vectors

Installation:

From PyPI:

pip install safe-flask

From GitHub:

pip install git+https://github.com/CodeGuardianSOF/FlaskGuard.git

Usage Example:

from flask import Flask
from flask_guard import FlaskGuard

app = Flask(__name__)
FlaskGuard(app)

I’m looking for feedback and testers to help improve the project. If you have suggestions, run into issues, or want to contribute, feel free to check out the GitHub repo:

https://github.com/CodeGuardianSOF/FlaskGuard

Thanks in advance for your support!

/r/flask
https://redd.it/1kdclte
Best way to install python package with all its dependencies on an offline pc.

OS is windows 10 on both PC's.
Currently I do the following on an internet connected pc...

python -m venv /pathToDir

Then i cd into the dir and do
.\scripts\activate

then I install the package in this venv after that i deactivate the venv

using deactivate

then I zip up the folder and copy it to the offline pc, ensuring the paths are the same.
Then I extract it, and do a find and replace in all files for c:\users\old_user to c:\users\new_user

Also I ensure that the python version installed on both pc's is the same.

But i see that this method does not work reliably.. I managed to install open-webui this way but when i tried this with lightrag it failed due to some unknown reason.





/r/Python
https://redd.it/1keaeft
How to import "getflashedmessages()" from flask

So I'm doing this lesson by Miguel Grinberg building a flask app. He has us installing a few packages and importing various functions, classes, and modules, including numerous imports from flask (such as the Flask class, and some functions: render_template(), flash(), url_for(), redirect() ). He then deploys all of this into the app's files, which you can see listed here in his git hub


He also uses the function get_flashed_messages(). But he never imports. That pattern/assemblage of characters (ie: "get_flashed_messages") is found only once in his git, within the body/text of the app/templates/base.html file, where he employs that function within the Jinja logic structure. But he never explicitly imports the function anywhere - at least no where I can see. How can this be?


I was thinking that maybe it automatically imports, and maybe gets pulled along by importing (for example) flash. But researching online, that apparently is not true. Apparently, the only way to import this function is by actually and explicitly writing the code to import it; ie: from flask import get_flashed_messages().

So what am I missing here?


Thanks for time on this matter and interest in helping me to resolve this.

/r/flask
https://redd.it/1kdc4ab
Django Firefly Tasks - simple and easy to use background tasks in Django

Simple and easy to use background tasks in Django without dependencies!

Documentation: https://lukas346.github.io/django\_firefly\_tasks/

Github: https://github.com/lukas346/django\_firefly\_tasks

Features

Easy background task creation
🛤️ Multiple queue support
🔄 Automatic task retrying
🛠️ Well integrated with your chosen database
🚫 No additional dependencies
🔀 Supports both sync and async functions



/r/django
https://redd.it/1keqqqe
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/1key6k7
🚀 Introducing TkRouter — Declarative Routing for Tkinter

Hey folks!

I just released TkRouter, a lightweight library that brings declarative routing to your multi-page Tkinter apps — with support for:

Features:
- /users/<id> style dynamic routing
- Query string parsing: /logs?level=error
- Animated transitions (slide, fade) between pages
- Route guards and redirect fallback logic
- Back/forward history stack
- Built-in navigation widgets: RouteLinkButton, RouteLinkLabel

Here’s a minimal example:

from tkinter import Tk
from tkrouter import create_router, get_router, RouterOutlet
from tkrouter.views import RoutedView
from tkrouter.widgets import RouteLinkButton

class Home(RoutedView):
def __init__(self, master):
super().__init__(master)
RouteLinkButton(self, "/about", text="Go to About").pack()

class About(RoutedView):
def __init__(self, master):
super().__init__(master)
RouteLinkButton(self, "/", text="Back to Home").pack()

ROUTES = {
"/": Home,
"/about": About,
}

root = Tk()
outlet = RouterOutlet(root)
outlet.pack(fill="both", expand=True)
create_router(ROUTES, outlet).navigate("/")
root.mainloop()


📦 Install via pip
pip install tkrouter


📘 Docs
https://tkrouter.readthedocs.io

💻 GitHub
https://github.com/israel-dryer/tkrouter

🏁 Includes built-in demo commands like:
tkrouter-demo-admin     # sidebar layout with query params
tkrouter-demo-unified # /dashboard/stats with transitions
tkrouter-demo-guarded # simulate login and access guard


Would love feedback from fellow devs. Happy to answer questions or take

/r/Python
https://redd.it/1kew6fz
Apk for sports forecasts

I have a super good page with football predictions, can anyone create an APK and put those predictions there? If it is possible?

/r/Python
https://redd.it/1kf29oy
DVD Bouncing Animation

* **What My Project Does:** Creates a simple animation which (somewhat) replicates the old DVD logo bouncing animation displayed when a DVD is not inserted
* **Target Audience:** Anyone, just for fun
* **Comparison**: It occurs in the command window instead of a video

(Ensure windows-curse is installed by entering "pip install windows-curses" into command prompt.


GitHub: [https://github.com/daaleoo/DVD-Bouncing](https://github.com/daaleoo/DVD-Bouncing)

/r/Python
https://redd.it/1keblmk
Query about celery

Is someone who can send me a best free video link or documents to get knowledge about celery and channels in Django ?

/r/django
https://redd.it/1kf35j2
Data Structure Algorithm in python

Hey everyone! I'm currently learning Data Structures and Algorithms (DSA) using Python. I'd love to connect with others on the same journey maybe we can study, share resources, or solve problems together!

/r/Python
https://redd.it/1kf66ct
Read pdf as html

Hi,

Im looking for a way in python using opensource/paid, to read a pdf as html that contains bold italic, font size new lines, tab spaces etc parameters so that i can render it in UI directly and creating a new pdf based on any update in UI, please suggest me is there any options that can do this job with accuracy

/r/Python
https://redd.it/1kf640j
ChatForge: A free, open-source AI chat client with 300+ models (GPT-4, Claude 3, etc.)—no subscriptions, pay-per-token!

I’ve been working on ChatForge—a no-BS, open-source chat client that lets you access 318+ AI models (GPT-4.1 Mini, Claude 3.7, Qwen, Gemini, etc.) from one dashboard. No upfront costs, no monthly fees—just pay for tokens you actually use.

Why bother?

Free-tier models: Test drive without even adding a payment method.
Persistent chats: Name/organize convos like files (RIP losing your 2am AI rants).
Customizable: Set default models, API keys, etc.
Simple UI: Not a design award winner, but it’s clean and functional (I’m a dev, not a designer—sue me).

It’s 100% free and community-driven. I’d love feedback (or contributions if you’re into Python/Django).

Try it or roast it:
🔗 GitHub

P.S. If you’ve tried similar tools (like OpenRouter’s web UI), how’s this compare? Honest takes welcome.

/r/django
https://redd.it/1kf89nu
Read pdf as html

Hi,

Im looking for a way in python using opensource/paid, to read a pdf as html that contains bold italic, font size new lines, tab spaces etc parameters so that i can render it in UI directly and creating a new pdf based on any update in UI, please suggest me is there any options that can do this job with accuracy

/r/Python
https://redd.it/1kf641m
How would you handle achievements and achievement progress n a Django app?

I’m working on a Django web app where I want to introduce badges/achievements for users — things like:

* Play 10 random quizzes in a day
* Finish 100 quizzes in total
* Play 7 days in a row

Here’s the basic model setup I’m considering:
```
class Achievement(models.Model):
code = models.CharField(max_length=100, unique=True) # e.g., 'play_10_quizzes'
name = models.CharField(max_length=200)
description = models.TextField()
icon = models.ImageField(upload_to='achievement_icons/', null=True, blank=True)

class UserAchievement(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
achievement = models.ForeignKey(Achievement, on_delete=models.CASCADE)
unlocked_at = models.DateTimeField(auto_now_add=True)

class Meta:
unique_together = ('user', 'achievement')
```

How best to save and calculate/track user progress toward an achievement?

I’ve been reading that using Django signals might not be the best approach here, and I’m wondering what patterns or architecture others have used.

**Specifically:**

* Do you calculate achievement progress dynamically (on the fly) when the frontend requests it?
* Or do you store progress in the database and increment it every time an action happens (e.g., quiz completed), so reads are faster?
* How do you handle edge cases, like historical data changes or deletions?
* Any tips on scaling this

/r/django
https://redd.it/1kf9a2b
Any repo on learning pywebview bundling for Mac

Any guide I can follow, I need to add spacy model along with bundle, it increases the size of the app, also the app isn’t able to connect to the backend once I build using Pyinstaller but works well while running locally.

/r/Python
https://redd.it/1kf4rlf
Why should one write tests?

First of all I will not question whether it is necessary to write tests or not, I am convinced that it is necessary, but as the devil's advocate, I'd like to know the real good reasons for doing this. Why devil's advocate? I have my app, that is going well (around 50k users monthly). In terms of complexity it's definetely should be test covered. But it's not. At all. Yeah, certainly there were bugs that i caught only in production, but i can't understand one thing - if i write tests for thousands cases, but just don't think of 1001 - in any case something should appear in prod. Not to mention that this is a very time consuming process.


P.S. I really belive I'll cover my app, I'm just looking for a motivation to do that in the near future

/r/django
https://redd.it/1kfbsc0
strif: A tiny, useful Python lib of string, file, and object utilities

I thought I'd share **strif**, a tiny library of mine. It's actually old and I've used it quite a bit in my own code, but I've recently updated/expanded it for Python 3.10+.

I know utilities like this can evoke lots of opinions :) so appreciate hearing if you'd find any of these useful and ways to make it better (or if any of these seem to have better alternatives).

What it does: It is nothing more than a tiny (\~1000 loc) library of \~30 string, file, and object utilities.

In particular, I find I routinely want atomic output files (possibly with backups), atomic variables, and a few other things like base36 and timestamped random identifiers. You can just re-type these snippets each time, but I've found this lib has saved me a lot of copy/paste over time.

Target audience: Programmers using file operations, identifiers, or simple string manipulations.

Comparison to other tools: These are all fairly small tools, so the normal alternative is to just use Python standard libraries directly. Whether to do this is subjective but I find it handy to `uv add strif` and know it saves typing.

boltons is a much larger library of general utilities. I'm sure a lot of it

/r/Python
https://redd.it/1kfksn1
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/1kfqwcv
Are there any boilerplates or templates you are using currently? If so, what is your project?

Want to learn to review code and get a sense for proper structure and gain in depth knowledge about overall development. What modules are a must for your development? I also enjoy reading about another developer’s workflow and productivity.

/r/flask
https://redd.it/1kfvibz
[Hiring] Full stack dev with REACT Js & Django Experience

Need an experienced dev with plenty of experience building scalable web and mobile apps. The role is open to anyone in the world.

Pay: $75 AUD / hr. 20 hours need per week now, but more will be needed later on.

**Some crucial skills:**

* Amazing design skills. You need to be a very creative designer and know how to use CSS (and tailwind CSS)
* Worked with projects that use heaps of CRUD operations
* Understanding on how to build scalable APIs. Some past web apps we’ve built have brought in 1M+ users per month, so the backend needs to be built to scale!
* File storing, S3 and data handling
* Experience with both Django and REACT js
* Experience with REACT Native as well
* (optional) experience with building software that uses WAV & MP3 files
* Thorough knowledge around algorithm development
* Experience with building unique programs in the past with custom functionality.

**Hours & Pay:**

Email me if interested - [admin@outreachaddict.com](mailto:admin@outreachaddict.com). Please include links to stuff you’ve worked on in the past.  

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