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
ChatForge: A free, open-source AI chat client with 300+ models (GPT-4, Claude 3, etc.)—no subscriptions, pay-per-token!

I’ve been working on ChatForge—a no-BS, open-source chat client that lets you access 318+ AI models (GPT-4.1 Mini, Claude 3.7, Qwen, Gemini, etc.) from one dashboard. No upfront costs, no monthly fees—just pay for tokens you actually use.

Why bother?

Free-tier models: Test drive without even adding a payment method.
Persistent chats: Name/organize convos like files (RIP losing your 2am AI rants).
Customizable: Set default models, API keys, etc.
Simple UI: Not a design award winner, but it’s clean and functional (I’m a dev, not a designer—sue me).

It’s 100% free and community-driven. I’d love feedback (or contributions if you’re into Python/Django).

Try it or roast it:
🔗 GitHub

P.S. If you’ve tried similar tools (like OpenRouter’s web UI), how’s this compare? Honest takes welcome.

/r/django
https://redd.it/1kf89nu
Read pdf as html

Hi,

Im looking for a way in python using opensource/paid, to read a pdf as html that contains bold italic, font size new lines, tab spaces etc parameters so that i can render it in UI directly and creating a new pdf based on any update in UI, please suggest me is there any options that can do this job with accuracy

/r/Python
https://redd.it/1kf641m
How would you handle achievements and achievement progress n a Django app?

I’m working on a Django web app where I want to introduce badges/achievements for users — things like:

* Play 10 random quizzes in a day
* Finish 100 quizzes in total
* Play 7 days in a row

Here’s the basic model setup I’m considering:
```
class Achievement(models.Model):
code = models.CharField(max_length=100, unique=True) # e.g., 'play_10_quizzes'
name = models.CharField(max_length=200)
description = models.TextField()
icon = models.ImageField(upload_to='achievement_icons/', null=True, blank=True)

class UserAchievement(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
achievement = models.ForeignKey(Achievement, on_delete=models.CASCADE)
unlocked_at = models.DateTimeField(auto_now_add=True)

class Meta:
unique_together = ('user', 'achievement')
```

How best to save and calculate/track user progress toward an achievement?

I’ve been reading that using Django signals might not be the best approach here, and I’m wondering what patterns or architecture others have used.

**Specifically:**

* Do you calculate achievement progress dynamically (on the fly) when the frontend requests it?
* Or do you store progress in the database and increment it every time an action happens (e.g., quiz completed), so reads are faster?
* How do you handle edge cases, like historical data changes or deletions?
* Any tips on scaling this

/r/django
https://redd.it/1kf9a2b
Any repo on learning pywebview bundling for Mac

Any guide I can follow, I need to add spacy model along with bundle, it increases the size of the app, also the app isn’t able to connect to the backend once I build using Pyinstaller but works well while running locally.

/r/Python
https://redd.it/1kf4rlf
Why should one write tests?

First of all I will not question whether it is necessary to write tests or not, I am convinced that it is necessary, but as the devil's advocate, I'd like to know the real good reasons for doing this. Why devil's advocate? I have my app, that is going well (around 50k users monthly). In terms of complexity it's definetely should be test covered. But it's not. At all. Yeah, certainly there were bugs that i caught only in production, but i can't understand one thing - if i write tests for thousands cases, but just don't think of 1001 - in any case something should appear in prod. Not to mention that this is a very time consuming process.


P.S. I really belive I'll cover my app, I'm just looking for a motivation to do that in the near future

/r/django
https://redd.it/1kfbsc0
strif: A tiny, useful Python lib of string, file, and object utilities

I thought I'd share **strif**, a tiny library of mine. It's actually old and I've used it quite a bit in my own code, but I've recently updated/expanded it for Python 3.10+.

I know utilities like this can evoke lots of opinions :) so appreciate hearing if you'd find any of these useful and ways to make it better (or if any of these seem to have better alternatives).

What it does: It is nothing more than a tiny (\~1000 loc) library of \~30 string, file, and object utilities.

In particular, I find I routinely want atomic output files (possibly with backups), atomic variables, and a few other things like base36 and timestamped random identifiers. You can just re-type these snippets each time, but I've found this lib has saved me a lot of copy/paste over time.

Target audience: Programmers using file operations, identifiers, or simple string manipulations.

Comparison to other tools: These are all fairly small tools, so the normal alternative is to just use Python standard libraries directly. Whether to do this is subjective but I find it handy to `uv add strif` and know it saves typing.

