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
2-step Process to Upload a File to Azure Storage Blob without Involving the Back-end to Proxy the Upload: Problems Faced

So there is this 2-step upload process I've implemented to store files in my Django back-end backed by Azure Storage Account blobs:
1. Request an upload SAS URL from back-end: The back-end contacts Azure to get a SAS URL with a UUID name and file extension sent by the user. This is now tracked as a "upload session" by the back-end. The upload session's ID is returned along with the SAS URL to the user.
2. Uploading the File and Registration: The front-end running on the browser uploads the file to Azure directly and once successful, it can register the content. How? It sends the upload session ID returned along with the SAS URL. The back-end uses this ID to retrieve the UUID name of the file, it then verifies that the same file exists in Azure and then finally registers it as a Content (a model that represents a file in my back-end).

There are three situations:
1. Upload succeeded and registration successful (desired).
2. Upload failed and registration successful (easily fixable, just block if the upload fails).
3. Upload succeeded but registration failed (problematic).

The problem with the 3rd situation is that the file remains in the Blob Storage but is not registered with the

/r/djangolearning
https://redd.it/1o963yi
Rant: Python imports are convoluted and easy to get wrong

Inspired by the famous "module 'matplotlib' has no attribute 'pyplot'" error, but let's consider another example: numpy.

This works:

from numpy import ma, ndindex, typing
ma.getmask
ndindex.ndincr
typing.NDArray

But this doesn't:

import numpy
numpy.ma.getmask
numpy.ndindex.ndincr
numpy.typing.NDArray # AttributeError

And this doesn't:

import numpy.ma, numpy.typing
numpy.ma.getmask
numpy.typing.NDArray
import numpy.ndindex # ModuleNotFoundError

And this doesn't either:

from numpy.ma import getmask
from numpy.typing import NDArray
from numpy.ndindex import ndincr # ModuleNotFoundError

There are explanations behind this (numpy.ndindex is not a module, numpy.typing has never been imported so the attribute doesn't exist yet, numpy.ma is a module and has been imported by numpy's __init__.py so everything works), but they don't convince me. I see no reason why import A.B should only work when B is a module. And I see no reason why using a not-yet-imported submodule shouldn't just import it implicitly, clearly you were going to import it anyway. All those subtle inconsistencies where you can't be sure whether something

/r/Python
https://redd.it/1o9gyxa
A Full-Stack Django Multi-Tenant Betting & Casino Platform in Django + React

🚀 I built a multi-tenant betting & casino platform in Django that covers everything I’d want to see in a production-grade system!

Thought I’d share with the community my project — Qbetpro, a multi-tenant Django REST API for managing casino-style games, shops, and operators with advanced background processing, caching, and observability built in.

---

### 🌐 Demo
**GitHub Repo**
**Watch the Demo**

---

### 🧱 System Overview

The Qbetpro ecosystem consists of multiple interconnected apps working together under one multi-tenant architecture:

- 🏢 Operator Portal (Tenant Web) – React + Material UI dashboard for operators to manage their casino, shops, and games
- 🏪 Shop Web (Retail Website) – React + Redux front-end for shop owners to manage tickets, players, and transactions
- 🎮 Games – Web games built using React (and other JS frameworks) that communicate with the Django game engine via REST APIs or WebSocket connections. These games handle UI, animations, and timers, while the backend handles logic, results, and validation.
- 🧩 Game Engine (API) – Django REST backend responsible for authentication, result generation, game logic, and transactions
- 📡 Worker Layer – Celery workers handle background game result generation, leaderboard updates, and periodic reporting
- 📊

/r/django
https://redd.it/1o9rwvx
Which language is similar to Python?

I’ve been using Python for almost 5 years now.
For work and for personal projects.

Recently I thought about expanding programming skills and trying new language.

Which language would you recommend (for backend, APIs, simple UI)? Did you have experience switching from Python to another language and how it turned out?

/r/Python
https://redd.it/1o9tvtc
How to make one dropdown field depend upon another dropdown field in django admin?

I have a model like this:

class CourseSection(TimeStampedModel):
course = models.ForeignKey(Course, relatedname='sections')
title = models.CharField(max
length=1000)

