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
Notes running Python in production

I have been using Python since the days of Python 2.7.

Here are some of my detailed notes and actionable ideas on how to run Python in production in 2025, ranging from package managers, linters, Docker setup, and security.

/r/Python
https://redd.it/1k3fase
[P] F1 Race Prediction Model for the 2025 Saudi Arabian GP – Building on My Shanghai & Suzuka Forecasts

Over the past few weeks, I’ve been working on a small project to predict Formula 1 race results using real-world data and simple, interpretable models. I started with the **2025 Shanghai GP**, refined it for **Suzuka**, and now I’ve built out predictions for the **Saudi Arabian GP in Jeddah**.

The idea has been to stay consistent and improve week by week — refining features, visuals, and prediction logic based on what I learn.

# How It Works:

The model uses:

* **FastF1** to pull real 2022–2025 data (including qualifying)
* Driver form: average position, pace, recent results
* **Saudi-specific metrics**: past performance at Jeddah, grid/finish delta
* Custom features like average position change and experience at the track

No deep learning here — I opted for a **hand-crafted weighted formula** over a Random Forest baseline for transparency and speed. It’s been a fun exercise in feature engineering and understanding what actually predicts performance.

# Visualizations:

* Predicted finishing order with expected points
* Podium probability for top drivers
* Grid vs predicted finish (gain/loss analysis)
* Team performance and driver consistency
* Simple Jeddah circuit map showing predicted top 5

# Why I’m Doing This:

I wanted to learn ML, and combining it with my love for F1 made the process way more enjoyable. Turns out,

/r/MachineLearning
https://redd.it/1k3hcnp
Are there any startups that use flask on the backend and react on the frontend?

Was wondering if this stack along with db and other tech needed as I go would suffice for an mvp of an idea I have. What companies are using flask primarily as their backend? When will it be time to upgrade? How comparable is flask performance in comparison to the alternatives?

/r/flask
https://redd.it/1k3jqdq
Your thoughts on continuation backslashes? Best practices?

I've got sort of a stylistic-conventions question here. I've been trying to eliminate uses of backslashes as line-continuances wherever my lines of code are too long to fit in my preferred width, but sometimes I'm not sure what to do.

For example, instead of writing:

foo = long line of stuff + \
more stuff + \
yay more stuff

Python lets us write:

foo = (long line of stuff +
more stuff +
yay more stuff)

or:

foo = (
long line of stuff +
more stuff +
yay more stuff
)

so I've been trying to do that, per PEP 8 recommendations, and the parentheses trick works for all sorts of expressions from summations to concatenated string literals to ternary operators.

But what if something is just a simple assignment that's too

/r/Python
https://redd.it/1k376gg
Live Website Deployment

I'm doing a chatbot for a certain hackathon, and they said they want the site live. So I fully developed it alone using, Bootstrap, CSS, JavaScript, Python and of course HTML. Its working on my machine fine, using a MySQL local server, and everything is working properly with each other. Integration is fine. My question is how do I deploy this website. I've never done anything of the sort before, outside of a simple static github page. Please HELP.

/r/flask
https://redd.it/1k3oqlu
GhostHub – Flask media server with real-time chat, swipe nav, and one-click sharing

GhostHub is a self-hosted, mobile-first media server built with Flask. It’s designed to be super easy to spin up, either via Docker or a standalone Windows .exe, with no account system, database, or config files needed.

What It Does

You point it at a media folder and go. It gives you:

• A TikTok-style swipe interface for browsing media
• Real-time chat via WebSockets
• Optional sync mode (the host controls what’s being viewed)
• Lazy loading, intelligent caching, and smooth performance even on mobile

Great for quickly sharing a folder with friends via Cloudflare Tunnel or LAN, especially on mobile.

Target Audience

This isn’t meant for production — it’s more of a “boot it, use it, lose it” tool. Ideal for devs, tinkerers, or anyone who wants to share videos or photos without uploading them to the cloud or managing a heavy server setup.

Comparison

Compared to something like Jellyfin or Plex, GhostHub is:

• Way more lightweight
• Requires zero setup or user accounts
• Built for short-term, throwaway use
• Optimized for mobile and single-user simplicity, not full-featured media libraries