boltons is a much larger library of general utilities. I'm sure a lot of it

/r/Python
https://redd.it/1kfksn1
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/1kfqwcv
Are there any boilerplates or templates you are using currently? If so, what is your project?

Want to learn to review code and get a sense for proper structure and gain in depth knowledge about overall development. What modules are a must for your development? I also enjoy reading about another developer’s workflow and productivity.

/r/flask
https://redd.it/1kfvibz
[Hiring] Full stack dev with REACT Js & Django Experience

Need an experienced dev with plenty of experience building scalable web and mobile apps. The role is open to anyone in the world.

Pay: $75 AUD / hr. 20 hours need per week now, but more will be needed later on.

**Some crucial skills:**

* Amazing design skills. You need to be a very creative designer and know how to use CSS (and tailwind CSS)
* Worked with projects that use heaps of CRUD operations
* Understanding on how to build scalable APIs. Some past web apps we’ve built have brought in 1M+ users per month, so the backend needs to be built to scale!
* File storing, S3 and data handling
* Experience with both Django and REACT js
* Experience with REACT Native as well
* (optional) experience with building software that uses WAV & MP3 files
* Thorough knowledge around algorithm development
* Experience with building unique programs in the past with custom functionality.

**Hours & Pay:**

Email me if interested - [admin@outreachaddict.com](mailto:admin@outreachaddict.com). Please include links to stuff you’ve worked on in the past.  

/r/Python
https://redd.it/1kfup52
Using Django+Sqlite in production

I've been researching the use of Sqlite in production and came across this thread which has some resources, mainly about the benefits and also how to performance tune Sqlite.

My intent right now is to keep my app on Sqlite. The application is a B2B app with limited number of users, and it is not write heavy (a few hundred writes per day). It also simplifies my tech stack.

I'd like to check if someone has resources specific on how to deploy and run a Django+Sqlite app.

Over in the Ruby on Rails world, I saw a movement to help developers achieve this, and was wondering if there is something equivalent in the Django.

/r/django
https://redd.it/1kfuuys
Cogitator - A Python Toolkit for Chain-of-Thought Prompting

