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
I’m building a Python-native frontend framework that runs in the browser (Evolve)

I’m currently building a personal project called Evolve \- a Python-native frontend framework using WebAssembly and a minimal JavaScript kernel to manage DOM operations.

The idea: write UI logic in Python, run it in the browser, with a reactive system (no virtual DOM).

Still early stage, - I’ll be posting progress, architecture, and demos soon.

Would love to know: would you try a Python-first frontend framework?

/r/Python
https://redd.it/1p3p00u
If one python selling point is data-science and friends, why it discourages map and filter?

… and lambda functions have such a weird syntax and reduce is hidden in functools, etc.? Their usage is quite natural for people working with mathematics.

/r/Python
https://redd.it/1p3mjlc
How do you implement customizable document templates (like QuickBooks)


I’m building an invoicing module in Django, and right now all my document templates (Quotation, POS Receipt, etc.) are hard-coded as Django HTML templates.

I want to redesign this so that:

- Multiple templates exist per document type

(e.g., Standard Invoice, Minimalist, POS Receipt, Japanese Style, etc.)

- Users can choose which template their organisation uses

(at setup time or inside settings)

- Users can customize parts of the template

(override header, colors, messages, table layout, footer text… basically inject custom HTML blocks)

- Ability to preview templates

(ideally show a small thumbnail preview)

/r/django
https://redd.it/1p43aga
Onlymaps, a Python micro-ORM

Hello everyone! For the past two months I've been working on a Python micro-ORM, which I just published and I wanted to share with you: https://github.com/manoss96/onlymaps

Any questions/suggestions are welcome!

## What My Projects Does

A micro-ORM is a term used for libraries that do not provide the full set of features a typical ORM does, such as an OOP-based API, lazy loading, database migrations, etc... Instead, it lets you interact with a database via raw SQL, while it handles mapping the SQL query results to in-memory objects.

Onlymaps does just that by using Pydantic underneath. On top of that, it offers:

- A minimal API for both sync and async query execution.
- Support for all major relational databases.
- Thread-safe connections and connection pools.

## Target Audience

Anyone can use this library, be it for a simple Python script that only needs to fetch some rows from a database, or an ASGI webserver that needs an async connection pool to make multiple requests concurrently.

## Comparison

This project provides a simpler alternative to typical full-feature ORMs which seem to dominate the Python ORM landscape, such as SQLAlchemy and Django ORM.

/r/Python
https://redd.it/1p3us1n
Python - Numerical Evidence - max PSLQ to 4000 Digits for Clay Millennium Problem (Hodge Conjecture)

* **What My Project Does**

The Zero-ology team recently tackled a high-precision computational challenge at the intersection of HPC, algorithmic engineering, and complex algebraic geometry. We developed the **Grand Constant Aggregator (GCA)** framework -- a fully reproducible computational tool designed to generate **numerical evidence** for the **Hodge Conjecture** on **K3 surfaces** ran in a Python script.

The core challenge is establishing formal certificates of numerical linear independence at an unprecedented scale. GCA systematically compares known transcendental periods against a canonically generated set of ρ real numbers, called the **Grand Constants**, for K3 surfaces of Picard rank ρ ∈ {1,10,16,18,20}.

The GCA Framework's core thesis is a computationally driven attempt to provide overwhelming numerical support for the Hodge Conjecture, specifically for five chosen families of K3 surfaces (Picard ranks 1, 10, 16, 18, 20).

The primary mechanism is a test for linear independence using the PSLQ algorithm.

The Target Relation: The standard Hodge Conjecture requires showing that the transcendental period $(\\omega)$ of a cycle is linearly dependent over $\\mathbb{Q}$ (rational numbers) on the periods of the *actual* algebraic cycles ($\\alpha\_j$).

The GCA Substitution: The framework substitutes the unknown periods of the algebraic cycles ($\\alpha\_j$) with a set of synthetically generated, highly-reproducible, transcendental numbers, called the **Grand Constants** ($\\mathcal{C}\_j$), produced by the **Grand Constant Aggregator (GCA)** formula.

The Test: The framework tests for an integer linear dependence

/r/Python
https://redd.it/1p44cr8
Built free interview prep repo for AI agents, tool-calling and best production-grade practices

I spent the last few weeks building the tool-calling guide I couldn’t find anywhere: a full, working, production-oriented resource for tool-calling.

What’s inside:

66 agent interview questions with detailed answers
Security + production patterns (validation, sandboxing, retries, circuit breaker, cost tracking)
Complete MCP spec breakdown (practical, not theoretical)
Fully working MCP server (6 tools, resources, JSON-RPC over STDIO, clean architecture)
MCP vs UTCP with real examples (file server + weather API)
9 runnable Python examples (ReAct, planner-executor, multi-tool, streaming, error handling, metrics)