Here’s the repo: https://github.com/BleedingXiko/GhostHub
Feedback, suggestions, or ideas are always welcome.

/r/Python
https://redd.it/1k3t942
The Complete Flask Rest Api Python Guide

Hey, I have made a guide about building rest apis in python with flask, it starts from the basics and covers the crud operations.

In the guide we use Sql with Postgres, and threading is also involved.

I would love to share it in case any one is interested.

The link is: https://youtu.be/QYhxntIScxI?si=6VDCriYEDBjOYzc4

/r/Python
https://redd.it/1k3szln
Computer algebra pkg that handles vector expressions

Do any of the open source computer algebra pkgs handle vector expressions vs instances of specific vectors?..so AxBxC vs [a1,a2,a3\]x[b1, b2, b3\]...so something like this. I've look in sympy, and sagemath..but haven't been able to find anything...

https://preview.redd.it/312t2i8d50we1.png?width=501&format=png&auto=webp&s=7fc4e77301e54e32b8a7394ab4b0f0f31b8e653f




/r/IPython
https://redd.it/1k3o4z2
How do you manage Django Migration in a team

Hello everyone,

How do you manage migration files in your Django project in multiple developers are working in it? How do you manage localcopy, staging copy, pre-prod and production copy of migration files? What is practice do you follow for smooth and streamlined collaborative development?

Thanks in advance.

/r/django
https://redd.it/1k3rdj9
R Unifying Flow Matching and Energy-Based Models for Generative Modeling

Far from the data manifold, samples move along curl-free, optimal transport paths from noise to data. As they approach the data manifold, an entropic energy term guides the system into a Boltzmann equilibrium distribution, explicitly capturing the underlying likelihood structure of the data. We parameterize this dynamic with a single time-independent scalar field, which serves as both a powerful generator and a flexible prior for effective regularization of inverse problems.

Disclaimer: I am one of the authors.

Preprint:
https://arxiv.org/abs/2504.10612

/r/MachineLearning
https://redd.it/1k3l87t
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/1k404cv
Looking for the best structured paid course to master Django — any recommendations?

Hey everyone! I'm looking for a well-structured course that can teach me Django from beginner to advanced level. Any recommendations?
and I will go through the docks but right now I need a structured course that can teach me backend in django.



/r/django
https://redd.it/1k3mfbp
I made a django app to automate video processing & streaming

Hey dear community!

I have been part of you for many years and I am hobbyist django developer originally working as a data engineer.

Recently I shared here that I just made an api with django to automate video processing. This time I made a django app which you can install to your project and just include pretty cool features builtin.

And if you process less than 10gb < month, basically everything is free - forever.

So what it does?

\- If you have a django project and if you are storing your media files on S3 (aws, hetzner or any s3) you are probably aware that it charges you by storage and bandwidth. And also for big files usually the experience for the people streaming it is not very good because it is slow.

The app uses the contentor API and basically after you set it up, it automatically compress your content into web optimized format, size. Creates different resolutions (based on your settings). It also replaces the original file.

It also have a pretty cool feature for uploading large files, which is chunk upload. It is also included.

I really enjoyed building this, I hope you would also enjoy

/r/django
https://redd.it/1k3skn1
glyphx: A Better Alternative to matplotlib.pyplot – Fully SVG-Based and Interactive

What My Project Does

glyphx is a new plotting library that aims to replace matplotlib.pyplot for many use cases
— offering:

• SVG-first rendering: All plots are vector-based and export beautifully.

• Interactive hover tooltips, legends, export buttons, pan/zoom controls.

• Auto-display in Jupyter, CLI, and IDE — no fig.show() needed.

• Colorblind-safe modes, themes, and responsive HTML output.

• Clean default styling, without needing rcParams or tweaking.

• High-level plot() API, with built-in support for:

• line, bar, scatter, pie, donut, histogram, box, heatmap, violin, swarm, count, lmplot, jointplot, pairplot, and more.



Target Audience

• Data scientists and analysts who want fast, beautiful, and responsive plots

• Jupyter users who are tired of matplotlib styling or plt.show() quirks