GitHub Link: [https://github.com/habedi/cogitator](https://github.com/habedi/cogitator)

**What my project does**

Cogitator is a Python library/toolkit that makes it easier to experiment with and use various chain-of-thought (CoT) prompting methods for large language models (LLMs). CoT prompting is a family of techniques that helps LLMs improve their reasoning and performance on complex tasks (like question-answering, math, and problem-solving) by guiding them to generate intermediate steps before giving a final answer.

Cogitator currently provides:

* Support for OpenAI and Ollama as LLM backends.
* Implementations for popular CoT strategies such as Self-Consistency, Tree of Thoughts (ToT), Graph of Thoughts (GoT), Automatic CoT (Auto-CoT), Least-to-Most Prompting, and Clustered Distance-Weighted CoT.
* A unified sync/async API for interacting with these strategies.
* Support for structured model outputs using Pydantic.
* A basic benchmarking framework.

The project is in beta stage. The README in the GitHub repository has more details, installation instructions, and examples.

**Target audience**

* AI/ML researchers looking to experiment with or benchmark different CoT techniques.
* Python developers who want to integrate more advanced reasoning capabilities into their LLM-powered applications.

In general, CoT could be useful if you're working on tasks that need multi-step reasoning or want to improve the reliability of LLM outputs for more complicated queries.

**Why I made this**

I started developing Cogitator because I found that

/r/Python
https://redd.it/1kg2b2p
PyCon US 2025 is next week!

# PyCon US 2025 Quickly Approaches!

You still have time to register for our annual in-person event. Check out the official schedule of talks and events!

# Links

[Register Now](https://us.pycon.org/2025/registration/register)
PyCon Blog Announcement
[PyLadies Auction Donations](https://pycon.blogspot.com/2025/03/support-pyladies-donate-to-pyladies.html)
Keynote Speaker and Schedule Announcements

~~You have 30 days until the early bird pricing is gone!~~

The early bird pricing is gone, but you still have a chance to get your tickets.

# Details

May 14 - May 22, 2025 - Pittsburgh, Pennsylvania Conference breakdown:

Tutorials: May 14 - 15, 2025
Main Conference and Online: May 16 - 18, 2025
Job Fair: May 18, 2025
Sprints: May 19 - May 22, 2025 (What to expect at sprints)


edited, dates are hard

/r/Python
https://redd.it/1kg5xvh
Looking for help regarding a flask project (I want to input question (with both text and equations) , save it in MySQL and print in both word doc and pdf)

I am working on a basic question paper generator where users can enter questions for each subject, and the the questions are saved in MySQL. The admin can generate question papers in form of both pdf and word. I am unable to find a way to let users to add questions that has equations or formulas. I tried using tinymce and mathjack but it doesn't seem to support all formats (like the bigger fractions). I also tried rendering latex to text or image and is too complicated for me to understand how to make it work properly. I do not want to paste the equation/formula as an image in the word file, I need to to be in proper human readable format. I want the outputs both in word and pdf formats. Please help.

Eg. equation

/r/flask
https://redd.it/1kg3nx7
I built my own asyncio to understand how async I/O works under the hood

Hey everyone!

I've always been a bit frustrated by my lack of understanding of how blocking I/O actions are actually processed under the hood when using async in Python.

So I decided to try to build my own version of asyncio to see if I could come up with something that actually works. Trying to solve the problem myself often helps me a lot when I'm trying to grok how something works.

I had a lot of fun doing it and felt it might benefit others, so I ended up writing a blog post.

Anyway, here it is. Hope it can help someone else!

👉 https://dev.indooroutdoor.io/asyncio-demystified-rebuilding-it-from-scratch-one-yield-at-a-time

EDIT: Fixed the link

/r/Python
https://redd.it/1kg9q8b
No, not every website needs to be an SPA. Built something with Django—fast, clean, and people love it.

I just launched a small project using plain Django (no SPA, no fancy frontend frameworks).

It’s fast, clean, and people love using it.

I see so many projects defaulting to SPAs, even when it’s not necessary. Django let me move fast, keep things simple, and focus on the core experience—not on wiring up a complex frontend stack.

Honestly, that’s what I love about Django. It gives you everything you need to ship something solid without overengineering.

Also—thank you to this subreddit. I’ve learned a lot here. If anyone’s curious about the stack or wants to ask anything, happy to chat.

website : **Slowcialize**

/r/django
https://redd.it/1kgdvbs
My journey after 1 month on internship using django

I have been using Django almost for a month (The first days in the company I did nothing. I was only meeting new people).

They told me to use whatever I want, so I chose Python because I'm interested in machine learning so I saw it as an opportunity for my future. They want to create automation and I didn't know where to deploy it so I decided to deploy everything I do for the company in the web then I decided to use Django.

I have learned a lot since then, sometimes I get stressed but reading code and with AI tools I reach to fix the errors I have on my code but of course I have a ton to improve and I'll do it with the time, I just started my journey in this world and I'm so happy for it because since I was a kid I love technology

/r/django
https://redd.it/1kg4j8f
Django relevance

I'm new to the dev world and would like some help.

What factors do people consider while learning a language. For example, right now I often come across people pushing Rust and Go. I suppose my question is, is Django still relevant for back end?

/r/django
https://redd.it/1kgnbzu
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

/r/Python
https://redd.it/1kgjogw
Tuples vs Dataclass (and friends) comparison operator, tuples 3x faster

I was heapifying some data and noticed switching dataclasses to raw tuples reduced runtimes by \~3x.

I got in the habit of using dataclasses to give named fields to tuple-like data, but I realized the dataclass wrapper adds considerable overhead vs a built-in tuple for comparison operations. I imagine the cause is tuples are a built in CPython type while dataclasses require more indirection for comparison operators and attribute access via __dict__?

In addition to dataclass , there's namedtuple, typing.NamedTuple, and dataclass(slots=True) for creating types with named fields . I created a microbenchmark of these types with heapq, sharing in case it's interesting: https://www.programiz.com/online-compiler/1FWqV5DyO9W82

Output of a random run:

tuple : 0.3614 seconds
namedtuple : 0.4568 seconds
typing.NamedTuple : 0.5270 seconds
dataclass : 0.9649 seconds
dataclass(slots) : 0.7756 seconds

/r/Python
https://redd.it/1kggyg0
Flask is driving me crazy

ok so i started learning flask as part of a course im in. At first, it felt like it was easy with some all-in-one code ive made. Like managing the routes, using url_for, creating the connection with the database. Then i tried to make the flask tutorial from their website, now i feel the more dumb than i used to, lol. i think they just throw code on the screen and you gotta copy, i mean, i can totally understand what the code does by reading it, but i cant imagine me learning anything from it. I dont know if i am going to be able to get all of this stuff in my head.


Is there any other place i can learn flask or Python webdev thats does it slowly and/or in a better way?

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