Everything compiles, everything runs, and it's all MIT licensed.

GitHub: https://github.com/edujuan/tool-calling-interview-prep

Hope you some of you find this as helpful as I have!

/r/Python
https://redd.it/1p469il
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/1p4851a
Why do devs prefer / use PyInstaller over Nuitka?

I've always wondered why people use PyInstaller over Nuitka?

I mean besides the fact that some old integrations rely on it, or that most tutorials mention PyInstaller; why is it still used?

For MOST use cases in Python; Nuitka would be better since it actually compiles code to raw machine (C) code instead of it being a glorified [.zip\] file and a Python interpreter in it.


Yet almost everyone uses PyInstaller, why?


Is it simplicity, laziness, or people who refuse to switch just because "it works"? Or does PyInstaller (same applies to cx_Freeze and py2exe) have an advantage compared to Nuitka?



At the end of the day you can use whatever you want; who am I to care for that? But I am curious why PyInstaller is still more used when there's (imo) a clearly better option on the table.

/r/Python
https://redd.it/1p46onk
[P] Interactive Advanced Llama Logit Lens

/r/MachineLearning
https://redd.it/1p4akjr
What could I have done better here?

Hi, I'm pretty new to Python, and actual scripting in general, and I just wanted to ask if I could have done anything better here. Any critiques?

import time
import colorama
from colorama import Fore, Style

color = 'WHITE'
colorvar2 = 'WHITE'

#Reset colors
print(Style.RESETALL)

#Get current directory (for debugging)
#print(os.getcwd())

#Startup message
print("Welcome to the ASCII art reader. Please set the path to your ASCII art below.")

#Bold text
print(Style.BRIGHT)

#User-defined file path
path = input(
Fore.BLUE + 'Please input the file path to your ASCII art: ')
color = input('Please input your desired color (default: white): ' + Style.RESET
ALL)

#If no ASCII art path specified
if not path:
print(Fore.RED +

/r/Python
https://redd.it/1p4ffmh
Air gapped app

How does one prepare an air gapped app version of the Django project ?

are there tools to wrap frontend and backend in Docker and orchestrate this on a cloud ?

/r/django
https://redd.it/1p4fs71
Python Mutable Defaults or the Second Thing I Hate Most About Python

TLDR: Don’t use default values for your annotated class attributes unless you explicitly state they are a ClassVar so you know what you’re doing. Unless your working with Pydantic models. It creates deep copies of the models.
I also created a demo flake8 linter for it: https://github.com/akhal3d96/flake8-explicitclassvar/ Please check it out and let me know what you think.

I run into a very annoying bug and it turns out it was Python quirky way of defining instance and class variables in the class body. I documented these edge cases here: https://blog.ahmedayoub.com/posts/python-mutable-defaults/

But basically this sums it up:

class Members:
number: int = 0

class FooBar:
members: Members = Members()


A = FooBar()
B = FooBar()

A.members.number = 1
B.members.number = 2

# What you expect:
print(A.members.number) # 1
print(B.members.number) # 2




/r/Python
https://redd.it/1p469fk
The Labyrinth of Tech Careers: The Significance of Your Developer Portal
https://mappen.ai/blog/the-labyrinth-of-tech-careers-the-significance-of-your-developer-portal

/r/django
https://redd.it/1p4jg3x
I built a backend-only data analysis tool using Django.

I have focused heavily on security, ensuring the tool is safe against file upload vulnerabilities and common threats like XSS.

Feel free to review or audit the code. If you find any security flaws or bugs, please let me know in the comments. The project is open source, so you are welcome to fork and modify it. I would appreciate any feedback or suggestions to help me improve my future projects.

Repository Link: https://github.com/saa-999/djangolytics



/r/django
https://redd.it/1p4mn24
Announcing Spikard: TypeScript + Ruby + Rust + WASM)

Hi Peeps,

I'm announcing [Spikard](https://github.com/Goldziher/spikard) v0.1.0 - a high-performance API toolkit built in Rust with first-class Python bindings. Write REST APIs, JSON-RPC services, or Protobuf-based applications in Python with the performance of Rust, without leaving the Python ecosystem.

## Why Another Framework?

**TL;DR: One toolkit, multiple languages, consistent behavior, Rust performance.**

I built Spikard because I was tired of:
- Rewriting the same API logic in different frameworks across microservices
- Different validation behavior between Python, TypeScript, and Ruby services
- Compromising on performance when using Python for APIs
- Learning a new framework's quirks for each language