• Python devs building dashboards or exports without JavaScript

• Anyone who wants a modern replacement for matplotlib.pyplot

Comparison to Existing Tools

• vs matplotlib.pyplot: No boilerplate, no plt.figure(), no fig.tight_layout() — just one line and you’re done.

• vs seaborn: Includes familiar chart types but with better interactivity and export.

• vs plotly / bokeh: No JavaScript required. Outputs are pure SVG+HTML, lightweight and shareable. Yes.

• vs matplotlib + Cairo: glyphx supports native SVG export, plus optional PNG/JPG via cairosvg.



Repo

GitHub: [github.com/kjkoeller/glyphx](https://github.com/kjkoeller/glyphx)

PyPI: [pypi.org/project/glyphx](https://pypi.org/project/glyphx)



Happy to get feedback or ideas — especially if you’ve tried building matplotlib replacements before.

Edit:
Hyperlink URLs

/r/Python
https://redd.it/1k3yoq5
OC Anirra, a self-hosted, anime watchlist, search, and recommendations app

[Release\] Anirra – Self-hosted Anime Watchlist, Search, and Recommendation App with Sonarr/Radarr Integration

I’ve just released Anirra, a fully self-hosted anime watchlist and recommendation app. It's designed for anime fans who want control over their data and tight integration with their media server setup.

The frontend is writen in Nextjs, and the backend writen completely in Python using FastAPI.

# 🔧 What my project does

Watchlist Management – Organize anime into categories: planning, watching, or completed.
Search – Find anime by title or tags using a built-in offline database.
Recommendations – Get suggestions based on your watch history.
Sonarr/Radarr Integration – Add anime or movies directly to your media server from within the app.

# Target Audience

Users looking to keep their data private, and easily add new anime to their media servers.

# Comparison to Existing Tools

MAL, and AniList do exist, but you expose your data to them and they don't hook into your own media servers for ease of use.

# 🔜 Coming Soon

Mobile-friendly UI
Watchlist rating and smarter recommendations
Jellyfin integration for tracking watch progress
Manga tracking and recommendations based off of read manga

Repo: https://github.com/jaypyles/anirra

Let me know if you run into issues or have feature suggestions. Feedback is welcome, as well as pull requests and bug reports.

/r/Python
https://redd.it/1k3zzph
How good is flask(gunicorn) for production

I want to write a simple web app that serves as a form, it’ll accept sensitive personal info from the recipients. Issue is i’ve written flask for mostly personal websites and chatbots nothing too serious. Can flask scale and is it secure? or do I have to learn django?

I am aware that the web server provided with flask isn’t supposed to be used.

/r/flask
https://redd.it/1k3w02f
Settings.py for DRF

RESTFRAMEWORK = {
    "DEFAULT
AUTHENTICATIONCLASSES": (
        "rest
frameworksimplejwt.authentication.JWTAuthentication",
    ),
    "DEFAULT
PERMISSIONCLASSES": [
        "rest
framework.permissions.IsAuthenticated",
    ],
}

SIMPLEJWT = {
    "ACCESS
TOKENLIFETIME": timedelta(
minutes
=30),
    "REFRESH
TOKENLIFETIME": timedelta(
days
=1),
}


I just finished watching TechWithTim's django and react tutorial and am trying to work on my own project. More specifically for these two things above, what does the REST\
FRAMEWORK variable do, and is the SIMPLE_JWT variable how you usually set the lifetimes for the tokens. Thank you!

/r/django
https://redd.it/1k4ansn
Why was multithreading faster than multiprocessing?

I recently wrote a small snippet to read a file using multithreading as well as multiprocessing. I noticed that time taken to read the file using multithreading was less compared to multiprocessing. file was around 2 gb

Multithreading code

import time
import threading

def processchunk(chunk):
# Simulate processing the chunk (replace with your actual logic)
# time.sleep(0.01) # Add a small delay to simulate work
print(chunk) # Or your actual chunk processing

def read
largefilethreaded(filepath, chunksize=2000):
try:
with open(filepath, 'rb') as file:
threads = []
while True:
chunk =
file.read(chunksize)


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