I need to make another django model and I want that in my django admin for that model, there should be a dropdown field that shows all the Course objects. Once the course has been selected the second dropdown field shows CourseSection titles, but only for those CourseSections whose course I selected in the first dropdown field.

I can not update the javascript since I am using the default django admin for this. Is this possible? If not then what would be the best way to do something similar?

/r/djangolearning
https://redd.it/1o82h31
I've written an article series about SQLAlchemy, hopefully it can benefit some of you

You can read it here https://fullstack.rocks/article/sqlalchemy/brewing\_with\_sqlalchemy
I'm really attempting to go deep into the framework with this one. Obviously, the first few articles are not going to provide too many new insights to experienced SQLAlchemy users, but I'm also going into some advanced topics, such as:

Custom data types
Polymorphic tables
Hybrid declarative approach (next week)
JSON and JSONb (week after that)

In the coming weeks, I'll be continuing to add articles to this series, so if you see anything that is missing that might benefit other developers (or yourself), let me know.

/r/Python
https://redd.it/1o9zow6
Saving Memory with Polars (over Pandas)

You can save some memory by moving to Polars from Pandas but watch out for a subtle difference in the quantile's different default interpolation methods.

Read more here:
https://wedgworth.dev/polars-vs-pandas-quantile-method/

Are there any other major differences between Polars and Pandas that could sneak up on you like this?

/r/Python
https://redd.it/1oa4r54
I was wrong: SQL is still the best database for Python Flask Apps in 2025 (free friend link)

Back in May 2023 I argued in another tutorial article that you don’t (always) need SQL for building your own content portfolio website. Airtable’s point-and-click UI is nice, but its API integration with Flask still requires plenty of setup — effectively landing you in a weird no-code/full-code hybrid that satisfies neither camp.

https://preview.redd.it/ch7u4t7twovf1.png?width=2464&format=png&auto=webp&s=55dd613223c01be90c6289f3b66c29a1fcc43821

In reality, setting up a PostgreSQL database on Render takes about the same time as wiring up Airtable’s API — and it scales much better. More importantly, if you ever plan to add Stripe payments (especially for subscriptions), SQL is probably the best option. It’s the most reliable way to guarantee transactional integrity and reconcile your records with Stripe’s.

Finally, SQL databases like PostgreSQL and MySQL are open source — meaning no company can suddenly hike up the prices or shut down your backend overnight. That’s why I’ve changed my stance: it’s better to start with SQL early, take the small learning curve hit, and build on solid, open foundations that keep you in control.

I just published an article on Medium with a clear step-by-step guide on how to build your own Flask admin database with Flask-SQLAlchemy, Flask-Migrate, Flask-Admin and Render for Postgres hosting. Here’s the **free friend link** to the article

/r/flask
https://redd.it/1o94dyt
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/1oabdtm
Showcase: I wrote a GitHub Action to Summarize uv.lock Changes

What My Project Does

I have been loving everything about uv but reviewing changes as git diffs is always a chore.
I wrote this action to summarize the changes and provide a simple report via PR comment.

Target Audience

This is intended for anyone building or maintaining Python projects with uv in Github.

Comparison
I could not find any other similar actions out there.

URL: https://github.com/mw-root/uv-lock-report

Example PR Comments:
https://github.com/mw-root/uv-lock-report/raw/main/images/uv-lock-report-simple-comment.png

https://github.com/mw-root/uv-lock-report/raw/main/images/uv-lock-report-table-comment.png

/r/Python
https://redd.it/1oa9e3c
Google Tasks TUI

What My Project Does:

This project is a TUI(terminal user interface) that hooks up with the Google Tasks Api, allowing you to edit and view your tasks straight from your terminal.

Target Audience:

This is just a toy project and for everyone. It is also open source so feel free to make any contributions.

Comparison:

I'm sure there are other TUIs out there similar to this that allows you to keep track of your tasks/notes. I guess this application is nice because it hooks up with your Google Tasks which allows for cross platform use.

Source:

https://github.com/huiiy/GTask

