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 wrote up a Python app and GUI for my mini thermal printer

Hey everyone, it's Mel :) Long time reader, first time poster (I think)

I bought a mini thermal printer a few weeks back after spotting it at my local Walmart. I was hoping to use it out of the box with my PC to print shopping lists, to-do lists, notes and whatnot - no luck! So my friends and I got together and reverse-engineered the comms between the printer and our smartphones, wrote Python code to connect to and print from our PCs, and I made a GUI for the whole thing.

* **What My Project Does:** Lets computers connect to the CPT500 series of thermal printers by Core Innovation Products, and print text and images to the printer from the comfort of your desktop computer!
* **Target Audience:** Just a personal project for now, but I'm thinking of going back into the code when I have more time to really polish it and make it available more widely.
* **Comparison:** I couldn't really find anything that directly compares. There is a project out there that works for the same printer, but it's meant to be hosted on online server instances (mine is local). Other similar programs don't work for that printer, either.

You can

/r/Python
https://redd.it/1ost6e1
P RLHF (SFT, RM, PPO) with GPT-2 in Notebooks

Hi all, I implemented Reinforcement Learning from Human Feedback (RLHF) including Supervised Fine-Tuning (SFT), Reward Modeling (RM), and Proximal Policy Optimization (PPO) step-by-step in three notebooks.

I used these steps to train a GPT-2 model on Stanford Sentiment Treebank v2 (SST2), a dataset of movie reviews. After the SFT step, GPT-2 model learns to generate sentences that look like movie reviews. Next, I build a reward model from another instance of GPT-2 model with a reward head attached on top and train it to predict the sentiment associated with a movie review. Finally, in the PPO step, I further train the SFT model and use the reward from the reward model to encourage the SFT model to generate only the movie reviews with positive sentiment.

All the Jupyter notebooks are available on GitHub: https://github.com/ash80/RLHF\_in\_notebooks

For those curious, I also created a video walkthrough explaining each step of the implementation in detail on YouTube here: https://www.youtube.com/watch?v=K1UBOodkqEk

Happy to discuss or receive any feedback!

/r/MachineLearning
https://redd.it/1oskesn
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/1osyz5r
What fronted technology is most used with Django?

Context. Most of my side projects only required HTML and CSS. There has been the need for a bit of JavaScript, but nothing complex. With my latest project though I thought why not try something new.

Goal. Identify the most used frontend framework by the community outside of HTML and CSS, e.g. React, Vue, etc.

Rules :-
1. Search existing comments to see if your frontend framework of choice has already been added.
2. If it has already been added, up vote the comment, optionally adding any additional comments of yours as a sub comment to it.
3. Else, add a comment mentioning your frontend framework of choice, along with any additional comments you may have.

/r/django
https://redd.it/1ota3so
Djang with oauth2provider and custom GPT

Hi All

I need some help because I failed to set correctly my system.

I'm trying to configure a custom GPT with Oauth2 auth for the api calling by the custom GPT.

OAuth auth and api are provided by Django. For Oauth part I installed the oauth2\
provider module in Django.

In Django:

I set a new application in admin/Django outh toolkit/applications with: client id, call back uri, client type: public, Authorization grant type:  Authorization code, client secret and Algorithm: No OIDC support

In custom GPT:

Without setting OAuth for the tools, the LLM is able to work and call the api to extract the data. But with Oauth enables I set client id, secret client, auth uri, token uri and by default pos request.

During testing the tools.

First I identified the id in url of custom GPT is not the same the id given in the call back uri by OpenAI. Is it normal ?

LLM identify correctly the tools and display me a button to connect to my website. Once connected I am redirected to OpenAI but in a new tchat (not the tchat when I was speaking) and this new tchat is not the custom tchat. I lost all history.

From django logs I can see call only

/r/django
https://redd.it/1ot8u7y
D ICLR 2026 Paper Reviews Discussion

ICLR 2026 reviews go live on OpenReview tomorrow! Thought l'd open a thread for any feedback, issues, or celebrations around the reviews.

Use this thread for feedback, issues, and wins. Review noise happens scores ≠ impact. Share your experience and let’s support each other.

/r/MachineLearning
https://redd.it/1otlqqv
Issue to run Flask

/r/flask
https://redd.it/1otja3g
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/1otue4f
I just published my first ever Python library on PyPI....

After days of experimenting, and debugging, I’ve officially released numeth - a library focused on core Numerical Methods used in engineering and applied mathematics.

-  What My Project Does

Numeth helps you quickly solve tough mathematical problems - like equations, integration, and differentiation - using accurate and efficient numerical methods.

It covers essential methods like:

1. Root finding (Newton–Raphson, Bisection, etc.)
2. Numerical integration and differentiation
3. Interpolation, optimization, and linear algebra

-  Target Audience

I built this from scratch with a single goal:
Make fundamental numerical algorithms ready to use for students and developers alike.

- Comparison

Most Python libraries, like NumPy and SciPy, are designed to use numerical methods, not understand them. Their implementations are optimized in C or Fortran, which makes them incredibly fast but opaque to anyone trying to learn how these algorithms actually work.

'numeth' takes a completely different approach.
It reimplements the core algorithms of numerical computing in pure, readable Python, structured into clear, modular functions.

