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
What terminal is recommended?

Hello. Im pretty new to this and been searching for good terminals. What kind of terminals would you recommend for begginers on Windows?

/r/Python
https://redd.it/1lvdaj6
Python Hackathon Backend for rapid development and Feedback-Driven shipping

Within a year, I had the opportunity to participate in hackathons organized by Mistral, OpenAI, and DeepMind in Paris. Leveraging this experience, I’ve created a Python-backend boilerplate incorporating my feedback to streamline collaboration and urgent deployments.

What it does: This open-source GitHub template provides a standardized and efficient boilerplate to expedite setup, collaboration, and rapid deployment during hackathons. The template encompasses several essential components, including the uv package manager complemented by intuitive pre-configured make commands, FastAPI for rapid and modular API development, and Pydantic for robust data validation and type checking. Additionally, it incorporates custom instructions optimized for agent tools like Cline and GitHub Copilot, enhancing both developer productivity and code comprehension. Comprehensive unit tests and a minimal Continuous Integration (CI) configuration ensure seamless integration and prevent merging faulty code into production.

Target audience: This project is specifically targeted at software developers and AI engineers, particularly those preparing for their first hackathon experience, whether working individually or within a collaborative team environment. It caters to developers looking for rapid prototyping and deployment solutions, emphasizing efficiency, maintainability, and robustness under tight deadlines and challenging operational conditions.

Comparison: While numerous boilerplate templates and rapid-deployment solutions exist in the Python ecosystem, this template distinguishes itself by specifically addressing the common

/r/Python
https://redd.it/1lvfbxl
Problems with rabbitmq and pika

Hi everyone, I am creating a microservice in Flask. I need this microservice to connect as a consumer to a simple queue with rabbit. The message is sended correctly, but the consumer does not print anything. If the app is rebuilded by flask (after an edit) it prints the body of the last message correctly. I don't know what is the problem.

# [app.py](http://app.py)

from flask import Flask
import threading
from components.message_listener import consume
from controllers.data_processor_rest_controller import measurements_bp
from repositories.pollution_measurement_repository import PollutionMeasurementsRepository
from services.measurement_to_datamap_converter_service import periodic_task
import os

app = Flask(__name__)

PollutionMeasurementsRepository()

def config_amqp():
    threading.Thread(target=consume, daemon=True).start()

if __name__ == "__main__":
    config_amqp()  
    app.register_blueprint(measurements_bp)
    app.run(host="0.0.0.0",port=8080)

# message_listener.py

import pika
import time


def callback(ch, method, properties, body):


/r/flask
https://redd.it/1lve5rn
D Trains a human activity or habit classifier, then concludes "human cognition captured." What could go wrong?

A screenshot of an article's title that was published on the Nature journal. It reads \\"A foundation model to predict and capture human cognition\\"

The fine-tuning dtaset, from the paper: "trial-by-trial data from more than 60,000 participants performing in excess of 10,000,000 choices in 160 experiments."

An influential author in the author list is clearly trolling. It is rare to see an article conclusion that is about anticipating an attack from other researchers. They write "This could lead to an 'attack of the killer bees', in which researchers in more-conventional fields would fiercely critique or reject the new model to defend their established approaches."

What are the ML community's thoughts on this?

/r/MachineLearning
https://redd.it/1lvcs2k
Best options for deploying Flask app for a non-techie

I have just built a Flask app on my home desktop. It uses a mySQL database and integrates into a payment widget which uses webhooks as part of its payment confirmation. Other than this it is fairly straight forward. Some pandas, some form data collection.

In terms of hosting, I need it to be on all the time, but I anticipate it will not have heavy traffic, nor will the space requirement be particularly large. I would like to integrate it into my existing website - I.e. access the app via my existing website URL.

Some cost to host is fine, but low is better, particularly given low usage and space requirements.

I am not particularly technical, so ease of deployment is quite important for me.

