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
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/1m4avkf
I'm writing a short, practical guide on deploying Django & Celery with Docker. What's the #1 problem you'd want it to solve?

I have a lot of production experience with this stack and I'm tired of seeing outdated tutorials. I'm putting together a tiny guide focused on a modern, deploy-able setup. What are the biggest pain points you've faced that I should be sure to cover?

/r/django
https://redd.it/1m3zwer
What are some libraries i should learn to use?

I am new to python and rn im learning syntax i will mostly be making pygame games or automation tools that for example "click there" wait 3 seconds "click there" etc what librariea do i need to learn?

/r/Python
https://redd.it/1m46zf1
Detect LLM hallucinations using state-of-the-art uncertainty quantification techniques with UQLM

# What My Project Does
UQLM (uncertainty quantification for language models) is an open source Python package for generation time, zero-resource hallucination detection. It leverages state-of-the-art uncertainty quantification (UQ) techniques from the academic literature to compute response-level confidence scores based on response consistency (in multiple responses to the same prompt), token probabilities, LLM-as-a-Judge, or ensembles of these.

# Target Audience
Developers of LLM system/applications looking for generation-time hallucination detection without requiring access to ground truth texts.

# Comparison
Numerous UQ techniques have been proposed in the literature, but their adoption in user-friendly, comprehensive toolkits remains limited. UQLM aims to bridge this gap and democratize state-of-the-art UQ techniques. By integrating generation and UQ-scoring processes with a user-friendly API, UQLM makes these methods accessible to non-specialized practitioners with minimal engineering effort.

Check it out, share feedback, and contribute if you are interested!

Link: https://github.com/cvs-health/uqlm



/r/Python
https://redd.it/1m4bawg
MakeCore - Flask Website

MakeCore is an online community and platform for sharing, showcasing, Microsoft MakeCode Arcade or Scratch games (not affiliated with either of them). Users can upload their games, view others' projects, leave comments, join studios (as manager/contributor), and participate in MakeJams, periodic game-making competitions that challenge creativity and skill with custom themes.

Designed for anyone who creates games with a share link (could be scratch or MakeCode games).

MakeJam differs from scratch because on scratch you can only post scratch games but on MakeCore you can post Microsoft makecode arcade games and scratch games, any games in general with a share link. And there are competitions that promote activity and game creativity.

/r/flask
https://redd.it/1m4fbpa
Function Coaster: A pygame based graphing game

Hey everyone!
I made a small game in Python using `pygame` where you can enter math functions like `x**2` or `sin(x)`, and a ball will physically roll along the graph like a rollercoaster. It doesn't really have a target audience, it's just for fun.