/r/Python
https://redd.it/1oaaddg
Course and book recommendations

**Hey everyone**

I’ve been learning Django for a while and already understand the basics — like how the file system works, setting up views, models, templates, etc. But I feel like my knowledge isn’t solid enough yet to build a **real-world web app from scratch** confidently.

Can anyone recommend:

* **Video courses** (free appreciated)
* **Books**
* Any **other helpful resources** (tutorial series, blogs, open-source projects to study, etc.)

I’m aiming to reach a **medium to advanced level**, where I can build complete production-ready Django apps on my own.

Thanks for any suggestions! 🙏

/r/django
https://redd.it/1oa08sx
For those who miss terminal animations...

Just for ease, the repo is also posted up here.

https://github.com/DaSettingsPNGN/PNGN-Terminal-Animator

What my project does: animates text in Discord to look like a terminal output!

Target audience: other nostalgic gamers who enjoy Fallout and Pokémon, and who are interested in animation in Discord using Python.

Comparison: to my knowledge, there's not another Discord bot that generates on-demand custom responses, animated in a terminal style, and uploaded to Discord as a 60 frame, 5 second 12 FPS GIF. I do this to respect Discord rate limits. It only counts as one message. I also use neon as the human eye has a neon reaction biologically similar to a phosphor glow. The colors persist longer with higher saturation on the human retina, and we interpolate to smooth the motion.

I'm new to Python, but I absolutely love it. I designed an animated Discord bot that has Pokémon/Fallout style creatures. I was thinking of adding battling, but for now it is more an interactive guide.

I used accurate visual width calculations to get the text art wrapping correct. Rendered and then scaled so it fits any device. And then vectorized the rendering. Visual width is expensive, but it lines up in nice columns allowing vectorized rendering.

/r/Python
https://redd.it/1oalj6u
Fun project UV scripts, but for functions.

What My Project Does

I recently created **uv-func**, a small tool that brings the dependency-isolation concept of tools like uv scripts down to the level of individual Python functions. Instead of managing dependencies per module or script, uv-func lets you run discrete functions in a contained environment so they can run, communicate with each other, and manage their dependencies cleanly and separately.

Target Audience

Python developers working with scripts or functions that need to be isolated or decoupled in terms of dependencies.
Hobbyists or maintainers who appreciate minimal tooling (uv-func has only three dependencies: cloudpickle, portalocker and rich).

Note: This isn’t a full framework for large applications — it’s intended to be lightweight and easy to embed or integrate as needed.

Comparison

There are other tools that handle dependency isolation or function-level execution (for example, using containers, virtual environments per script, or Function-as-a-Service frameworks like Ray, etc...).

What sets uv-func apart in my opinion:

1. Minimal footprint: only three external dependencies.
2. Focused on the function-level rather than full modules or services.
3. Lightweight and easy to drop into existing Python codebases without heavy platform or infrastructure requirements.

I see many AWS lambdas using requirements.txt then needing to run `pip install` somewhere in their app or infra code, and

/r/Python
https://redd.it/1oavf1l
Trio - Should I move to a more popular async framework?

I'm new-ish to python but come from a systems and embedded programming background and want to use python and pytest to automate testing with IoT devices through BLE, serial or other transports in the future. I started prototyping with Trio as that was the library I saw being used in a reference pytest plugin, I checked out Trio and was very pleased on the emphasis of the concept of structured concurrency (Swift has this concept with the same name in-grained so I knew what it meant and love it) and started writing a prototype to get something working.

It was quick for me to notice the lack of IO library that support Trio natively and this was bummer at first but no big deal as I could manage to find a small wrapper library for serial communication with Trio and wrote my own. However now that I'm having to prototype the BLE side of things I've found zero library, examples or material that uses Trio. Bleak which is the prime library I see pop-up when I look for BLE and python is written with the asyncio backend. I haven't done a lot of research into asyncio or anyio

/r/Python
https://redd.it/1oah08y
Is it possible to get a referral (india)?

I am 29F have 11 months of experience as Django developer and I'm still working but I need to switch the company for some reason
Is it possible to get a referral?

/r/django
https://redd.it/1oafscc
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

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