pythondaily | Образование

Telegram-канал pythondaily - Python Daily

1102

Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels

Подписаться на канал

Python Daily

We built an AI-agent with a state machine instead of a giant prompt

Hola Pythonistas,

Last year we tried to bring an LLM “agent” into a real enterprise workflow. It looked easy in the demo videos. In production it was… chaos.

* Tiny wording tweaks = totally different behaviour
* Impossible to unit-test; every run was a new adventure
* One mega-prompt meant one engineer could break the whole thing • SOC-2 reviewers hated the “no traceability” story

We wanted the predictability of a backend service and the flexibility of an LLM. So we built NOMOS: a step-based state-machine engine that wraps any LLM (OpenAI, Claude, local). Each state is explicit, testable, and independently ownable—think Git-friendly diff-able YAML.

Open-source core (MIT), today.

* GitHub: [https://github.com/dowhiledev/nomos](https://github.com/dowhiledev/nomos)
* Documentation: [https://nomos.dowhile.dev](https://nomos.dowhile.dev)

Looking ahead: we’re also prototyping Kosmos, a “Vercel for AI agents” that can deploy NOMOS or other frameworks behind a single control plane. If that sounds useful, Join the waitlist for free paid membership for limited amount of people.

[https://nomos.dowhile.dev/kosmos](https://nomos.dowhile.dev/kosmos)

Give us some support by contributing or simply by starring our project and Get featured in the website instantly.

Would love war stories from anyone who’s wrestled with flaky prompt agents. What hurt the most?

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

Читать полностью…

Python Daily

Built a Python-based floating HUD for developers.

Hey everyone,

I recently finished a project called DevHUD, a floating heads-up display for desktop built with Python (using PyQt5). It’s designed to stay on top of your workspace and provide quick access to useful tools without disrupting your workflow.

# What My Project Does

DevHUD displays system stats, clipboard history, GitHub activity, a focus timer, theme settings, and music player all in a compact, always-on-top interface. It’s meant to help developers reduce context switching and stay focused without leaving their active window.

# Target Audience

DevHUD is intended for developers and power users who want lightweight productivity tools that stay out of the way. While it’s still early in development, it’s stable enough for personal use and I’m actively seeking feedback to improve it.

# Comparison

Unlike full-fledged productivity dashboards or browser-based extensions, DevHUD is a desktop-native, Python-based app built with PyQt5. It focuses only on core features without unnecessary bloat, and runs quietly in the corner, kind of like a HUD in a game, but for your dev setup. Its simplicity and modular design are what set it apart.

Links:
GitHub: https://github.com/ItsAkshatSh/DevHUD
Website: https://devhud.vercel.app
YouTube Series: CodingtillIgotoanisland">CodingtillIgotoanisland" rel="nofollow">https://www.youtube.com/@CodingtillIgotoanisland

Would love feedback on the tool, UI, or code structure, happy to discuss or answer questions.

Thanks!

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

Читать полностью…

Python Daily

We built an AI-agent with a state machine instead of a giant prompt

/r/IPython
https://redd.it/1lswmbe

Читать полностью…

Python Daily

Help with my understanding of Flask teardown logic

Hello, I need some clarification of my understanding of this issue. Do I really the following teardown logic at all or not? Long story short, Ive been struggling with password resets. And somewhere between the mess of Git commits, I keep adding stuff, just in case. Its usually some other issue I solved, and I solve eventually. The question is I want to really know if the teardown logic is necessay.


I read somewhere, that Flask does this automaatically anyway (it has something to do with g, request context), and you dont need i even with app.app_context().push(). But I keep adding this, only to solve it anyway using something else. The reason why I keep adding this back, is becoz CSRF related errors keep popping between fixes. I want to remove it once and for all

@app.teardownrequest
def teardown
request(responseorexc):
db.session.remove()

@app.teardownappcontext
def teardown
appcontext(responseorexc):
db.session.remove()

/r/flask
https://redd.it/1lsv1dp

Читать полностью…

Python Daily

How many models should an app have?

Hello, I'm developing a simple onlins bookstore project. In my shop app, I have about 20 models. Is this ok, or bad practice?

/r/djangolearning
https://redd.it/1lscnh2

Читать полностью…

Python Daily

Web push notifications from Django. Here's the tutorial.
https://youtu.be/grSfBbYuJ0I?feature=shared

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

Читать полностью…

Python Daily

For running Python scripts on schedule or as APIs, what do you use?

Just curious, if you’ve written a Python script (say for scraping, data cleaning, sending reports, automating alerts, etc.), how do you usually go about:

1. Running it on a schedule (daily, hourly, etc)?
2. Exposing it as an API (to trigger remotely or integrate with another tool/app)?

Do you:

Use GitHub Actions or cron?
Set up Flask/FastAPI + deploy somewhere like Render?
Use Replit, AWS Lambda, or something else?

Also: would you ever consider paying (like $5–10/month) for a tool that lets you just upload your script and get:

A private API endpoint
Auth + input support
Optional scheduling (like “run every morning at 7 AM”) all without needing to write YAML or do DevOps stuff?

I’m trying to understand what people prefer. Would love your thoughts! 🙏

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

Читать полностью…

Python Daily

An analytic theory of creativity in convolutional diffusion models.
https://arxiv.org/abs/2412.20292

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

Читать полностью…

Python Daily

My first flask app, feedback?
https://cyberinteractive.net/

/r/flask
https://redd.it/1ls244l

Читать полностью…

Python Daily

How to record system audio from django website ?

HI , i am working on a "Real time AI lecture/class note-taker"
for that i was trying to record system audio ,,..... but that seems to not work.... i am using django framework of python... can anyone help me ?

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

Читать полностью…

Python Daily

WebPath: Yes yet another another url library but hear me out

Yeaps another url library. But hear me out. Read on first. 

# What my project does

Extending the pathlib concept to HTTP:

# before:
resp = requests.get("https://api.github.com/users/yamadashy")
data = resp.json()
name = data"name"  # pray it exists
reposurl = data["reposurl"] 
reposresp = requests.get(reposurl)
repos = reposresp.json()
first
repo = repos0"name"  # more praying

# after:
user = WebPath("https://api.github.com/users/yamadashy").get()
name = user.find("name", default="Unknown")
firstrepo = (user / "reposurl").get().find("0.name", default="No repos")
Other stuff:

Request timing: GET /users → 200 (247ms)
Rate limiting: .with_rate_limit(2.0)
Pagination with cycle detection
Debugging the api itself with .inspect()
Caching that strips auth headers automatically

What makes it different vs existing librariees:

requests + jmespath/jsonpath: Need 2+ libraries
httpx: Similar base nav but no json navigation or debugging integration
furl + requests: Not sure if we're in the same boat but this is more for url building .. 

# Target audience

For ppl who:

Build scripts that consume apis (stock prices, crypto prices, GitHub stats, etc etc.)
Get frustrated debugging

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

Читать полностью…

Python Daily

A google play clone database schema

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

Читать полностью…

Python Daily

Skylos: The python dead code finder (Updated)

# Skylos: The Python Dead Code Finder (Updated)

Been working on Skylos, a Python static analysis tool that helps you find and remove dead code from your projs (again.....). We are trying to build something that actually catches these issues faster and more accurately (although this is debatable because different tools catch things differently). The project was initially written in Rust, and it flopped, there were too many false positives(coding skills issue). Now the codebase is in Python. The benchmarks against other tools can be found in benchmark.md

# What the project does:

Detects unreachable functions and methods
Finds unused imports
Identifies unused classes
Spots unused variables
Detects unused parameters 
Pragma ignore (Newly added)

# So what has changed?

1. We have introduced pragma to ignore false positives
2. Cleaned up more false positives
3. Introduced or at least attempting to clean up dynamic frameworks like Flask or FastApi

# Target Audience:

Python developers working on medium to large codebases
Teams looking to reduce technical debt
Open source maintainers who want to keep their projects clean
Anyone tired of manually searching for dead code

# Key Features:

bash
# Basic usage
skylos /path/to/your/project



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

Читать полностью…

Python Daily

pyleak: pytest-plugin to detect asyncio event loop blocking and task leaks

**What** `pyleak` **does**

`pyleak` is a pytest plugin that automatically detects event loop blocking in your asyncio test suite. It catches synchronous calls that freeze the event loop (like `time.sleep()`, `requests.get()`, or CPU-intensive operations) and provides detailed stack traces showing exactly where the blocking occurs. Zero configuration required - just install and run your tests.

**The problem it solves**

Event loop blocking is the silent killer of async performance. A single `time.sleep(0.1)` in an async function can tank your entire application's throughput, but these issues hide during development and only surface under production load. Traditional testing can't detect these problems because the tests still pass - they just run slower than they should.

**Target audience**

This is a pytest-plugin for Python developers building asyncio applications. It's particularly valuable for teams shipping async web services, AI agent frameworks, real-time applications, and concurrent data processors where blocking calls can destroy performance under load but are impossible to catch reliably during development.

pip install pytest-pyleak

import pytest

@pytest.mark.no_leak


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

Читать полностью…

Python Daily

What is Jython and is it still relevant?

Never seen it before until I opened up this book that was published in 2010.
Is it still relevant and what has been created with it?

The book is called
Introduction to computing and programming in Python- a multimedia approach. 2nd edition
Mark Guzdial , Barbara Ericson

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

Читать полностью…

Python Daily

My first web app w/Flask

Repo:
https://github.com/SalvoLombardo/mascagnidemo

I just finished my first full web app built with Flask after about five months of learning on my own. It’s a simple app for a small music association that runs yearly subscription campaigns.
I’ve studied a lot in the last 5 months but I know this is just the start. There are some features that are missing but I spent around 2-3 weeks and I’m exhausted and I need to go further in my path.

——
https://mascagni-demo-e0f00e6ab048.herokuapp.com
user:admin
demo
pass:demo
If you want to try some functionality, right now doesn’t have too much data in the db, just the necessary
———-


Some quick highlights:
• User auth (register/login/logout)
• Admin panel with full CRUD
• Modular design with Flask Blueprints
• Custom forms with Flask-WTF
• Basic security: CSRF protection and bcrypt password hashing

One interesting thing is the way the app handles subscribers — no unique phone/email constraints — because the association wanted to keep it close to their paper-based workflow in a small town.
Admins create campaigns and assign ticket batches, and operators sell tickets only after that. Operators can edit only their own data, while admins have full control.

I’d love any feedback or suggestions — I’m still learning and would appreciate input from anyone experienced.
Thanks!


/r/flask
https://redd.it/1lsfwtb

Читать полностью…

Python Daily

ANN django-smart-ratelimit: A simple, flexible rate-limiting library for Django

Hey everyone! I just released django-smart-ratelimit v0.3.0—a lightweight, configurable rate-limiting solution for Django projects. I’d love to get early feedback from the community.

# 🔍 What it does

Per-view, per-IP and global limits out of the box
Supports function-based and class-based views
Pluggable storage backends (cache, Redis, etc.)
Simple decorator and mixin API
Multiple Algorithms (sliding\_window, fixed\_window, and more soon)

# 🚀 Quickstart

pip install django-smart-ratelimit

#
views.py
from django_smart_ratelimit.decorator import ratelimit

@rate_limit(key='ip', rate='10/m', block=True)
def my_view(request):
return HttpResponse("Hello, rate-limited world!")

PYPI Link [
https://pypi.org/project/django-smart-ratelimit/](https://pypi.org/project/django-smart-ratelimit/)

Full docs and examples 👉 [
https://github.com/YasserShkeir/django-smart-ratelimit](https://github.com/YasserShkeir/django-smart-ratelimit)

# 🛣️ Roadmap

Check out the full feature roadmap here:
[
https://github.com/YasserShkeir/django-smart-ratelimit/blob/main/FEATURES\_ROADMAP.md](https://github.com/YasserShkeir/django-smart-ratelimit/blob/main/FEATURES_ROADMAP.md)

# ❓ Feedback & Contributions

Tried it in your project? Let me know how it went!
Found a bug or want an enhancement? Open an issue or PR on GitHub.
General questions? Ask below and I’ll be happy to help.

Thanks for your time—looking forward to your thoughts!
— Yasser (creator)

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

Читать полностью…

Python Daily

Solving Wordle using uv's dependency resolver

What this project does

Just a small weekend project I hacked together. This is a Wordle solver that generates a few thousand Python packages that encode a Wordle as a constraint satisfaction problem and then uses uv's dependency resolver to generate a lockfile, thus coming up with a potential solution.

The user tries it, gets a response from the Wordle website, the solver incorporates it into the package constraints and returns another potential solution and so on until the Wordle is solved or it discovers it doesn't know the word.

Blog post on how it works here

Target audience

This isn't really for production Wordle-solving use, although it did manage to solve today's Wordle, so perhaps it can become your daily driver.

Comparison

There are lots of other Wordle solvers, but to my knowledge, this is the first Wordle solver on the market that uses a package manager's dependency resolver.

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

Читать полностью…

Python Daily

We built an AI-agent with a state machine instead of a giant prompt

/r/IPython
https://redd.it/1lsw3k3

Читать полностью…

Python Daily

Python as essentially a cross-platform shell script?

I’m making an SSH server using OpenSSH, and a custom client interface. I’m using Python as the means of bringing it all together: handling generation of configs, authentication keys, and building the client interface. Basically a setup script to cover certain limitations and prevent a bunch of extra manual setup.

Those (to me) seem like tasks that shell scripts are commonly used for, but since those scripts can vary from system to system, I chose to use Python as a cross-platform solution. That sorta got me thinking, have any of you ever used Python this way? If so, what did you use it for?

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

Читать полностью…

Python Daily

What's your take on Celery vs django-qstash for background tasks

Hello guys, I'm currently working on a personal project and would like to know your thoughts and advice on handling background tasks in django.

My use cases includes:

1. Sending transactional emails in the background

2. Some few periodic tasks

Celery is super powerful and flexible, but it requires running a persistent worker which can get tricky or expensive on some platforms like Render. On the other hand, QStash lets you queue tasks and have them POST to your app without a worker — great for simpler or cost-sensitive deployments.

Have you tried both? What are the treadoffs of adopting django-Qstash.

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

Читать полностью…

Python Daily

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/1lsnrbz

Читать полностью…

Python Daily

Robyn now supports Server Sent Events

For the unaware, Robyn is a super fast async Python web framework.

Server Sent Events were one of the most requested features and Robyn finally supports it :D

Let me know what you think and if you'd like to request any more features.

Release Notes - https://github.com/sparckles/Robyn/releases/tag/v0.71.0

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

Читать полностью…

Python Daily

Is this really the right way to pass parameters from React?

Making a simple application which is meant to send a list to django as a parameter for a get. In short, I'm sending a list of names and want to retrieve any entry that uses one of these names.

The only way I was able to figure out how to do this was to first convert the list to a string and then convert that string back into a JSON in the view. So it looks like this

react

api/myget/?names=${JSON.stringify(listofnames)}


Django

list
ofnames = json.loads(request.queryparams'list_of_names'

this feels very redundant to me. Is this the way people typically would pass a list?

/r/djangolearning
https://redd.it/1lpw4xs

Читать полностью…

Python Daily

I benchmarked 4 Python text extraction libraries so you don't have to (2025 results)

TL;DR: Comprehensive benchmarks of Kreuzberg, Docling, MarkItDown, and Unstructured across 94 real-world documents. Results might surprise you.

## 📊 Live Results: https://goldziher.github.io/python-text-extraction-libs-benchmarks/

---

## Context

As the author of Kreuzberg, I wanted to create an honest, comprehensive benchmark of Python text extraction libraries. No cherry-picking, no marketing fluff - just real performance data across 94 documents (~210MB) ranging from tiny text files to 59MB academic papers.

Full disclosure: I built Kreuzberg, but these benchmarks are automated, reproducible, and the methodology is completely open-source.

---

## 🔬 What I Tested

### Libraries Benchmarked:
- Kreuzberg (71MB, 20 deps) - My library
- Docling (1,032MB, 88 deps) - IBM's ML-powered solution
- MarkItDown (251MB, 25 deps) - Microsoft's Markdown converter
- Unstructured (146MB, 54 deps) - Enterprise document processing

### Test Coverage:
- 94 real documents: PDFs, Word docs, HTML, images, spreadsheets
- 5 size categories: Tiny (<100KB) to Huge (>50MB)
- 6 languages: English, Hebrew, German, Chinese, Japanese, Korean
- CPU-only processing: No GPU acceleration for fair comparison
- Multiple metrics: Speed, memory usage, success rates, installation sizes

---

## 🏆 Results Summary

### Speed Champions 🚀
1. Kreuzberg: 35+ files/second, handles everything
2. Unstructured: Moderate speed, excellent reliability
3. MarkItDown: Good on simple docs, struggles with complex files
4. Docling: Often 60+ minutes per file (!!)

### Installation Footprint 📦
- Kreuzberg: 71MB, 20 dependencies ⚡
- Unstructured:

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

Читать полностью…

Python Daily

Generating Synthetic Data for Your ML Models

I prepared a simple tutorial to demonstrate how to use synthetic data with machine learning models in Python.

https://ryuru.com/generating-synthetic-data-for-your-ml-models/

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

Читать полностью…

Python Daily

D Did anyone receive this from NIPS?

Your co-author, Reviewer has not submitted their reviews for one or more papers assigned to them for review (or they submitted insufficient reviews). Please kindly note the Review deadline was on the 2nd July 11.59pm AOE.

===
My co-author has graduated and no longer worked in academic anymore. How can I handle that? It is not fair to reject my paper!

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

Читать полностью…

Python Daily

Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

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

Читать полностью…

Python Daily

Desto: A Web-Based tmux Session Manager for Bash/Python Scripts

Sharing a personal project called desto, a web-based session manager built with NiceGUI. It's designed to help you run and monitor bash and Python scripts, especially useful for long-running processes or automation tasks.

What My Project Does: desto provides a centralized web dashboard to manage your scripts. Key features include:

Real-time system statistics directly on the dashboard.
Ability to run both bash and Python scripts, with each script launched within its own tmux session.
Live viewing and monitoring of script logs.
Functionality for scheduling scripts and chaining them together.
Sessions persist even after script completion, thanks to `tmux` integration, ensuring your processes remain active even if your connection drops.

Target Audience: This project is currently a personal development and learning project, but it's built with practical use cases in mind. It's suitable for:

Developers and system administrators looking for a simple, self-hosted tool to manage automation scripts.
Anyone who needs to run long-running Python or bash processes and wants an easy way to monitor their output, system stats, and ensure persistence.
Users who prefer a web interface for managing their background tasks over purely CLI-based solutions.

Comparison: While there are many tools for process management and automation, desto aims for a unique blend

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

Читать полностью…

Python Daily

Recent Noteworthy Package Releases

Over the last 7 days, These are the significant upgrades/releases in the Python package ecosystem I have noticed.

**python-calamine 0.4.0** \- Python binding for Rust's library for reading excel and odf file - calamine

**SeleniumBase 4.40.0** \- A complete web automation framework for end-to-end testing

**pylance 0.31.0** \- Python wrapper for Lance columnar format

**PyAV 15.0.0** \- Pythonic bindings for FFmpeg's libraries

**PEFT 0.16.0** \- Parameter-Efficient Fine-Tuning (PEFT)

**CrewAI 0.140.0** \- Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks

**statsig-python-core 0.6.0** \- Statsig Python bindings for the Statsig Core SDK

**haystack-experimental 0.11.0** \- Experimental components and features for the Haystack LLM framework

**wandb 0.21.0** \- A CLI and library for interacting with the Weights & Biases API.

**fastmcp 2.10.0** \- The fast, Pythonic way to build MCP servers.

**feast 0.50.0** \- The Open Source Feature Store for AI/ML

**sentence-transformers 5.0.0** \- Embeddings, Retrieval, and Reranking

**PaddlePaddle 3.1.0** \- Parallel Distributed Deep Learning

**pillow-heif 1.0.0** \- Python interface for libheif library

**bleak 1.0.0** \- Bluetooth Low Energy platform Agnostic Klient

**browser-use 0.4** \- Make websites accessible for AI agents

**PostHog 6.0.0** \- Integrate PostHog into any python application

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

Читать полностью…
Подписаться на канал