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
Tilf - a Pixel Art Editor written with PySide6

Hello everyone, lately I’ve been having fun with SDL, and I wanted to try creating a small adventure video game, nothing too complex. However, to call something a proper videogame, you also need a visual component, maybe made up of a few characters and objects interacting with each other, perhaps using Pixel Art, which I personally love.

I searched online, and most of the tools that let you create even a single sprite require an account, ask for an email, are paid, or only work online. There is some open-source software that runs locally, but it can be quite complex to set up, and all I really want are a few simple tools to draw the character/object I have in mind.

Why not create an editor that only does that one thing? From past experience, I’ve loved working with Qt, especially using PySide widgets. So, here it is: I wrote it from scratch using PySide6. No installations, no configurations. You just download it to your computer and start using it right away.

There’s still a lot that could be improved, but it remains a simple and personal project, nothing demanding. I just hope it might be useful to others. It runs on Windows,

/r/Python
https://redd.it/1mno2u4
Used Django for the first time on a project and I am kind of blown away.

My wife and I had an idea for a project a few months ago that I finally got around to building (it's not ready for prime time yet so currently gated behind a mountain of Cloudflare rules). When I started on it I was using Flask for some quick hit tests of the concepts but was getting a bit frustrated extending features and how it does what it says on the tin and little else. I went down the headless CMS route for a bit playing with your standard headless Wordpress approach since I used to be pretty good in php but didn't feel like learning React or Node. Even tried Strapi which wasn't bad but not what I wanted either. Both of those CMS's were almost TOO feature rich and I felt like I was fighting them more than using them.

At a previous company we were a heavy duty Django shop (I ran ops/infra teams so we only made sure it worked at scale and all the pre-production environments worked) and I'm still friends with a bunch of people who used to write Python and worked in Django so I thought I'd give it a

/r/django
https://redd.it/1mnb4ym
I built a tool to auto-transcribe and translate China's CCTV News

What My Project Does

I created a Python tool that automatically downloads, transcribes, and translates episodes of CCTV's "Xinwen Lianbo" (新闻联播) - China's most-watched daily news program - into English subtitles.

Target Audience

Perfect for Chinese language learners who want to practice with real, current news content. The translations are faithful and contextual, making it easier to understand formal/political Chinese vocabulary.

\- Local transcription with Chinese-optimized ASR model (FunASR Paraformer)
\- OpenRouter API for translation (DeepSeek V3-0324)
\- All built with modern Python tooling (uv, typer, etc.)
\- Uses ffmpeg, yt-dlp to generate ready-made "burned" video with subtitles and processing.

Comparison

There is no project like this on GitHub (yet).

GitHub: https://github.com/piotrmaciejbednarski/cctv-xinwen-lianbo-en

/r/Python
https://redd.it/1mnp1st
eQuacks Toy Currency

eQuacks is my attempt at a toy currency. It literally has not use, but it works normally. Its backend is in Flask, so I thought I might post this here. I'll send you some of this currency if you post your eQuacks username.

Link: https://equacks.seafoodstudios.com/

Source Code: https://github.com/SeafoodStudios/eQuacks

/r/flask
https://redd.it/1mnj5z8
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/1mnthov
PEP 802 – Display Syntax for the Empty Set

PEP 802 – Display Syntax for the Empty Set
https://peps.python.org/pep-0802/

# Abstract

We propose a new notation, {/}, to construct and represent the empty set. This is modelled after the corresponding mathematical symbol ‘∅’.

This complements the existing notation for empty tuples, lists, and dictionaries, which use ()[], and {} respectively.

>>> type({/})
<class 'set'>
>>> {/} == set()
True

# Motivation

Sets are currently the only built-in collection type that have a display syntax, but no notation to express an empty collection. The Python Language Reference notes this, stating:

>An empty set cannot be constructed with {}; this literal constructs an empty dictionary.

This can be confusing for beginners, especially those coming to the language from a scientific or mathematical background, where sets may be in more common use than dictionaries or maps.

A syntax notation for the empty set has the important benefit of not requiring a name lookup (unlike set()). {/} will always have a consistent meaning, improving teachability of core concepts to beginners. For example, users must be careful not to use set as a local variable name, as doing so prevents constructing new sets. This can be frustrating as beginners may not know how to recover the `set` type if they have overriden the name.

/r/Python
https://redd.it/1mnuan1
I built a tiny tool to convert Pydantic models to TypeScript. What do you think?

At work we use FastAPI and Next.js, and I often need to turn Pydantic models into TypeScript for the frontend. Doing it by hand every time was boring, slow, and easy to mess up so I built a small app to do it for me.

* Paste your Pydantic models/enums, get clean TypeScript interfaces/types instantly.
* Runs 100% in your browser (no server, no data saved)
* One-click copy or download a .ts file

# What My Project Does

My project is a simple website that converts your Python Pydantic models into clean TypeScript code. You just paste your Pydantic code, and it instantly gives you the TypeScript version. It all happens right in your browser, so your code is safe and never saved. This saves you from having to manually type out all the interfaces, which is boring and easy to mess up.

# Target Audience

This is for developers who use FastAPI on the backend and TypeScript (with frameworks like Next.js or React) on the frontend. It's a professional tool meant to be used in real projects to keep the backend and frontend in sync.

# Comparison

There are other tools out there, but they usually require you to install them and use your computer's command line. My tool is different because it's

/r/Python
https://redd.it/1mo20uc
🚀 Introducing Beautypy – Open-Source Django UI Component Library

Hey Django devs! 👋

I’ve been working on an open-source project called Beautypy — a Django UI component library designed to help developers quickly add beautiful, reusable, and customizable UI elements without wasting hours on CSS and HTML.

# 📌 What is Beautypy?

Beautypy is:

A growing collection of ready-to-use Django template components
Styled with modern design principles out of the box (now using Bootstrap for compatibility)
Includes reusable template tags like:
{% Button label="Submit" type="submit" %} {% Alert type="success" message="Form submitted successfully!" %} {% ContactForm %}
Focused on developer speed and clean UI

# 💡 Why Use Beautypy?

Saves time – No need to hand-code repetitive HTML + CSS
Pre-styled components – Works instantly with Bootstrap’s responsive grid
Easier maintainability – Centralized templates make UI changes site-wide in seconds
Consistency – Every button, form, and alert matches your site’s style
Customizable – Override templates or styles to fit your brand easily
Zero JavaScript dependency for basics – Just Django templates and Bootstrap

# 📦 Installation

Install Beautypy from PyPI:

pip install beautypy


📄 Docs: [
https://pypi.org/project/beautypy/](https://pypi.org/project/beautypy/)

# 🌐 Live Demo

Want to see Beautypy in action?
🔗 Official Demo Website: [
beautypy.pythonanywhere.com](https://beautypy.pythonanywhere.com)

# 🤝 How You Can Help

Test it in

/r/django
https://redd.it/1mo3i47
Type hints for variable first mentions - yes/no/sometimes(when?)?

I'm new to python from a java background. Python is so easy when you are writing new code or are reading code you wrote in the last hour (e.g. during an interview).

Reading some code I wrote last week in a Colab notebook for a class notebook using some API that I'm learning (e.g. Word2Vec), it's not so easy. I don't know what operations I can perform on this variable I added but didn't name with enough information to trivially determine its type.

Java is so explicit with type declarations it makes you cry, but I'm seeing the dark side of dynamic typing.

One possible solution is to use type hints anywhere the type info is welcome (subjective I know). But is there any kind of best practice which maybe says that you should not do it to the point it just crowds your code and makes you hate yourself the way Java does?

(EDIT: yes I know modern java has var but the reality is it's in very few codebases because of version fatigue. Same reason we don't see much C23 or C++23)

/r/Python
https://redd.it/1mntk24
structlog-journald, attach extra info to jogs and filter logs by it

- What my project does: In a multi-tenant system, logs from various tenants are often mixed, making difficult to debug. This library bridges structlog and journald, to allow to attach extra info (like tenant ID) when writing logs. When we view logs via journalctl, we can filter by that tenant ID.
- Target audience: Python developers who often debug a system of many concurent operations running.
- Source code: https://github.com/hongquan/structlog-journald
- Manual: https://structlog-journald.readthedocs.io/en/latest/advanced.html

/r/Python
https://redd.it/1mo8ypj
Guidance on improving the reconstruction results of my VAE Project

Hi all! I was trying to build a VAE with an LSTM to reconstruct particle trajectories by basing off my model on the paper "Modeling Trajectories with Neural Ordinary Differential Equations". However, despite my loss plots showing a downward trend, my predictions are linear.

I have applied KL annealing and learning rate scheduler - and yet, the model doesn't seem to be learning the non-linear dynamics. The input features are x and z positions, velocity, acceleration, and displacement. I used a combination of ELBO and DCT for my reconstruction loss. The results were quite bad with MinMax scaling, so I switched to z-score normalization, which helped improve the scales. I used the Euler method with torchdiffeq.odeint.

Would it be possible for any of you to guide me on what I might be doing wrong? I’m happy to share my implementation if it helps. I appreciate and am grateful for any suggestions (and sorry about missing out on the labeling the axes - they are x and z)

https://preview.redd.it/veskdk7p7nif1.png?width=529&format=png&auto=webp&s=0938c4dd588961f94eba40a0e20d81008bc131f0

https://preview.redd.it/ddubae7p7nif1.png?width=529&format=png&auto=webp&s=15a24e197e6fd331d92175d1327fb2b482aaa2cc

/r/MachineLearning
https://redd.it/1moj422