Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels
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/1jidmi9
Announcing Kreuzberg V3.0.0
Hi Peeps,
I'm happy to announce the release (a few minutes back) of Kreuzberg v3.0. I've been working on the PR for this for several weeks. You can see the PR itself here and the changelog here.
For those unfamiliar- Kreuzberg is a library that offers simple, lightweight, and relatively performant CPU-based text extraction.
This new release makes massive internal changes. The entire architecture has been reworked to allow users to create their own extractors and make it extensible.
## Enhancements:
- Added support for multiple OCR backends, including PaddleOCR, EasyOCR and making Tesseract OCR optional.
- Added support for having no OCR backend (maybe you don't need it?)
- Added support for custom extractor.
- Added support for overriding built-in extractors.
- Added support for post-processing hooks
- Added support for validation hooks
- Added PDF metadata extraction using Playa-PDF
- Added optional chunking
And, of course - added documentation site.
## Target Audience
The library is helpful for anyone who needs to extract text from various document formats. Its primary audience is developers who are building RAG applications or LLM agents.
## Comparison
There are many alternatives. I won't try to be anywhere near comprehensive
/r/Python
https://redd.it/1ji2x08
Space Science Tutorial: Saturn's ring system
Hey everyone,
maybe you have already read / heard it: for anyone who'd like to see Saturn's rings with their telescope I have bad news...
1. Saturn is currently too close to the Sun to observe it safely
2. Saturn's ring system is currently on an "edge-on-view"; which means that they vanish for a few weeks. (The maximum ring appearance is in 2033)
I just created a small Python tutorial on how to compute this opening-angle between us and the ring system using the library astropy. Feel free to take the code and adapt it for your educational needs :-).
GitHub Link
YouTube Link
Thomas
/r/Python
https://redd.it/1ji0etq
Best way to handle concurrency in Python for a micro-benchmark ? (not threading)
Hey everyone, I’m working on a **micro-benchmark** comparing concurrency performance across multiple languages: Rust, Go, Python, and Lua. Out of these, **Python is the one I have the least experience with**, so I could really use some input from experienced folks here!
# The Benchmark Setup:
* The goal is to test how each language handles **concurrent task execution**.
* The benchmark runs **15,000,000 loops**, and in **each iteration**, we send a **non-IO-blocking request** to an **async function** with a **1-second delay**.
* The function takes the loop index `i` and appends it to the **end of an array**.
* The final expected result would look like:csharpCopyEdit\[0, 1, 2, ..., 14\_999\_999\]
* We measure **total execution time** to compare efficiency.
# External Libraries Policy:
* **All external libraries are allowed** as long as they **aren't runtime-related** (i.e., no JIT compilers or VM optimizations).
* **For Rust**, I’ve tested this using **Tokio, async-std, and smol**.
* **For Go**, I’ve experimented with **goroutines and worker pools**.
* **For Python, I need guidance!**
# My Python Questions:
* Should I go for **vectorized solutions** (NumPy, Numba)?
* Would **Cython** or a different low-level optimization be a better approach?
* What’s the best async library to use? Should I stick with **asyncio** or use something like **Trio or Curio**?
*
/r/Python
https://redd.it/1jhn4fo
Quality Python Coding
From my start of learning and coding python has been on anaconda notebooks. It is best for academic and research purposes. But when it comes to industry usage, the coding style is different. They manage the code very beautifully. The way everyone oraginises the code into subfolders and having a main py file that combines everything and having deployment, api, test code in other folders. its all like a fully built building with strong foundations to architecture to overall product with integrating each and every piece. Can you guys who are in ML using python in industry give me suggestions or resources on how I can transition from notebook culture to production ready code.
/r/Python
https://redd.it/1jhq18b
How do I filter search results based off their closeness to a search string in with querysets?
Hi,
So I'm working on a view that shows various products, and as I've been writing
a set of user filters for this view I have run into a problem with filtering with this code.
```
products = Product.objects.filter(
Q(name__icontains=q) & Q(category__icontains=c)
| Q(description__icontains=q) & Q(category__icontains=c))
```
q refers to the search query string, and c refers to the category selection.
This is supposed to be the default results with no ordering, but I end up with everything ordered by date created even though I have no default ordering set in the Product Model.
What is more annoying is when I have a search query with default ordering everything is returned alphabetized and not what's most relevant.
For example if I search for phone apple phone should be second and phone should be first, but it's the other way around.
What's the best way to filter objects based off what's closest to the search query?
Here is the Product model if that helps
```
class Product(models.Model):
CATEGORIES = (
('clothes shoes accessories', 'Clothes, shoes, accessories'),
('sporting goods', 'Sporting goods'),
('crafts', 'Crafts'),
('collectibles',
/r/djangolearning
https://redd.it/1jg499z
Sunday Daily Thread: What's everyone working on this week?
# Weekly Thread: What's Everyone Working On This Week? 🛠️
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
/r/Python
https://redd.it/1jhmdi1
Sr. Software Engineer seeking new position.
Hey everyone! I'm reaching out to the people of this community hoping for some advice and/or leads. I'm a senior engineer who specializes in web development. I mainly use Django, React and PostgreSQL as well as Docker with a few other components to build web applications and small services. I have 8 years of experience in the industry and I'm looking for a new role due to a cultural shift (as best I can describe it). Unfortunately, I'm not sure where to look. I've only ever had one job and not many I know work in same field & tech stack. I was hoping some of you could point me in the right direction. I've tried LinkedIn but it seem hard to find Django jobs specifically. How do you all find jobs? Any good tips? Thank you in advance.
/r/django
https://redd.it/1jhjd9w
Custom path params validation
Hi, I'm registering a custom url parameter converter to handle "user" params in paths.
For example I have the following route
userrolesroutes = UserRolesAPI.asview("userroles")
app.addurlrule("/users/<user:user>/roles", viewfunc=userrolesroutes)
and in the get route I can access the user directly
def get(self, user: User):
return user.roles
I implemented the custom parameter converter using
from werkzeug.routing import BaseConverter, ValidationError
class UserConverter(BaseConverter):
def topython(self, value: str):
try:
userid = int(value)
except ValueError:
raise ValidationError("Invalid user ID")
user = db.session.execute(db.select(User).filterby(id=userid)).scalaroneornone()
if user is None:
/r/flask
https://redd.it/1jgwcpc
[Research]Can AI remember irreversibly, like a brain does? I built a model that tries — and it works surprisingly well.
Most AI models update memory reversibly — but biological memory doesn’t work that way. The brain forgets, evolves, and never “undoes” anything.
I built a model called TMemNet-I, which uses:
* entropy-based decay
* irreversible memory updates (high KL divergence)
* tools like recurrence plots, permutation entropy, and Lyapunov exponents (still being refined)
It beats Transformers and CNNs on long-term retention and memory asymmetry.
Paper: [http://dx.doi.org/10.13140/RG.2.2.22521.99682](http://dx.doi.org/10.13140/RG.2.2.22521.99682)
It’s still a work in progress (some chaos metrics need tightening), but early results show signs of real emergent memory.
Is this a step toward more brain-like memory in AI?
Open to thoughts, questions, and critique.
/r/MachineLearning
https://redd.it/1jh6lr0
Starting to learn Backend Development for the very first time using Flask
Hey guys! I have started to learn Flask recently but I saw that the styling of the page was also being done in the tutorials using HTML and CSS. I am well versed with the fundamentals of Python and know basic HTML and CSS. But when it comes to applying CSS for styling, it really sucks. Also I just want to go for Backend Development and have no plans for Frontend as of now. So what should I do to ease the styling of the page?
Also I wanted to ask whether any JS will be required if I want to pursue only Backend Development using only Flask? I don't know JS at all.
/r/flask
https://redd.it/1jgrewm
Announcing Dash Particles: Interactive tsParticles Animations for Dash
Announce the release of Dash Particles, a new component library that brings beautiful, interactive particle animations to your Dash applications!
# What My Project Does?
Dash Particles is a wrapper around the powerful tsParticles JavaScript library, making it seamlessly available in Dash (only published for python, but probably easy to publish in R, julia). It allows you to create stunning interactive visual effects shown on the Github
# Installation
pip install dash-particles
# Example Usage
import dash
from dash import html
import dashparticles
app = dash.Dash(name)
app.layout = html.Div([
html.H1("My App with Particles"),
dashparticles.DashParticles(
id="particles",
options={
"background": {
"color": {"value":
/r/Python
https://redd.it/1jgzenr
Something's wrong!
I'm trying to learn django with w3schools tutorials. I learned python there and it was fine. I learned numpy and pandas and they were easy and readable and comprehensible. But now in the django tutorial I find myself completely lost!
Look I don't even know where the problem is. is it me? is it the tutorial? the django itself?
Cause I haven't worked web before at all. I didn't even knew how to find directory in cmd but I'm researcher at heart. I dig deep and figure it out. But I find myself, with django, in a state of despair. I'm up till models tutorial and still copy-pasting stuff and I don't know why. There are lots of lines to copy which none I'm familiar with and since I don't understand them, repeating them and writing them doesn't help either. Tutorial doesn't explain these to me and I honestly for the first time feel overwhelmed.
Should I have a background in web dev then I learn django? Am I missing something?
/r/django
https://redd.it/1jgac79
Using Polars as a Vector Store - Can a Dataframe library compete?
Hi! I wanted to share a project I've been working on that explores whether Polars \- the lightning-fast DataFrame library - can function as a vector store for similarity search and metadata filtering.
What My Project Does
The project was inspired by this blog post. The idea is simple: store vector embeddings in a Parquet file, load them with Polars and perform similarity search operations directly on the DataFrame.
I implemented 3 different approaches:
1. NumPy-based approach
: Extract embeddings as NumPy arrays and compute similarity with NumPy functions.
2. Polars TopK
: Compute similarity directly in Polars using the top_k
function.
3. Polars ArgPartition
: Similar to the previous one, but sorting elements leveraging the arg\_partition plugin (which I implemented for the occasion).
I benchmarked these methods against ChromaDB (a real vector database) to see how they compare.
Target Audience
This project is a proof of concept to explore the feasibility of using Polars as a vector database. At its current stage, it has limited real-world use cases beyond simple examples or educational purposes. However, I believe anyone interested in the topic can gain valuable insights from it.
Comparison
You can find a more detailed analysis on the README.md of the project, but here’s the summary:
\- ✅ Yes, Polars can be used as
/r/Python
https://redd.it/1jgtjnr
Column data getting mixed up in SQLAlchemy database for rows at random
So here is the deal. I have a list of dictionaries which I am looping through, adding each of the keys to a database in each iteration of a loop. After the entire list has been added and committed to the database, I look at the database, and randomly (or it seems random at least), there are rows that are duplicated but when several of the column data shifted to the wrong column. Most of the time, it seems like a duplicate row where this happens (one row is fine, the other is screwy), but I have seen at least one row where there isn't a duplicate but its columns are mixed up.
If all rows are like this, then I would gather that the issue is somewhere in my code, the way that I am adding data to the columns of my database in the flask app logic, but since most rows are okay (maybe 80%), I'm not too sure what is going on is in the logic but rather somewhere else.
See the attached picture for an example of the database record which is faulty (row 17, which seems to be a faulty copy of row 18) and below for
/r/flask
https://redd.it/1jg8rmo
How to Manage Django Migrations in a Production Environment?
I'm a bit confused about how to manage Django migrations in a production environment. In one of my projects, I am the only developer, and I am pushing the migration files to production. However, I want to know how to manage this process when multiple people are working on the same project and modifying the schema. Specifically, what happens if multiple developers are modifying the same models? How should we handle these scenarios effectively?
/r/django
https://redd.it/1ji5mmw
As a C programmer, what blew your mind when you first learned Python?
As a C programmer, what blew your mind when you first learned Python?
In C you have to write lots of functionality before you can even get started – if you need a dictionary, you have to write it yourself. C++ has fixed this by having a nice standard library, but for C you are on your own.
/r/Python
https://redd.it/1ji1oly
Is Flask still a good choice in 2025?
I love how simple and flexible Flask is, and I don’t really need the async speed boost that FastAPI offers (yet). But I’m curious:
Are people still choosing Flask for new projects?
Has anyone switched from Flask to FastAPI or something else? Was it worth it?
For those still sticking with Flask, what keeps you coming back?
/r/flask
https://redd.it/1jht6e5
MyPy, BasedMypy, Pyright, BasedPyright and IDE support
Hi all, earlier this week I spent far too long trying to understand why full Python type checking in Cursor (with the Mypy extension) often doesn’t work.
That got me to look into what the best type checker tooling is now anyway. Here's my TLDR from looking at this.
Thought I'd share, and I'd love any thoughts/additions/corrections.
Like many, I'd previously been using Mypy, the OG type checker for Python. Mypy has since been enhanced as BasedMypy.
The other popular alternative is Microsoft's Pyright. And it has a newer extension and fork called BasedPyright.
All of these work in build systems. But this is a choice not just of build tooling—it is far preferable to have your type checker warnings align with your IDE warnings. With the rises of AI-powered IDEs like Cursor and Windsurf that are VSCode extensions, it seems like type checking support as a VSCode-compatible extension is essential.
However, Microsoft's popular Mypy VSCode extension is licensed only for use in VSCode (not other IDEs) and sometimes refuses to work in Cursor. Cursor's docs suggest Mypy but don't suggest a VSCode extension.
After some experimentation, I found BasedPyright to be a credible improvement on Pyright. BasedPyright is well maintained, is faster than Mypy, and has
/r/Python
https://redd.it/1jhiwne
Efficient Python Programming: A Guide to Threads and Multiprocessing
🚀 Want to speed up your Python code? This video dives into threads vs. multiprocessing, explaining when to use each for maximum efficiency. Learn how to handle CPU-bound and I/O-bound tasks, avoid common pitfalls like the GIL, and boost performance with parallelism. Whether you’re optimizing scripts or building scalable apps, this guide has you covered!
In the video, I start by showing a normal task running without concurrency or parallelism. Then, I demonstrate the same task using threads and multiprocessing so you can clearly see the speed difference in action. It’s not super low-level, but focuses on practical use cases and clear examples to help you understand when and how to use each approach effectively.
🔗 Watch here: https://www.youtube.com/watch?v=BfwQs1sEW7I&t=485s
💬 Got questions or tips? Drop them in the comments!
/r/Python
https://redd.it/1jhkhq5
Needed help and suggestions on integrating mailing services on side project
Hey everyone, I want to integrate mailing services into my side project. Can you suggest ways to implement this? My tech stack consists of a Django backend and a Next.js frontend. I'm open to adding new technologies if needed.
/r/django
https://redd.it/1jhnpj2
Lihil — a high performance modern web framework for enterprise web development in python
Hey everyone!
I’d like to introduce Lihil, a web framework I’ve been building to make Python a strong contender for enterprise web development.
Let me start with why:
For a long time, I’ve heard people criticize Python as unsuitable for large-scale applications, often pointing to its dynamic typing and mysterious constructs like *args
and **kwargs
. Many also cite benchmarks, such as n-body simulations, to argue that Python is inherently slow.
While those benchmarks have their place, modern Python (3.10+) has evolved significantly. Its robust typing system greatly improves code readability and maintainability, making large codebases easier to manage. On the performance side, advancements like Just-In-Time (JIT) compilation and the upcoming removal of the Global Interpreter Lock (GIL) give me confidence in Python’s future as a high-performance language.
With Lihil, I aim to create a web framework that combines high performance with developer-friendly design, making Python an attractive choice for those who might otherwise turn to Go or Java.
GitHub: https://github.com/raceychan/lihil
Docs& tutorials: https://liihl.cc/lihil
## What My Project Does
Lihil is a performant, productive, and professional web framework with a focus on strong typing and modern patterns for robust backend development.
Here are some of its core features:
## Performance
Lihil is very fast, about 50-100% faster than other ASGI frameworks providing
/r/Python
https://redd.it/1jh6rt4
Simple game built with Django Rest Framework and JS
Hello everybody! I have been working on this Wordle-like game using Django and JavaScript for about two months. I would love for you guys to check it out! I wanted to know your thoughts and feedback on my code. Are there any security issues or anything I should change? The main concern I have is whether my code is optimal/efficient or safe. My app is deployed on Heroku, and I stored my media files in S3. The repo below has my local development code, and the production code is in a private repo.
Here is the project https://github.com/Ryan11c/kordle
Thank you👍
/r/django
https://redd.it/1jhe6i2
Looking for production level Django projects to learn from!
TLDR:
I am a junior software developer looking to improve using examples of production level open source django projects!
Hi all,
I am a junior software developer and the company I work for uses Django Rest Framework on the backend. I have been at the company around a year and looking to move up to mid level developer. The current code base that my company uses does not always follow best practices and industry standards. To learn more and improve our code base I am looking for examples of production level open source projects that I can use as reference.
As much as the django documentation is useful it is great to see how others code!
Thanks all!
/r/django
https://redd.it/1jh51cp
Advanced/better error reporting than inserting a butt load of print statements?
I am working on a somewhat large Django project. I only develop back end and I am remote. I get frustrated when there is a large function but the error output in the console is is function name, some Django/python internal function names and errors and then TypeError: Object of ValueError is not JSON serializable.
I mean the function is huge. It can span over views, then multiple modules calling other functions. But I don't get where exactly the function failed. Is the error from my side or from the front end payload being wrong datatype. Sometimes it's difficult to catch when there are around 15 variables/data objects are being passed from request. Why do I need to insert 10 different print statement in the code rather than the thing telling me where exactly the function failed? Is there any way? Any library or extension which can help me sort out this issue?
(I am using vscode)
/r/djangolearning
https://redd.it/1jghxlb
Turtle graphics not working with Mac Sequoia. Running Python 3.12.9
I get this error:
2025-03-21 19:38:02.393 python16933:1310835 +IMKClient subclass: chose IMKClientModern
2025-03-21 19:38:02.394 python[16933:1310835] +[IMKInputSession subclass]: chose IMKInputSessionModern
Is there an alternative for graphics? I’m just learning to code.
/r/Python
https://redd.it/1jgvbsc
Saturday Daily Thread: Resource Request and Sharing! Daily Thread
# Weekly Thread: Resource Request and Sharing 📚
Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!
## How it Works:
1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.
## Guidelines:
Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.
## Example Shares:
1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.
## Example Requests:
1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.
Share the knowledge, enrich the community. Happy learning! 🌟
/r/Python
https://redd.it/1jgveqp
DRF Deployment
Hi there, I am fairly new to Django and DRF, I have never deployed a django project but have built small development APIs to learn.
I'm trying to deploy a project with gunicorn and nginx (if there is a better alternative, please let me know)
#PROBLEM
I keep running into an issue where my django admin panel hangs frequently, or takes up to 4s to load the page. Check Chrome tools it's usually jsi18n which takes the most time. My apis calls also have a tendency to hang and ends up timing out. I'm using AWD RDS postgres db.
#TRIED
- Upgrading DB
- Checking my SQL queries (at most 500ms)
- Increasing gunicorn workers
- Changed nginx configuration
#INFO
- I have 2 custom models, an altered base user model and a password otp model
- I'm using simple_jwt
- The hanging or long loading can happen on any call or any django admin page (except login page)
If there is any more information, code examples, please let me know.
I'm really struggling to find modern Deployment techniques for DRF, atm my setup is Docker, gunicorn and nginx. If anyone has any up to date resources for better deployment, I would be incredibly grateful.
/r/django
https://redd.it/1jgku8k
Soft Launch Quick-Scale – A SaaS Starter Kit
Hey everyone,
I’ve been working on Quick-Scale, a free, open-source (Apache 2.0) Django-based SaaS starter kit designed for AI/ML engineers, Data Scientists, and Backend/Cloud developers who want to launch products faster—without getting stuck in full-stack development.
It comes with built-in authentication, deployment, and a scalable architecture so you can focus on building your product instead of boilerplate setup.
Still in development – Stripe integration and Railway deploy are in progress! Would love any feedback or suggestions from fellow devs.
1️) Install: pip install quickscale
2️) Create project: quickscale build awesome-project
3️) Open: http://localhost:8000
Let me know what you think! Happy to answer any questions.
https://pypi.org/project/quickscale/
Thank you!
Víctor.
/r/django
https://redd.it/1jghzq5
Should I Prioritize Learning Programming (Like Python) for AI and Machine Learning After 12th Grade?
I just gave my 12th-grade exams a few weeks ago, and I feel like I might just barely pass. Should I learn a programming language like Python or not? Because I feel like I’m going to waste the next 2-3 months, and once I start doing something, I can only dedicate about 4 hours a day to it. I also want to learn a lot about AI and Machine Learning, as I think I’m interested in this field. For this, I know I need to learn programming languages. So, should I prioritize coding or not? Please someone guide me.
/r/Python
https://redd.it/1jghriu