Please could you suggest some possible services / strategies I could employ to deploy this.


TIA

/r/flask
https://redd.it/1luxr0d
How to delete saved sessions if I'm using flask-session with sqlalchemy?

I'm currently using flask-session with sqlalchemy, and would like to delete all the sessions stored on my database when a user sends a specific request to an endpoint in my server. I thought I could use session.clear() for that, but it's not working.

This is my repo if you want to see it

/r/flask
https://redd.it/1lux7t4
Free-threaded (multicore, parallel) Python will be fully supported starting Python 3.14!

Python had experimental support for multithreaded interpreter.

Starting in Python 3.14, it will be fully supported as non-experimental: https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-pep779

/r/Python
https://redd.it/1lvjrgj
Devs in Johannesburg

Hi All,

The company I work for is hiring devs in Johannesburg South Africa.

Specifically a Senior Developer and Jnr Developer who can be in office in Johannesburg.

But we are struggling to find good hires, anyone know where to find the best Django devs in Joburg?

Cheers!

/r/django
https://redd.it/1lvkmxb
Using OOP interfaces in Python

I mainly code in the data space. I’m trying to wrap my head around interfaces. I get what they are and ideally how they work. They however seem pretty useless and most of the functions/methods I write make the use of an interface seem useless. Does anyone have any good examples they can share?

/r/Python
https://redd.it/1lvrkpg
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1lvyekp
Django monolith + microservice (chat) setup — need input on auth flow

We built a Django + DRF monolithic SaaS app about 3 years ago that handles:

* User authentication (CustomUser)
* Subscription plans via Razorpay
* Users sign up, pay, and access features

Now we want to add a **chat feature** that interacts with **WhatsApp Web**. Here's our current plan:

* Create a separate **chat microservice** hosted on another subdomain (new VM)
* Use **React** frontend + **Django/DRF + Postgres** backend
* The chat microservice will:
* Use the **existing monolith for authentication**
* Maintain its **own database** for chat-related models
* Have a model like `ExternalCustomUser` which stores the `UUID` of the user from the monolith

The **React frontend** will interact with:

1. **Monolith backend** (for login/auth only)
2. **Chat microservice backend** (for all chat features)

# My questions:

1. Since login happens only once via the monolith, is the **authentication latency** negligible and acceptable?
2. After login, when the React app sends the auth token to the chat microservice, will the **chat DRF backend need to validate that token with the monolith on every request**, or is there a cleaner way to handle this?
3. Also, since the chat microservice doesn’t have a native `User` model (only an `ExternalCustomUser` with UUIDs), how should I handle`request.user`in DRF views?

/r/django
https://redd.it/1lw4pa4
Is this safe to use ?

Hi everyone, i am curious about this code below.

re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),


it usually solves my problem where i turned of the debug my django system, is it safe?

/r/django
https://redd.it/1lvjzdy
I built a minimal, type-safe dependency injection container for Python

Hey everyone,

Coming from a Java background, I’ve always appreciated the power and elegance of the Spring framework’s dependency injection. However, as I began working more with Python, I noticed that most DI solutions felt unnecessarily complex. So, I decided to build my own: Fusebox.

What My Project Does Fusebox is a lightweight, zero-dependency dependency injection (DI) container for Python. It lets you register classes and inject dependencies using simple decorators, making it easy to manage and wire up your application’s components without any runtime patching or hidden magic. It supports both class and function injection, interface-to-implementation binding, and automatic singleton caching.

Target Audience Fusebox is intended for Python developers who want a straightforward, type-safe way to manage dependencies—whether you’re building production applications, prototypes, or even just experimenting with DI patterns. If you appreciate the clarity of Java’s Spring DI but want something minimal and Pythonic, this is for you.

Comparison Most existing Python DI libraries require complex configuration or introduce heavy abstractions. Fusebox takes a different approach: it keeps things simple and explicit, with no runtime patching, metaclass tricks, or bulky config files. Dependency registration and injection are handled with just two decorators—@component and @inject.

