Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels
Dash plotly Deployment
Hi People. Im new to flask and my area of expertise is data analytics.Recently i had been asked to recreate a Power BI report in dash plotly and im almost done with it. Now i need to deploy the same for end users (approx 200 users will be using it). I just wanted to ask what are suitable deployment options for this. I want something budget friendly.
/r/flask
https://redd.it/1jmmp5q
Django Devs! Help Me Build OctopusDash – A Better Django Dashboard
Yo devs! I’m working on **OctopusDash**, a modern, lightweight Django admin panel alternative that actually looks good and makes your life easier. It’s built with **TailwindCSS** and has some cool features like **drag-and-drop M2M fields, custom actions, analytics, and better filtering.**
💡 **But here’s the deal:** It’s still in development, and I need some extra hands to make it stable and production-ready. If you’re into Django, open-source projects, or just want to build something awesome, let’s do this!
# 🚧 Current Status
* Still a work in progress – **expect bugs & API changes**
* Not ready for production yet, but great for testing
* Need help with **refining features, adding JWT authentication, and making it more solid**
# ✅ Cool Features So Far
* **Modern TailwindCSS UI** (finally, an admin panel that looks good 😅)
* **One-line model registration**
* **Drag & Drop M2M field management**
* **Advanced search & filtering**
* **Custom actions & pages**
* **Built-in analytics & widgets**
* **Better permissions & access control**
🚀 **What’s Coming Next?**
* **JWT authentication & API views**
* **More customization & performance tweaks**
# 📸 Sneak Peek
https://preview.redd.it/eeijgz33okre1.png?width=1920&format=png&auto=webp&s=1230270b5f475b7af64bd0e0780d502274771a75
# 👨💻 Want to Help?
* Check out the GitHub repo **(https://github.com/husseinnaeemsec/octopus-dash)**
* Test it out, break it, report issues, and suggest cool features
* Send PRs if you’re up for it!
Let’s build
/r/django
https://redd.it/1jmg7g8
Struggling with Django Deployment: WS, Celery, Docker, and Azure – Need Guidance!
Hey everyone,
I’m trying to deploy my Django backend, but this one is way more complex than what I’m used to. I’ve deployed DRF with a PostgreSQL DB and Redis cache on Azure Web App Service before, but this time, I’ve hit a lot of roadblocks.
Here’s the stack I’m dealing with:
* **Django + DRF**
* **Django Channels (WebSockets)** – I initially set up WS, then stumbled upon WSS, and things got messy. Eventually, it just didn’t work.
* **Celery + Redis** – Handling background tasks like email sending.
* **Celery Beat** – For scheduling tasks.
* **Dockerized app** – Everything is containerized.
I attempted deploying on **Azure Kubernetes Service (AKS)**, and it worked—*but* I did everything manually (manifests, deployments, etc.), and I *need* a proper CI/CD pipeline. Plus, AKS is **costly**, and I’m wondering if there’s a better approach.
So my main questions are:
1. **What’s the best way to deploy this setup on Azure with a CI/CD pipeline?**
2. **Should I stick with AKS, or is there a more cost-effective alternative that supports WS & Celery?**
3. **Any recommendations on handling WSS properly in production?**
Would love to hear from anyone who’s deployed something similar! Any guidance or resources would be super helpful.
Thanks in advance!
/r/djangolearning
https://redd.it/1jipyxu
Wireup 1.0 Released - Performant, concise and type-safe Dependency Injection for Modern Python 🚀
Hey r/Python! I wanted to share **Wireup** a dependency injection library that just hit 1.0.
What is it: A. After working with Python, I found existing solutions either too complex or having too much boilerplate. Wireup aims to address that.
# Why Wireup?
* 🔍 **Clean and intuitive syntax** \- Built with modern Python typing in mind
* 🎯 **Early error detection** \- Catches configuration issues at startup, not runtime
* 🔄 **Flexible lifetimes** \- Singleton, scoped, and transient services
* ⚡ **Async support** \- First-class async/await and generator support
* 🔌 **Framework integrations** \- Works with FastAPI, Django, and Flask out of the box
* 🧪 **Testing-friendly** \- No monkey patching, easy dependency substitution
* 🚀 **Fast** \- DI should not be the bottleneck in your application but it doesn't have to be slow either. Wireup outperforms Fastapi Depends by about 55% and Dependency Injector by about 35%. See [Benchmark code](https://github.com/maldoinc/wireup/tree/benchmarks/benchmarks).
# Features
# ✨ Simple & Type-Safe DI
Inject services and configuration using a clean and intuitive syntax.
@service
class Database:
pass
@service
class UserService:
def __init__(self, db: Database) ->
/r/Python
https://redd.it/1jimec9
Django allauth social auth and JWT
Hi All, Quick question, considering my front end in react only uses JWT to communicate with the backend DRF, how do I get the JWT token that requires a username/pass when I do social login with Google for example? Thanks! G. P.S Using allauth in headless version.
/r/django
https://redd.it/1jiay4j
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
React with flask?
Hello!
I really like using flask for personal projects, my question is, is it still common to be writing your own custom html and JavaScript? It seems like most web frameworks now involve using react.
Is there ever a situation where it makes more sense to write your own custom JavaScript with html? Or will that never be as good as using React?
Thanks!
/r/flask
https://redd.it/1jmogyk
Cocommit: A Copilot for Git commit command
I wanted to share a project I worked on during my weather-non-cooperating vacation: a copilot for `git commit`.
# What My Project Does
This command-line application enhances last commit message (i.e., the current `HEAD`) using an LLM. It provides:
* A summary of the commit message quality.
* An analysis of its strengths and weaknesses.
* A suggested commit message for an optional amend.
The application uses LangChain to interact with various LLMs. Personally, I use Claude 3.7 via AWS Bedrock and OpenAI's GPT-4o.
The source code: [GitHub Repository](https://github.com/andrewromanenco/cocommit). And it is available with `pip install cocommit`.
# Target Audience
This tool is designed for software engineers. Personally, I run it after every commit I make, even when using other copilots to assist with code generation.
# Comparison
[Aider](https://github.com/Aider-AI/aider) is a full command-line copilot, similar in intent to GitHub Copilot and other AI-powered coding assistants.
Cocommit, however, follows a different paradigm: it operates exclusively on Git commits. By design, Git commits contain valuable context—both in terms of actual code changes and the intent behind them—making them a rich source of information for improving code quality.
/r/Python
https://redd.it/1jiplpp
Redirection not working
https://redd.it/1jiop5t
@pythondaily
safe-result: A Rust-inspired Result type for Python to handle errors without try/catch
Hi Peeps,
I've just released safe-result, a library inspired by Rust's Result pattern for more explicit error handling.
## Target Audience
Anybody.
## Comparison
Using safe_result
offers several benefits over traditional try/catch exception handling:
1. Explicitness: Forces error handling to be explicit rather than implicit, preventing overlooked exceptions
2. Function Composition: Makes it easier to compose functions that might fail without nested try/except blocks
3. Predictable Control Flow: Code execution becomes more predictable without exception-based control flow jumps
4. Error Propagation: Simplifies error propagation through call stacks without complex exception handling chains
5. Traceback Preservation: Automatically captures and preserves tracebacks while allowing normal control flow
6. Separation of Concerns: Cleanly separates error handling logic from business logic
7. Testing: Makes testing error conditions more straightforward since errors are just values
## Examples
### Explicitness
Traditional approach:
def processdata(data):
# This might raise various exceptions, but it's not obvious from the signature
processed = data.process()
return processed
# Caller might forget to handle exceptions
result = processdata(data) # Could raise exceptions!
With safe_result
:
@Result.safe
/r/Python
https://redd.it/1jimiz0
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