Spikard provides **one consistent API** across languages. Same middleware stack, same validation engine, same correctness guarantees. Write Python for your ML API, TypeScript for your frontend BFF, Ruby for legacy integration, or Rust when you need maximum performance—all using the same patterns.

## Quick Example

```python
from spikard import Spikard, Request, Response
from msgspec import Struct

app = Spikard()

class User(Struct):
name: str
email: str
age: int

@app.post("/users")
async def create_user(req: Request[User]) -> Response[User]:
user = req.body # Already validated and parsed
# Save to database...
return Response(user, status=201)

@app.get("/users/{user_id}")
async def get_user(user_id: int) -> Response[User]:
# Path params

/r/Python
https://redd.it/1p4m5be
Interactive visualisations of the floodfill algorithm in Python and PyScript

I've always liked graph-related algorithms and I wanted to try my hand at writing an article with interactive demos, so I decided to write an article that teaches how to implement and use the floodfill algorithm.

This article teaches you how to implement and use the floodfill algorithm and includes interactive demos to:
- use floodfill to colour regions in an image
- step through the general floodfill algorithm step by step, with annotations of what the algorithm is doing
- applying floodfill in a grid with obstacles to see how the starting point affects the process
- use floodfill to count the number of disconnected regions in a grid
- use a modified version of floodfill to simulate the fluid spreading over a surface with obstacles

The interactive demos were created using (mostly) PyScript, since I also wanted to give it a try.

I know the internet can be relentless but I'm really looking forward to everyone's comments and suggestions, since I love interactive articles and I hope to be able to create more of these in the future.

Happy reading and let me know what you think!

The article: https://mathspp.com/blog/floodfill-algorithm-in-python

/r/Python
https://redd.it/1p4nn86
A Django + WebRTC chat app... (repo + demo inside)

Hey everyone,

This is nothing special. I know there are plenty of real-time chat apps out there. I just wanted to try building one myself and get better with Django Channels and WebRTC audio.

I ended up putting together a small chat app using Django, Channels, Redis, React, and a basic WebRTC audio huddle using STUN/TURN from Twilio’s free tier. Getting the audio signalling to behave properly was honestly the most interesting part for me.

The whole thing is open source and super easy to run locally. You can also try the demo if you want.

GitHub: [https://github.com/naveedkhan1998/realtime-chat-app](https://github.com/naveedkhan1998/realtime-chat-app)
Demo: [https://chat.mnaveedk.com/](https://chat.mnaveedk.com/)

The code is basically a mix of my old snippets, manual architecture I’ve built up over time, and some vibe coding, where I used tools to speed things up. I mainly use VSCode Copilot (multiple models in there, including the new Gemini 3, which is decent for UI stuff) and Codex CLI. These are the only two things I’m actually subscribed to, so that’s pretty much my entire toolset. I tried my best to review everything important manually, so please let me know if you find any glaringly stupid stuff in there.

# What I’d like feedback on

* Does my Channels and consumer structure make

/r/django
https://redd.it/1p4v9w3
D ML conferences need to learn from AISTATS (Rant/Discussion)

Quick rant. As many have noticed and experienced, the quality of reviews at large conferences such as ICLR, ICML. AAAI, NIPS, has generally been very inconsistent with several people getting low quality or even AI written reviews. While this is not too shocking given the number of submissions and lack of reviewers changes need to be made.

Based on my experience and a general consensus by other researchers, AISTATS is the ML conference with the highest quality of reviews. Their approach to reviewing makes a lot more sense and is more similar to other scientific fields and i believe the other ML conferences should learn from them.

For example:
1) they dont allow for any LLMs when writing reviews and they flag any reviews that have even a small chance of being AI written (i think everyone should do this)
2) they follow a structured reviewing format making it much easier to compare the different reviewers points.
3) Reviews are typically shorter and focus on key concerns making it easier to pin point what you should adress.

While AISTATS also isn't perfect in my experience it feels less "random" than other venues and usually I'm sure the reviewers have actually read my work. Their misunderstandingd

/r/MachineLearning
https://redd.it/1p4tme7
Best platform for deploying Django apps in 2025

Haven't deployed a Django app in a long time. I think my last one was deployed using Heroku back when it was very easy to use. I think that is not the case anymore.

What are the best options for 2025/2026?

/r/django
https://redd.it/1p5357w
D How do you create clean graphics that you'd find in conference papers, journals and textbooks (like model architecture, flowcharts, plots, tables etc.)?

just curious. I've been using draw.io for model architecture, seaborn for plots and basic latex for tables but they feel rough around the edges when I see papers at conferences and journals like ICLR, CVPR, IJCV, TPAMI etc, and computer vision textbooks.

FYI I'm starting my graduate studies, so would like to know how I can up my graphics and visuals game!

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