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
Django e-commerce: Polymorphism vs Multi-Table Inheritance vs Composition for product types - what’s best?

I’m building a Django e-commerce platform with a large taxonomy (many product types) and type-specific fields/properties (e.g., different models for product A, product B, product C, etc.).

I also need to be able to search across all products.

/r/django
https://redd.it/1oxk6s5
The great leap forward: Python 2.7 -> 3.12, Django 1.11 -> 5.2

I would like to thank everyone who gave great advice on doing this upgrade. In the event, it took me about seven hours, with no recourse to AI coding required. The Python 3 version hasn't been pushed into production yet, but I'd estimate it's probably 90% of the way there.

I decided to go for the big push, and I think that worked out. I did take the advice to not go all the way to 3.14. Once I am convinced everything is fully operational, I'll go to 3.13, but I'll hold off on 3.14 for a bit more package support.

Switching package management to \`uv\` helped, as did the small-but-surprisingly-good test suite.

In rough order, the main problems I encountered were:

* bytes and strings. Literals themselves were OK (the code was already all unicode\_literals), but things like hash functions that take bytes were a bit tedious.
* Django API changes. I have to say, love Django to death, but the project's tendency to make "this looks better" breaking changes is not my favorite part of it.
* Django bugs. Well, bug: the \`atomic\` decorator can swallow exceptions. I spent some time tracking down a bytes/string issue because the exception was just \`bad thing happened\`

/r/Python
https://redd.it/1oxhjj7
Kroma: a powerful and simple module for terminal output in Python

*Looking for some feedback on Kroma, my new Python module! Kroma (based on the word "chroma" meaning color) is a modern alternative to libraries like `colorama` and `rich`.*


# What My Project Does

Kroma is a lightweight and powerful library for terminal output in Python. It allows you to set colors, text formatting, and more with ease!

# Target Audience

- Developers wanting to add color to their Python projects' terminal output

# Links

PyPI: https://pypi.org/project/kroma/
Docs: https://www.powerpcfan.xyz/docs/kroma/v2/
GitHub: https://github.com/PowerPCFan/kroma

# Comparison

***"So, why should I give Kroma a try?"***

Kroma has significant advantages over libraries like `colorama`, and Kroma even has features that the very popular and powerful module `rich` lacks, such as:

- Dynamic color manipulation
- Powerful gradient generation
- Built-in color palettes
- Global terminal color scheme management (via palettes)
- Simple, intuitive, lightweight, and focused API

...and more!


# Kroma Showcase

Here are some code snippets showcasing Kroma's features (these snippets—and more—can be found on the docs):

## Complex Multi-Stop Gradients:

You can use Kroma to create complex gradients with multiple color stops.

```python
import kroma

