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
Looking for advice on a crash course

Hey everyone, I am a hobbyist that hasn't tinkered with django much for about 5+ years. I have previously only made very simple apps like a building directory in the past.

I am looking to create a new application and would like to re-familiarize myself with django and am hoping someone may be able to recommend a course covering the current version. I'm willing to pay for a course (I previously used Jose Portillo's course on udemy).

/r/django
https://redd.it/1mdr8qe
Real‑world ML course with personalized gamified challenges—feedback wanted on structure & format! 🎓

Hi everyone — I've been lurking these subreddits for years and finally wrapped up a course that’s very much inspired by what I’ve learned from this community.

I previously created a Udemy course—but in retrospect it felt too one‑size‑fits‑all and lacked engagement. Feedback showed that it wasn’t personalized enough, and students tends to drop off without reaching applied concepts.

So this iteration (on [Uphop.ai](https://www.uphop.ai/app/c/02d00637-0d71-40b3-af0b-ace55c2b6378?code=e12cd)) has been designed from scratch to tackle those issues:

* **Practice games at the end of every unit**, not just quiz questions—scenario-based immersive tasks. It’s true gamification applied to learning design, which literatures show can really boost engagement and performance when tailored to individual user preferences.
* **Hyper‑personalized experience**: learners get to pick challenges or paths that suit their goals, pacing, and interests, instead of being forced into a rigid progression.
* **Core modules**: Supervised/Unsupervised Learning, NLP, Deep Learning, AI ethics, Cloud deployments.

I’d love your honest feedback on:

1. Does the idea of challenge-based “games” at the end of modules sound motivating to you?
2. Would a hyper-personalized track (choose‑your‑own‑challenge or order) make a difference in how you'd stick with a course?
3. How balanced does the path from foundations → advanced topics sound? Any parts you’d reorder or expand?

The first unit is completely

/r/Python
https://redd.it/1mdvynt
datatrees & xdatatrees Release: Improved Forward Reference Handling and New XML Field Types

Just released a new version of the `datatrees` and `xdatatrees` libraries with several key updates.

* `datatrees 0.3.6`: An extension for Python `dataclasses`.
* `xdatatrees 0.1.2`: A declarative XML serialization library for `datatrees`.

# Key Changes:

**1. Improved Forward Reference Diagnostics (**`datatrees`**)** Using an undefined forward reference (e.g., `'MyClass'`) no longer results in a generic `NameError`. The library now raises a specific `TypeError` that clearly identifies the unresolved type hint and the class it belongs to, simplifying debugging.

**2. New Field Type:** `TextElement` **(**`xdatatrees`**)** This new field type directly maps a class attribute to a simple XML text element.

* **Example Class:**

​

@xdatatree
class Product:
name: str = xfield(ftype=TextElement)

* **Resulting XML:**
```xml
<product><name>My Product</name></product>

**3. New Field Type:** `TextContent` **(**`xdatatrees`**)** This new field type maps a class attribute to the text content of its parent XML element, which is essential for handling mixed-content XML.

* **Example Class:**

&#8203;

@xdatatree
class Address:
label: str = xfield(ftype=Attribute)


/r/Python
https://redd.it/1mdzcyf
How to encrypt the database?

I've seen many apps say their data is encrypted. I've personally never heard of encryption in django.
How to encrypt the data, (when) is that actually necessary?

/r/django
https://redd.it/1mdysok
Flask - AI-powered Image Search App using OpenAI’s CLIP model - Step by Step!!

https://youtu.be/38LsOFesigg?si=RgTFuHGytW6vEs3t

Learn how to build an AI-powered Image Search App using OpenAI’s CLIP model and Flask — step by step!
This project shows you how to:

Generate embeddings for images using CLIP.
Perform text-to-image search.
Build a Flask web app to search and display similar images.
Run everything on CPU — no GPU required!

GitHub Repo: https://github.com/datageekrj/Flask-Image-Search-YouTube-Tutorial
AI, image search, CLIP model, Python tutorial, Flask tutorial, OpenAI CLIP, image search engine, AI image search, computer vision, machine learning, search engine with AI, Python AI project, beginner AI project, flask AI project, CLIP image search

/r/flask
https://redd.it/1me0i1t
OAuth/API Authorization Redirects to Wrong App - Flask/Strava API

Hey all,

I'm building a small web app with a Flask backend and Vue frontend. I'm trying to use the Strava API for user authentication, but I'm running into a very strange problem.

When a user tries to log in, my Flask backend correctly uses my application's Client ID to build the authorization URL. However, the resulting page is for a completely different app called "Simon's Journey Viz" (with its own name, description, and scopes).

I've double-checked my Client ID/Secret, cleared my browser's cache, and even verified my app.py is loading the correct credentials. I've also found that I can't manage my own Strava API app (I can't delete it or create a new one).

Has anyone seen a similar OAuth/API redirect issue where the wrong application is triggered on the authorization page? Could this be related to a specific Flask configuration or something on the API's server-side?

Any insights or potential solutions would be much appreciated!

Thanks

/r/flask
https://redd.it/1me12p8
Using TailwindCss in django

Hey guys,


Recently I built a project and wanted to use tailwindcss for the frontend because you know it saves time and energy and I thought oh I will just use it in Django templates it can't be that bad right.... oh boy I was wrong. So without further ado here is everything I learned trying to put tailwindcss in Django templates using the https://github.com/MrBin99/django-vite package :)

1. Follow this tutorial for basic setup: https://www.youtube.com/watch?v=wgN04Byqi9c
This tutorial explains everything really well and it came out after the tailwindcss 4 update so it is up to date as well because I had a whole heap of pain trying to understand why nothing was working only to realize I was trying to install an outdated tailwindcss package.


2. Trying to remember to include the three tags(

{% load djangovite %}
<head>
{% vite
hmrclient %}
{% vite
asset '<path to your assets>' %}
</head>

in every single page is an absolute nightmare so Django templating becomes 10x more useful trust me.


3. Django-vite in production is an absolute nightmare because firstly

/r/django
https://redd.it/1me3j8l
Friday Daily Thread: r/Python Meta and Free-Talk Fridays

# Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

## How it Works:

1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

## Guidelines:

All topics should be related to Python or the /r/python community.
Be respectful and follow Reddit's Code of Conduct.

## Example Topics:

1. New Python Release: What do you think about the new features in Python 3.11?
2. Community Events: Any Python meetups or webinars coming up?
3. Learning Resources: Found a great Python tutorial? Share it here!
4. Job Market: How has Python impacted your career?
5. Hot Takes: Got a controversial Python opinion? Let's hear it!
6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟

/r/Python
https://redd.it/1mehndi
Can't deploy Flask application in Render

I'm having trouble trying to deploy my Flask backend in Render. I keep getting the same error:

gunicorn.errors.AppImportError: Failed to find attribute 'app' in 'app'. I had to hide some other information

This is my app.py and it's not inside any other file:

# app.py

from flask import Flask

def createapp():
    app = Flask(name)
    CORS(app)

if name == 'main':
    create
app().run(debug=True, port=5000)

/r/flask
https://redd.it/1menxd3
What are some good projects for resume

I am currently learning django and wanted to know some projects that would be good to be put on my resume
Pls Help Me

/r/django
https://redd.it/1mens9t
Why Python's deepcopy() is surprisingly slow (and better alternatives)

I've been running into performance bottlenecks in the wild where `copy.deepcopy()` was the bottleneck. After digging into it, I discovered that deepcopy can actually be slower than even serializing and deserializing with pickle or json in many cases!

I wrote up my findings on why this happens and some practical alternatives that can give you significant performance improvements: https://www.codeflash.ai/post/why-pythons-deepcopy-can-be-so-slow-and-how-to-avoid-it

**TL;DR:** deepcopy's recursive approach and safety checks create memory overhead that often isn't worth it. The post covers when to use alternatives like shallow copy + manual handling, pickle round-trips, or restructuring your code to avoid copying altogether.

Has anyone else run into this? Curious to hear about other performance gotchas you've discovered in commonly-used Python functions.

/r/Python
https://redd.it/1mehrc0
Just built a Django REST API starter template

Yo, what's up guys! Check out this Django REST API template I built. It's got email verification, JWT auth, and some sweet-looking email templates. You can't log in until you've verified your email, which is pretty neat.

I also added the debug toolbar and browsable API, so setting up a new project is super fast. This thing saves me so much time.

If you're into Django, give it a try. It might save you some time too!

GitHub:https://github.com/Alien501/django-drf-template

/r/djangolearning
https://redd.it/1meq04t
How can i avoid users from accessing the django admin dashboard page when they try to navigate to it using the url in the adress bar

In development users can navigate to my app urls by putting the url manually in the adress bar at the top of the browser what can be a more practical way to prevent normal users from accessing the admin login page?

/r/django
https://redd.it/1mel0pv
Documentation generator for Flask+React apps

Hi folks,

I built a tool that reads your Flask app code (plus React frontend) and automatically generates API and UI documentation from it.

It's called AutoDocAI. You upload a zipped project, and it returns clean Markdown docs for your backend routes and frontend components.

I'd love for flask devs here to give it a try. Especially, against a bit more complex apps that could benefit from docs.

I'd be happy to jump on a zoom* call with eager developers who would be happy to discuss this project along with testing it.

Just zip and upload your Flask+React codebase and upload it. And you'll get a zipped folder with your app's documentation in markdown format.

Appreciate any feedback, bugs, or suggestions. 🙏

Thanks!

*On a free Zoom account but I'll be happy to catch up over any other video conf app.

Update: I'm okay with apps that are not important, but can be valuable from an evaluation perspective. At this stage, I'm only willing to test whether this is effective. If there's a need, I'll build an offline binary that can work with local, Ollama integration too.

/r/flask
https://redd.it/1mermm1
Feedback for an orchestration project

I have a project in mind that I want feedback about.

The project consists:
\- Server with a REST-API
\- Multiple agent with a REST-API

Both REST-API's will be made through flask-restful.

The communication should be initiated by the server through SSL connection and the agent should respond. And what the server will do: asking to execute command like statuses, changing configuration of an specific application and restart the application. The agent does the actual execution.

So the type of data is not realtime, so there is no need to use websockets.

But I can't rap my head around about the following:
\- Is it wise to have multi-agent architecture with REST-api's on both sides or is there a better way?
\- In case of multiple agents that potentially generate a lot of traffic: Should I use a message broker and in what way in case of the REST-API's?
\- What else do I need to take into consideration? (I already thought about authentication and authorization, what is going to be token-based and ACL's)

/r/flask
https://redd.it/1mexvj3
Forget metaclasses; Python’s __init_subclass__ is all you really need

Think you need a metaclass? You probably just need __init_subclass__; Python’s underused subclass hook.

Most people reach for metaclasses when customizing subclass behaviour. But in many cases, __init_subclass__ is exactly what you need; and it’s been built into Python since 3.6.

What is __init_subclass__**?**

It’s a hook that gets automatically called on the base class whenever a new subclass is defined. Think of it like a class-level __init__, but for subclassing; not instancing.

# Why use it?

Validate or register subclasses
Enforce class-level interfaces or attributes
Automatically inject or modify subclass properties
Avoid the complexity of full metaclasses

# Example: Plugin Auto-Registration

class PluginBase:
plugins =

def initsubclass(cls, **kwargs):
super().init
subclass(kwargs)
print(f"Registering: {cls.name}")
PluginBase.plugins.append(cls)

class PluginA(PluginBase): pass
class PluginB(PluginBase): pass

print(PluginBase.plugins)

Output:

Registering: PluginA
Registering: PluginB


/r/Python
https://redd.it/1mevs3i
Need help with venv in vscode

Does anyone have a good tutorial on this ? I made my virtual environment on my desktop started the project and have problem opening the virtual environment in vsc. Do u know what the next step it usually has an option like this in pycharm.

/r/django
https://redd.it/1mf0v3b
Pip 25.2: Resumable Downloads By Default

This week pip 25.2 has been released, it's a small release but the biggest change is resumable downloads, introduced in 25.1, have been enabled by default.

Resumable downloads will retry the download at the point a connection was disconnected within the same install or download command (though not across multiple commands). This has been a long standing feature request for users which have slow and/or unreliable internet, especially now some packages are multi-GB in size.

Richard, one of the pip maintainers, has again done an excellent write up: https://ichard26.github.io/blog/2025/07/whats-new-in-pip-25.2/

The full changelog is here: https://github.com/pypa/pip/blob/main/NEWS.rst#252-2025-07-30

One thing not obvious from either is the upgrade to resolvelib 1.2.0 improves most pathological resolutions significantly, speeding up the time for pip to find a valid resolution for the requirements. There is more work to do here, I will continue to try and find improvements in my spare time.

/r/Python
https://redd.it/1mf0cnh
Flask x SocketIO appears to be buffering socket.emit()'s with a 10 second pause when running on gevent integrated server

So I am trying to make a (relatively small) webapp production ready by moving off of the builtin WSGI server, and am encountering some issues with flask-socketio and gevent integration. I don't have my heart set on this integration, but it was the easiest to implement first, and the issues I'm experiencing feel more like I'm doing something wrong than a failing of the tooling itself.

With gevent installed, the issue I'm having is that while the server logs that messages are being sent as soon as they arrive, the frontend shows them arriving in ~10s bursts. That is to say that the server will log messages emitted in a smooth stream, but the frontend shows no messages, for roughly a 5 to 10 second pause, then shows all of the messages arriving at the same time.

The built-in WSGI sever does not seem to have this issue, messages are sent and arrive as soon as they are logged that they've been sent.

I'm pretty confident I'm simply doing something wrong, but I'm not sure what. What follows is a non-exhaustive story of what I've tried, how things work currently, and where I'm at. I'd like to switch over

/r/flask
https://redd.it/1mf1n3h
MCP-Agent - Python Open Source Framework for building AI agents with native MCP support

Hi r/Python \- I wanted to share something that my team and I built for agent builders using Python.

We've spent the last 6 months working on MCP-Agent \- an open source Python framework for building AI agents using the Model Context Protocol (MCP) for tool calls and structured agent-to-agent communication and orchestration.

Model Context Protocol (MCP) is a protocol that standardizes how LLMs interact with tools, memory, and prompts. This allows you to connect to Slack and Github, which means you can now ask an LLM to summarize all your Github issues, prioritize them by urgency, and post it on Slack.

What does our project do?

MCP-Agent is a developer-friendly, open-source framework for building and orchestrating AI agents with MCP as the core communication protocol. It is a simple but powerful library built with the fundamental building blocks for agentic systems outlined by Anthropic's Building effective agents post.

This makes it easy for Python developers to create workflows like:

Supabase to github typesync agent
Agents with chat-based browser usage
Deep research agents

Target audience

We've designed this library with production in mind, with features like:

Integration into Temporal for long-running agentic workflows
OTEL telemetry to connect to your own observability tools
YAML-based configurations for defining connections

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