Links:

[GitHub](https://github.com/ftbits/fusebox)
PyPI

Feedback, suggestions, and PRs are very welcome!

/r/Python
https://redd.it/1lw78pn
Implementing an in-app mailbox

I want to make an in-app mailbox using combination of socketio and flask (frontend being html,css and js)
is it possible,if yes then are there any tutorials and resources I can follow ...

/r/flask
https://redd.it/1lw6ym4
P PrintGuard - SOTA Open-Source 3D print failure detection model

Hi everyone,

As part of my dissertation for my Computer Science degree at Newcastle University, I investigated how to enhance the current state of 3D print failure detection.

Current approaches such as Obico’s “Spaghetti Detective” utilise a vision based machine learning model, trained to only detect spaghetti related defects with a slow throughput on edge devices (<1fps on 2Gb Raspberry Pi 4b), making it not edge deployable, real-time or able to capture a wide plethora of defects. Whilst their model can be inferred locally, it’s expensive to run, using a lot of compute, typically inferred over their paid cloud service which introduces potential privacy concerns.

My research led to the creation of a new vision-based ML model, focusing on edge deployability so that it could be deployed for free on cheap, local hardware. I used a modified architecture of ShuffleNetv2 backbone encoding images for a Prototypical Network to ensure it can run in real-time with minimal hardware requirements (averaging 15FPS on the same 2Gb Raspberry Pi, a >40x improvement over Obico’s model). My benchmarks also indicate enhanced precision with an averaged 2x improvement in precision and recall over Spaghetti Detective.

My model is completely free to use, open-source, private, deployable anywhere and outperforms

/r/MachineLearning
https://redd.it/1lw8lvh
Find the vulnerability in this view

https://preview.redd.it/qhez8asry1cf1.png?width=1770&format=png&auto=webp&s=181c3a46f3d43e7bbbb5b6e4dd6c62ec732bac32

I'm going to start a series to help people find vulnerable code.

There are multiple vulnerabilities in this snippet, but there's a riddle below to point out 1 particular vulnerability. The source of this finding was from Corgea's scanner.

The Riddle: I’m the kind of guest who stays well past the welcome. You could say I’ve got an open door policy, coming and going without much fuss, whether day or night, rain or shine. Though my hosts don't lock the gate, they let me linger far longer than I should. Who am I?

The code that's cut off in the image is irrelevant to the vulnerability.

/r/django
https://redd.it/1lwdew4
Open source django project

Hello Django developers!
I've created an open-source repository for a press and media system. I've set up the basic structure, so if you're looking to practice or contribute to an open-source project, you're welcome to join us here: press_media_api 😀

/r/djangolearning
https://redd.it/1lu93wr
I am trying to brainstorm ways of hiding slow API requests from the user

I have a Django app deployed on Heroku. Its basically a composite app that relies on several APIs brought together for some data visualizations and modeling.

So far, my requests and methods are quick enough to work at the user level. This was true until I started to build the most recent feature.

The new feature is a GIS visualization relying on a few datapoints from about 200 different APIs, from the same entity. Basically I do:

for every ID:
data.needed = get_data(someAPI.com/{ID})

I am currently just updating a "result" field in the model with the data every time I make those requests. Then I use that result field to populate my template.

Now obviously this is very time consuming and expensive when done at the user level, so now I am looking into caching. I know Django has a cache system for templates, which is pretty easy to use. Unfortunately, the value from this feature depends on the data being as up-to-date as possible. This means I can't just cache the template. I need to run these backend requests frequently, but hide the actual request time from the user.

My first hunch (if

/r/django
https://redd.it/1lwmpvi
Admin Panel is not styled in unfold when production when serving static files through nginx

in production

admin panel


in development

admin panel

i am serving through nginx when in production but even when debug is true in production the admin panel is not styled.
I am not getting what is happening. If someone done it, please help me.



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