print(kroma.gradient(
"This is a rainbow gradient across the text!",
stops=(
kroma.HTMLColors.RED,
kroma.HTMLColors.ORANGE,


/r/Python
https://redd.it/1oxeb6l
TS/Go --> Python

So I have been familiar with Go & Typescript, Now the thing is in my new job I have to use python and am not profecient in it. It's not like I can't go general programming in python but rather the complete environment for developing robust applications. Any good resource, content creators to check out for understanding the environment?

/r/Python
https://redd.it/1oxnmeq
Oxidized Python/Django packages?

Hey, I’m building own project using Django and many packages use Rust under the hood.

Interesting what people use.

My list of all I’ve used so far:

Django:
- django-minify-html

Logging:
- logly

Web:
- robyn

Database:
- psqlpy

Date time:
- whenever

JSON:
- orjson

Audio:
- sphn

Files:
- opendal

Web server:
- granian
- ferron

Templates:
- minijinja

Code checking:
- ruff

Venv:
- uv

#python #rust

/r/django
https://redd.it/1oxqwd3
UI/UX or Full Stack Web Development ?

What should I learn for a great and secure career?

/r/django
https://redd.it/1oxk6jp
Looking for architecture feedback on a Django multi-vendor marketplace (Stripe Connect, i18n)

Hi folks,

I’m working on a Django-based multi-vendor marketplace platform (vendors, Stripe Connect payouts, i18n, dark Bootstrap UI).

Before I continue adding features, I want to validate the overall *architecture* and make sure I’m not making any big mistakes.

Could someone more experienced with Django architecture share thoughts on:

- project/app structure
- separating vendor logic vs store logic
- the right way to organize Stripe Connect flows
- how to properly structure templates for multi-vendor dashboards
- what would you change before using such a project in production?

If it’s allowed, I can drop the link to the demo / repo in the comments.

Thanks a lot!

/r/django
https://redd.it/1oy25x9
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/1oy6wuf
Google Drive webhooks only send the initial sync, never update… am I missing something obvious?

I’m trying to use Google Drive push notifications with Django and I can successfully create the watch channel I get the initial sync notification but I never receive update notifications for file changes. No errors anywhere, and polling works perfectly. It used to work perfectly, and then suddenly I stopped receiving notifications of changes to my webhook.

Stack: Django 5 + Uvicorn, Drive API v3, OAuth (refresh tokens), webhook via ngrok, DB stores channel info.

What works:

Webhook is reachable (405 GET, 200 POST)
Manual POST to webhook works
changes().watch() returns valid channel\_id + resource\_id
Initial sync arrives instantly
changes().list() detects real changes (page token moves)

What doesn’t:

No update webhook calls for create/edit/delete/move/rename
ngrok shows zero requests except the first sync
No logs or errors anywhere

Questions:

Can Google silently drop subscriptions? Any way to check status?
Does using ngrok free tier break push notifications?
Missing params like supportsAllDrives=true? Wrong token source?
Any way to see delivery logs?

Anyone here actually got Drive push notifications working recently?

/r/django
https://redd.it/1oy6b38
I made a CLI tool that deletes half your files

GitHub link: https://github.com/soldatov-ss/thanos


So I built a little Python CLI tool called "thanos-cli".
It does exactly what you think it does: it deletes half of the files in any directory you point it at.



/r/Python
https://redd.it/1oxypjo
I divided up models.py into different files in flask and I getting circular import errors. Does anyone have any suggestions?

I used chatgpt to create a flask file tree with blueprints.

My code was very similar to this and it was working except the templates are there own folder not nested within the other folders like auth













myapp/



├── app.py

├── config.py

├── extensions.py



├── blueprints/

│ ├── __init__.py

│ ├── main/

│ │ ├── __init__.py

│ │ ├── routes.py

│ │ ├── models.py

│ │ └── templates/

│ │ └── main/

│ │ └── index.html

│ │

│ └── auth/

│ ├── __init__.py

│ ├── routes.py

│ ├── models.py

│ └── templates/

│ └── auth/

│ └── login.html



└── templates/

└── base.html





The problem is I changed the blueprints

/r/flask
https://redd.it/1oydkld
How to get Feedback for a Project?


I am a full-time engineer and in my spare time or as a hobby I like to program. Now I have released a beta version of a website I made with Django to get some feedback from experts but it’s hard to find someone to get useful Feedback.

Do you have experience how to reach people to get feedback without looking like an ad or self promotion? Or is this subreddit already a good place to ask for Feedback?

I’d really appreciate feedback on:
- What works well?
- What’s confusing?
- What’s missing?
- How do design, navigation, and content feel for the user?


/r/djangolearning
https://redd.it/1oyr5p8
EHTML — Extended HTML for Real Apps. Sharing it in case it helps someone.

Hi everyone! I’ve been working on a project called EHTML, an HTML-first approach to building dynamic pages using mostly HTML. It lets you handle things like templating, loops, conditions, data loading, reusable components, and nested forms — all without a build step or heavy JavaScript setup.

I originally built it to simplify my own workflow for small apps and prototypes, but I figured others who prefer lightweight or no-build approaches might find it useful too. It runs entirely in the browser using native ES modules and custom elements, so there’s no bundler or complex tooling involved.

If you enjoy working close to the browser or like experimenting with minimalistic web development, you might find it interesting. Just sharing in case it helps someone or sparks ideas. Cheers!


Link: https://e-html.org/

/r/django
https://redd.it/1oyuy8h
MkSlides: easily turn Markdown files into beautiful slides using a workflow similar to MkDocs!

What my project does:

MkSlides (Demo, GitHub) is a static site generator that's geared towards building slideshows. Slideshow source files are written in Markdown, and configured with a single YAML configuration file. The workflow and commands are heavily inspired by MkDocs and reveal-md.

Features:

Build static HTML slideshow files from Markdown files.
Turn a single Markdown file into a HTML slideshow.
Turn a folder with Markdown files into a collection of HTML slideshows.
Publish your slideshow(s) anywhere that static files can be served.
Locally.
On a web server.
Deploy through CI/CD with GitHub/GitLab (like this repo!).
Preview your site as you work, thanks to python-livereload.
Use custom favicons, CSS themes, templates, ... if desired.
Support for emojis like :smile: :tada: :rocket: :sparkles: thanks to emoji.
Depends heavily on integration/unit tests to prevent regressions.
And more!

Example:

Youtube: https://youtu.be/RdyRe3JZC7Q

Want more examples? An example repo with slides demonstrating all possibilities (Mermaid.js and PlantUML support, multi-column slides, image resizing, ...) using Reveal.js with the HOGENT theme can be found at https://github.com/HoGentTIN/hogent-markdown-slides .

Target audience:

Teachers, speakers on conferences, programmers, anyone who wants to use slide presentations, ... .

Comparison with other tools:

This tool is a

/r/Python
https://redd.it/1oyriug
SmartRSS-RSS parser and Reader in Flask

I recently built a RSS reader and parser using python for Midnight a hackathon from Hack Club All the source code is here

What My Project Does: Parses RSS XML feed and shows it in a Hacker News Themed website.

Target Audience: People looking for an RSS reader, other than that it's a Project I made for Midnight.

Comparison: It offers a fully customizable Reader which has Hacker News colors by default. The layout is also like HN

This project is built using Flask 🤩

You can leave feedback if you want to so I can improve it.
Upvotes are helpful, please upvote if you think this is a good project

A sample image of the Project



/r/flask
https://redd.it/1oysyob
What advice would you give yourself as you embarked on your first Django build?

So my first project is a company secretarial platform to track filings, draft minutes, resolutions, M&As etc from templates as well and holding share registers and statutory appointments and AML/KYC info. I’ve only got a bit of python experience and I’ve never written anything in Django (also seem to be learning a bit of powershell on the fly too). Any rookie errors I could avoid on advice of you good fellas would be much appreciated 👌🏻

/r/djangolearning
https://redd.it/1oyy42x
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/1oz1c67
Ultra-strict Python template v2 (uv + ruff + basedpyright)

Some time ago I shared a strict Python project setup. I’ve since reworked and simplified it, and this is the new version.

> pystrict-strict-python – an ultra-strict Python project template using uv, ruff, and basedpyright, inspired by TypeScript’s --strict mode.

Compared to my previous post, this version:

- focuses on a single pyproject.toml as the source of truth,
- switches to basedpyright with a clearer strict configuration,
- tightens the ruff rules and coverage settings,
- and is easier to drop into new or existing projects.

What it gives you

- Strict static typing with basedpyright (TS --strict style rules):
- No implicit Any
- Optional/None usage must be explicit
- Unused imports / variables / functions are treated as errors
- Aggressive linting & formatting with ruff:
- pycodestyle, pyflakes, isort
- bugbear, security checks, performance, annotations, async, etc.
- Testing & coverage:
- pytest + coverage with 80% coverage enforced by default
- Task runner via poethepoet:
- poe format → format + lint + type check
- poe check → lint + type check (no auto-fix)
- poe metrics → dead code + complexity + maintainability
- poe quality → full quality pipeline
- Single-source config: everything is in

/r/Python
https://redd.it/1oz4x0f
Easiest frontend framework to get started

Hi,

Since the beginning I have solely worked on the DRF. Sometimes if I need frontend then AI does that for me, but now I want to dive into World of frontend as well.

Which one is easiest to start?

Whenever I try frontend I just find that there is a ton of code.

Many of my python files don't generally cross 1000 lines. I am able to easily break them down into components and as per requirement put them into their respective files. But for frontend devs 500 / 1000 lines seems pretty common.

I tried django templates but there is lot to write, vanilla html requires you to write a ton. I also tried react, but still there is a lot to write.


Which one will be easy to get started?

/r/django
https://redd.it/1oz4yj2
Looking to Collaborate on Django + Frontend Projects (We’re a Duo, Still Leveling Up)

We’re two friends trying to get better by building real projects with others.

I’m learning AI/ML and Django backend
My friend is learning frontend (HTML, CSS, JS moving toward React)

If anyone here is working on a Django project and needs contributors, we’d love to join and help out. We’re not experts yet but we’re serious about learning and can handle tasks if you guide us a bit.

If you’re open to collaborating just reply or DM. Thanks

/r/django
https://redd.it/1oz8vdh