Short demo GIF: [https://imgur.com/a/Lh967ip](https://imgur.com/a/Lh967ip)

GitHub: [github.com/Tbence132545/Function-Coaster](https://github.com/Tbence132545/Function-Coaster)

You can:

* Type in multiple functions (even with intervals like `x**2 [0, 5], or compositions`)
* Watch a ball react to slopes and gravity
* Set a finish point and try to "ride the function" to win

There is already a similar game called SineRider, I was just curious to see if I could build something resembling it using my current knowledge from scratch.

It’s far from perfect — but I’d love feedback or ideas if you have any. (I plan on expanding this idea in the near future)
Thanks for checking it out!

/r/Python
https://redd.it/1m4ahyj
Is type hints as valuable / expected in py as typescript?

Whether you're working by yourself or in a team, to what extent is it commonplace and/or expected to use type hints in functions?

/r/Python
https://redd.it/1m4ofoe
What's bad about using views.py as a ghetto API?

I recently realized more and more that I started using views.py as a simple way to implement APIs. DRF just requires so much overhead(!) and is a royal pain in the ass imo – Ninja I haven't tried yet, because why

Most APIs are simply "action" APIs or a simple retrieve API. Don't need fancy CRUD operations mostly. But I'm wondering why not more people are doing it the way I am so I wanted to ask is there an inherent issue with mis-using views.py for ghetto APIs?

They're just so easy to read and maintain! No nested classes, just a couple lines of code.

Examples:

@csrfexempt
def push
gateway(request):
""" Quick and dirty API to centrally handle webhooks / push notifications """
if not request.method == 'POST':
return JsonResponse({'status': 'error'})
try:
user, token = TokenAuthentication().authenticate(request)
except AuthenticationFailed:


/r/django
https://redd.it/1m4l8mz
Beginner in Django — Need Advice to Improve My Programming Thinking and Learn Django Properly

Hi everyone

I started learning Python about 5 months ago. I work at a small company — at first, they had me do web scraping tasks. After a while, they asked me to start learning Django so I could work on their internal projects.

Right now, I’m facing two main challenges and would really appreciate your advice:

1. I feel like my programming logic and thinking need improvement. Sometimes I can understand code, but I don’t fully understand why it was written that way or how I could come up with the solution myself. Should I start learning data structures, algorithms, and OOP to develop this kind of thinking? If yes, any recommended beginner-friendly resources?
2. I want to learn Django from scratch, step by step, and really understand how it works. Most tutorials I’ve found either move too fast or assume I already understand certain concepts — which I don’t. I’m looking for a structured and beginner-friendly course/book/resource that builds a solid foundation.

I'm very motivated to learn but also feeling a bit lost and overwhelmed right now.
If you have any tips, learning paths, or personal advice, I’d be super grateful 🙏

Thanks in advance to everyone who helps ❤️

/r/django
https://redd.it/1m4q97n
API Driven Waffle Feature Flags

Hey all,

Wondering how this ought to work. Right now we're dealing with a distributed monolith. One repo produces a library and sqlalchemy migrations for a database ("a"), our django repo imports the library and the models for that database (along with producing its own models for another database - "b")


The migrations for database a are run independent of both repos as part of a triggerable job. This creates a not great race condition between django and database a.

I was thinking that an api driven feature flag would be a good solution here as the flag could be flipped after the migration runs. This would decouple releasing django app changes and running database a migrations.

We're in AWS on EKS

To that end I'm kind of struggling to think of a clean implementation (e.g. not a rube goldberg), but I'm not really a web dev or a django developer and my knowledge of redis is pretty non-existent.. The best I've gotten so far is...

- Create an elasticache redis serveless instance as they appear quite cheap and I just wrote the terraform for this for another app.

- Create an interface devs can use to populate/update the redis instance with feature flags.

- install a new

/r/django
https://redd.it/1m4on3p
KvDeveloper Client – Expo Go for Kivy on Android

[KvDeveloper Client](https://github.com/Novfensec/KvDeveloper-Client)

[Live Demonstration](https://youtu.be/-VTCTNmHB94)

Instantly load your app on mobile via QR code or Server URL. Experience blazing-fast Kivy app previews on Android with KvDeveloper Client, It’s the Expo Go for Python devs—hot reload without the hassle.

# What My Project Does

KvDeveloper Client is a **mobile companion app that enables instant, hot-reloading previews of your Kivy (Python) apps directly on Android devices—no USB cable or apk builds required**. By simply starting a development server from your Kivy project folder, you can scan a QR code or input the server’s URL on your phone to instantly load your app with real-time, automatic updates as you edit Python or KV files. This workflow mirrors the speed and seamlessness of Expo Go for React Native, but designed specifically for Python and the Kivy framework.

**Key Features:**

* Instantly preview Kivy apps on Android without manual builds or installation steps.
* Real-time updates on file change (Python, KV language).
* Simple connection via QR code or direct server URL.
* Secure local-only sync by default, with opt-in controls.

# Target Audience

This project is ideal for:

* **Kivy developers** seeking faster iteration cycles and more efficient UI/logic debugging on real devices.
* Python enthusiasts interested in mobile development without the overhead of traditional Android build processes.
*

/r/Python
https://redd.it/1m4nul8
Riot-style voice-to-text chat app I built using Flask — would love feedback!

/r/flask
https://redd.it/1m4p2f1
Using asyncio for cooperative concurrency

I am writing a shell in Python, and recently posted a question about concurrency options (https://www.reddit.com/r/Python/comments/1lyw6dy/pythons_concurrency_options_seem_inadequate_for). That discussion was really useful, and convinced me to pursue the use of asyncio.

If my shell has two jobs running, each of which does IO, then async will ensure that both jobs make progress.

But what if I have jobs that are not IO bound? To use an admittedly far-fetched example, suppose one job is solving the 20 queens problem (which can be done as a marcel one-liner), and another one is solving the 21 queens problem. These jobs are CPU-bound. If both jobs are going to make progress, then each one occasionally needs to yield control to the other.

My question is how to do this. The only thing I can figure out from the async documentation is asyncio.sleep(0). But this call is quite expensive, and doing it often (e.g. in a loop of the N queens implementation) would kill performance. An alternative is to rely on signal.alarm() to set a flag that would cause the currently running job to yield (by calling asyncio.sleep(0)). I would think that there should or could be some way to yield that is much lower in cost. (E.g.,

/r/Python
https://redd.it/1m4qz35
Strange behaviour for Django > 5.0 (long loading times and high Postgres CPU load, only admin)

Hi everyone,

I'm currently experiencing some strange behavior that I can't quite wrap my head around, so I thought I'd ask if anyone here has seen something similar.

What happened:
I recently upgraded one of our larger projects from Django 4.2 (Python 3.11) to Django 5.2 (Python 3.13). The upgrade itself went smoothly with no obvious issues. However, I quickly noticed that our admin pages have become painfully slow. We're seeing a jump from millisecond-level response times to several seconds.

For example, the default /admin page used to load in around 200–300ms before the upgrade, but now it's taking 3–4 seconds.

I initially didn't notice this during development (more on that in a moment), but a colleague brought it to my attention shortly after the deployment to production. Unfortunately, I didn’t have time to investigate right away, but I finally got around to digging into it yesterday.

What I found:
Our PostgreSQL 14 database server spikes to 100% CPU usage when accessing the admin pages. Interestingly, our regular Django frontend and DRF API endpoints seem unaffected — or at least not to the same extent.

I also upgraded psycopg as part of the process, but I haven’t found anything suspicious there yet.

Why I missed

/r/django
https://redd.it/1m4vfkb
UA-Extract - Easy way to keep user-agent parsing updated

Hey folks! I’m excited to share UA-Extract, a Python library that makes user agent parsing and device detection a breeze, with a special focus on keeping regexes fresh for accurate detection of the latest browsers and devices. After my first post got auto-removed, I’ve added the required sections to give you the full scoop. Let’s dive in!

**What My Project Does**

UA-Extract is a fast and reliable Python library for parsing user agent strings to identify browsers, operating systems, and devices (like mobiles, tablets, TVs, or even gaming consoles). It’s built on top of the device\_detector library and uses a massive, regularly updated user agent database to handle thousands of user agent strings, including obscure ones.

The star feature? **Super easy regex updates**. New devices and browsers come out all the time, and outdated regexes can misidentify them. UA-Extract lets you update regexes with a single line of code or a CLI command, pulling the latest patterns from the [Matomo Device Detector](https://github.com/matomo-org/device-detector) project. This ensures your app stays accurate without manual hassle. Plus, it’s optimized for speed with in-memory caching and supports the regex module for faster parsing.

Here’s a quick example of updating regexes:

from ua_extract import Regexes


/r/Python
https://redd.it/1m5157j
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/1m543e5
Introducing async_obj: a minimalist way to make any function asynchronous

If you are tired of writing the same messy threading or `asyncio` code just to run a function in the background, here is my minimalist solution.

Github: [https://github.com/gunakkoc/async\_obj](https://github.com/gunakkoc/async_obj)

# What My Project Does

`async_obj` allows running any function asynchronously. It creates a class that pretends to be whatever object/function that is passed to it and intercepts the function calls to run it in a dedicated thread. It is essentially a two-liner. Therefore, async\_obj enables async operations while minimizing the code-bloat, requiring no changes in the code structure, and consuming nearly no extra resources.

Features:

* Collect results of the function
* In case of exceptions, it is properly raised and only when result is being collected.
* Can check for completion OR wait/block until completion.
* Auto-complete works on some IDEs

# Target Audience

I am using this to orchestrate several devices in a robotics setup. I believe it can be useful for anyone who deals with blocking functions such as:

* Digital laboratory developers
* Database users
* Web developers
* Data scientist dealing with large data or computationally intense functions
* When quick prototyping of async operations is desired

# Comparison

One can always use `multithreading` library. At minimum it will require wrapping the function inside another function to get the returned result. Handling errors

/r/Python
https://redd.it/1m54hyp
Sifaka: Simple AI text improvement using research-backed critique (open source)

## What My Project Does

Sifaka is an open-source Python framework that adds reflection and reliability to large language model (LLM) applications. The core functionality includes:

- 7 research-backed critics that automatically evaluate LLM outputs for quality, accuracy, and reliability
- Iterative improvement engine that uses critic feedback to refine content through multiple rounds
- Validation rules system for enforcing custom quality standards and constraints
- Built-in retry mechanisms with exponential backoff for handling API failures
- Structured logging and metrics for monitoring LLM application performance

The framework integrates seamlessly with popular LLM APIs (OpenAI, Anthropic, etc.) and provides both synchronous and asynchronous interfaces for production workflows.

## Target Audience

Sifaka is (eventually) intended for production LLM applications where reliability and quality are critical. Primary use cases include:

- Production AI systems that need consistent, high-quality outputs
- Content generation pipelines requiring automated quality assurance
- AI-powered workflows in enterprise environments
- Research applications studying LLM reliability and improvement techniques

The framework includes comprehensive error handling, making it suitable for mission-critical applications rather than just experimentation.

## Comparison

While there are several LLM orchestration tools available, Sifaka differentiates itself through:

vs. LangChain/LlamaIndex:

- Focuses specifically on output quality and reliability rather than general orchestration
- Provides research-backed evaluation metrics instead of generic chains
- Lighter weight with minimal dependencies

/r/Python
https://redd.it/1m59s5f
An AI Meme Generator!!

/r/djangolearning
https://redd.it/1m42ddu
Hosting Open Source LLMs for Document Analysis – What's the Most Cost-Effective Way?

Hey fellow Django dev,
Any one here experince working with llms ?

Basically, I'm running my own VPS (basic $5/month setup). I'm building a simple webapp where users upload documents (PDF or JPG), I OCR/extract the text, run some basic analysis (classification/summarization/etc), and return the result.

I'm not worried about the Django/backend stuff – my main question is more around how to approach the LLM side in a cost-effective and scalable way:

I'm trying to stay 100% on free/open-source models (e.g., Hugging Face) – at least during prototyping.
Should I download the LLM locally (e.g., GGUF / GPTQ / Transformers), run it via something like text-generation-webui, llama.cpp, vLLM, or even FastAPI + transformers?
Or is there a way to call free hosted inference endpoints (Hugging Face Inference API, Ollama, [Together.ai](http://Together.ai), etc.) without needing to host models myself?
If I go self-hosted: is it practical to run 7B or even 13B models on a low-spec VPS? Or should I use something like LM Studio, llama-cpp-python, or a quantized GGUF model to keep memory usage low?

I’m fine with hacky setups as long as it’s reasonably stable. My goal isn’t high traffic, just a few dozen users at the start.

What

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