The goal isn’t raw performance. It’s helping students, educators, and developers trace each computation step by step, experiment with the logic, and build a stronger mathematical intuition before diving into heavier frameworks.

If you’re into numerical computing or just curious to see what it’s about, you can check it out here:

🔗 https://pypi.org/project/numeth/

or run 'pip

/r/Python
https://redd.it/1otjuu4
Django Roadmap (Web Dev)

Is there a site or something, where I can a roadmap? I prefer something like this so I know what to learn after the other. Thank you!

/r/djangolearning
https://redd.it/1opp3jz
Django Rich Text with i18n

Hi all.

Right now I am building my personal multi language blog website, with Django as Backend.

I am actively looking for something like RichText in Rails for posts, but as for now with no luck.
What I need is minimalistic text editor with Bold, Italic, maybe list options AND important thing - feature to add picture in the text with captions below these pictures.
There will be only one author -- me =)
So, nothing special on top of that. Simple is better.

I am fairly new to Django, so right now I am somewhat confused -- there are things like CKeditor, but they are expensive, and to be honest -- there is no clear way how to setup them with i18n.

Do you have any suggestions what should I look for, preferably easy to setup and use?

Many thanks in advance!



/r/django
https://redd.it/1ottmbd
D Choosing a thesis topic in ML

I am at the stage where I have to decide my undergraduate thesis problem statement to work on in the next semester. To those who've had their undergraduate/master's thesis in ML, how did you decide to work on that statement?

Did you start by looking at datasets first and then build your problem around it? Or did you look at existing problems in some framework and try to fix them? Or did you just let your academic guide give you a statement? Or something entirely different?

I'm more inclined towards Computer Vision but open to other ML fields as well, so any suggestions on how to look for a problem statement are most welcome.

Thanks!

/r/MachineLearning
https://redd.it/1ou2s9x
Migrating django heroku to vps

I have an ecom website whose server is hosted on heroku. Django server on web dyno + celery on worker dyno+ meilisearch on another dyno.
As the traffic grew, it now requires Standard 1X for dynos which is like 25 usd per dynos.
I wanted to migrate to some good VPS. Any recommendations like Hostingers Vps is cheap.


/r/django
https://redd.it/1otzz23
A collection of type-safe, async friendly, and unopinionated enhancements to SQLAlchemy Core

Project link: https://github.com/sayanarijit/sqla-fancy-core

## Why?

- ORMs are magical, but it's not always a feature. Sometimes, we crave for familiar.
- SQLAlchemy Core is powerful but table.c.column breaks static type checking and has runtime overhead. This library provides a better way to define tables while keeping all of SQLAlchemy's flexibility. See Table Factory.
- The idea of sessions can feel too magical and opinionated. This library removes the magic and opinions and takes you to back to familiar transactions's territory, providing multiple un-opinionated APIs to deal with it. See Wrappers and Decorators.

## Demos:

- FastAPI - sqla-fancy-core example app.

## Target audience

Production. For folks who prefer query maker over ORM, looking for a robust sync/async driver integration, wanting to keep code readable and secure.

## Comparison with other projects:

Peewee: No type hints. Also, no official async support.

Piccolo: Tight integration with drivers. Very opinionated. Not as flexible or mature as sqlalchemy core.

Pypika: Doesn’t prevent sql injection by default. Hence, can be considered insecure.

/r/Python
https://redd.it/1otx8aa
Can't get Flask-JWT-Extended to set cookies with token properly (help appreciated)

Hi, y'all!
I am struggling with a semi-private project with JWT authentication.

This is the flask login route:

@bp.route("/auth/login", methods="POST")
@crossorigin(
origins=["http://localhost:5173"],
supports
credentials=True,
)
def login():
loginusername = request.json.get("username", None)
login
password = request.json.get("password", None)
dbuser = User.query.filterby(email=loginusername).oneornone()
if not db
user or not dbuser.checkpassword(loginpassword):
app.logger.warning(f"Failed login attempt for {login
username}")
return jsonify({"error": "Invalid credentials"}), 401

response = jsonify(
{
"msg": "login successful",
"userdata": {


/r/flask
https://redd.it/1ou730g
Need help don't know what to do

I need to learn a basic level of Django and
Don't know what source to follow I have a project to be done by next 45days
Please can anyone share me a course on udemy or something 😭

/r/djangolearning
https://redd.it/1ouflpy
Decorators are great!

After a long, long time trying to wrap my head around decorators, I am using them more and more. I'm not suggesting I fully grasp metaprogramming in principle, but I'm really digging on decorators, and I'm finding them especially useful with UI callbacks.

I know a lot of folks don't like using decorators; for me, they've always been difficult to understand. Do you use decorators? If you understand how they work but don't, why not?

/r/Python
https://redd.it/1oubbk3
I need help with calculated fields.

I've done a lot of research, but I'm currently overwhelmed. The calculations I need to do are actually simple, such as: how many units of a product are in stock, how many orders exist for that product, or how many items were shipped in an order and how many are remaining. I'm developing an app that handles these calculations, but I'm unsure of the best way to implement these calculated fields. Should I use property, signals, or another method? I feel overwhelmed and lost. I would really appreciate it if you could explain the logic behind this and the correct approach, or provide some example code for similar operations.

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