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
R is Top-K edge selection preserving task-relevant info, or am I reasoning in circles?

I have m modalities with embeddings Hi. I learn edge weights Φij(c, et) for all pairs (just a learned feedforward function based on two embeddings + context), then select Top-K edges by weight and discard the rest.

My thought , Since Φ
ij is learned via gradient descent to maximize task performance, high-weight edges should indicate that modalities i and j are relevant together. So by selecting Top-K, I'm keeping the most useful pairs and discarding irrelevant ones.

Problem: This feels circular.. “Φ is good because we trained it to be good."

Is there a formal way to argue that Top-K selection preserves task-relevant information that doesn't just assume this?

/r/MachineLearning
https://redd.it/1ow7g2u
D Question about self-referential novelty gating

I’ve been wondering about continual learning and noticed that most setups treat “novelty” as a single scalar, usually tied to prediction error or surprise. But in humans, a surprise that feels self-relevant (“this is about me / my situation”) clearly lands differently from a random trivia fact. So I’m wondering if it makes sense to give agents a simple “self-score” for each event and let that bias what gets written into long-term memory.

For example like this a promotion gate I imagined for an episodic memory buffer

effective\\_score = score + alpha \\* self\\_score

if effective\\_score >= SCORE\\_THRESH and dist\\_to\\_neighbors <= RADIUS\\_THRESH:

promote\\_to\\_long\\_term(memory)

Intuitively, this would mean self-relevant surprises are slightly more likely to be preserved and influence future behavior, without just globally increasing the learning rate. Has anyone tried something like this in practice (RL agents, LLM agents with memory, etc.) or seen papers where self-relevance is treated as an explicit signal in the learning rule, rather than just a psychological observation?

/r/MachineLearning
https://redd.it/1ow8587
I want to build and use custom MCP in my Django project. Have any suggestion on this?

I'm working on a project where users can explore the entire database and create dashboards using simple natural language queries. I've already implemented the system of connecting different types of databases like PostgreSQL, MongoDB, SQLite, CSV, Excel, etc., and created a chat model and views for that. It's currently having simple OpenAI calls for the query responses.


Now, I want to connect the databases to chat so that when the user writes the query, it talks to connected chat databases and provide responses based on that.


For this, I want to use the MCP in my project, as the MCP perfectly works with AI.

Does anyone have any experience with a similar situation and can guide me in this?

Thanks in advance to everyone!

/r/django
https://redd.it/1ow0kfw
Google Oauth

I have built an refer based web application and created a JWT and role based session login.....That works brilliantly but when I am trying to integrate google Oauth book my server can't return tokens to Google based users why is that ?

How can I resolve?

Any suggestions?


P.s: Also pls dm if ur a flutter based dev looking forward to connect!!

/r/django
https://redd.it/1owrihr
Accounting + Python

Any accounts here use Python to successfully help/automate their jobs? If so how?

My next question is: do you have to install and IDE on your work computer to have it work? If so, what are the use cases I can sell to my boss to let me install?

/r/Python
https://redd.it/1owedv4
Where do you guys actually find Django work?

I've been working in tech for 6 years, mostly writing, but the technical side, like spinning up VMs and load testing hosting providers, benchmarking performance, that sort of thing.

I just finished a backend program and have some decent projects (e-commerce API, Telegram bot with Celery/Redis, the usual portfolio stuff). I know my way around Django/Python/Docker reasonably well at this point.

But I feel like I'm looking in the wrong places. Where do people actually find this work? Is it all networking? Discord servers? Freelance sites? Should I just be cold emailing companies?

What worked for you?

/r/django
https://redd.it/1owsf7c
Flask vs FastAPI for High CPU and High I/O Bounded Usage

Hello,


I have a scenario where I have heavy CPU load due to ML calls, etc and also I have heavy networking and I/O bound. I tried flask but it's very obvious that with lots of requests, the overhead of threads created by gunicord nonetheless the overhead of thread pool executor will add up latency to request.


FastAPI on the other hand is more complex in terms of how it handles requests as I see it I don't have much control over what happens and is difficult to debug.


I am unware of any extension to both...but my system already build using flask and I am worried that I might selected wrong framework.


Your thoughts?

/r/flask
https://redd.it/1owosst
P I visualized 8,000+ LLM papers using t-SNE — the earliest “LLM-like” one dates back to 2011

I’ve been exploring how research on large language models has evolved over time.

To do that, I collected around 8,000 papers from arXiv, Hugging Face, and OpenAlex, generated text embeddings from their abstracts, and projected them using t-SNE to visualize topic clusters and trends.

The visualization (on awesome-llm-papers.github.io/tsne.html) shows each paper as a point, with clusters emerging for instruction-tuning, retrieval-augmented generation, agents, evaluation, and other areas.

One fun detail — the earliest paper that lands near the “LLM” cluster is “Natural Language Processing (almost) From Scratch” (2011), which already experiments with multitask learning and shared representations.

I’d love feedback on what else could be visualized — maybe color by year, model type, or region of authorship?

/r/MachineLearning
https://redd.it/1owz9g5
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

# Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

## How it Works:

1. Request: Can't find a resource on a particular topic? Ask here!
2. Share: Found something useful? Share it with the community.
3. Review: Give or get opinions on Python resources you've used.

## Guidelines:

Please include the type of resource (e.g., book, video, article) and the topic.
Always be respectful when reviewing someone else's shared resource.

## Example Shares:

1. Book: "Fluent Python" \- Great for understanding Pythonic idioms.
2. Video: Python Data Structures \- Excellent overview of Python's built-in data structures.
3. Article: Understanding Python Decorators \- A deep dive into decorators.

## Example Requests:

1. Looking for: Video tutorials on web scraping with Python.
2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟

/r/Python
https://redd.it/1oxcssf
Best Cheap Hosting for Django/Wagtail CMS Website

Hi everyone,

I’m planning to launch a simple educational website for students in Bangladesh using Django + Wagtail. The site will mainly contain text content and explainer images, so I’m looking for very affordable hosting options that support Django deployments.

I’ve checked PythonAnywhere, Railway, and Render. I also found Contabo VPS, which is extremely cheap, but I’m unsure about their reliability.

Has anyone used Contabo for Django projects? Are they stable in terms of uptime and performance? And are there any other budget-friendly hosting providers you’d recommend?

Thanks in advance for your suggestions!

/r/django
https://redd.it/1owzx8y
Pydantic and the path to enlightenment

TLDR: Until recently, I did not know about pydantic. I started using it - it is great. Just dropping this here in case anyone else benefits :)

I maintain a Python program called *Spectre*, a program for recording signals from supported software-defined radios. Users create configs describing what data to record, and the program uses those configs to do so. This wasn't simple off the bat - we wanted a solution with...

Parameter safety (Individual parameters in the config have to make sense. For example, `X` must always be a non-negative integer, or \`Y\` must be one of some defined options).
Relationship safety (Arbitrary relationships between parameters must hold. For example, X must be divisible by some other parameter, Y).
Flexibility (The system supports different radios with varying hardware constraints. How do we provide developers the means to impose arbitrary constraints in the configs under the same framework?).
Uniformity (Ideally, we'd have a uniform API for users to create any config, and for developers to template them).
Explicit (It should be clear where the configurable parameters are used within the program).
Shared parameters, different defaults (Different radios share configurable parameters, but require different defaults. If I've got ten different configs, I don't want to maintain ten

/r/Python
https://redd.it/1ox9cct
Django e-commerce: Polymorphism vs Multi-Table Inheritance vs Composition for product types - what’s best?

I’m building a Django e-commerce platform with a large taxonomy (many product types) and type-specific fields/properties (e.g., different models for product A, product B, product C, etc.).

I also need to be able to search across all products.

/r/django
https://redd.it/1oxk6s5
The great leap forward: Python 2.7 -> 3.12, Django 1.11 -> 5.2

I would like to thank everyone who gave great advice on doing this upgrade. In the event, it took me about seven hours, with no recourse to AI coding required. The Python 3 version hasn't been pushed into production yet, but I'd estimate it's probably 90% of the way there.

I decided to go for the big push, and I think that worked out. I did take the advice to not go all the way to 3.14. Once I am convinced everything is fully operational, I'll go to 3.13, but I'll hold off on 3.14 for a bit more package support.

Switching package management to \`uv\` helped, as did the small-but-surprisingly-good test suite.

In rough order, the main problems I encountered were:

* bytes and strings. Literals themselves were OK (the code was already all unicode\_literals), but things like hash functions that take bytes were a bit tedious.
* Django API changes. I have to say, love Django to death, but the project's tendency to make "this looks better" breaking changes is not my favorite part of it.
* Django bugs. Well, bug: the \`atomic\` decorator can swallow exceptions. I spent some time tracking down a bytes/string issue because the exception was just \`bad thing happened\`

/r/Python
https://redd.it/1oxhjj7
Kroma: a powerful and simple module for terminal output in Python

*Looking for some feedback on Kroma, my new Python module! Kroma (based on the word "chroma" meaning color) is a modern alternative to libraries like `colorama` and `rich`.*


# What My Project Does

Kroma is a lightweight and powerful library for terminal output in Python. It allows you to set colors, text formatting, and more with ease!

# Target Audience

- Developers wanting to add color to their Python projects' terminal output

# Links

PyPI: https://pypi.org/project/kroma/
Docs: https://www.powerpcfan.xyz/docs/kroma/v2/
GitHub: https://github.com/PowerPCFan/kroma

# Comparison

***"So, why should I give Kroma a try?"***

Kroma has significant advantages over libraries like `colorama`, and Kroma even has features that the very popular and powerful module `rich` lacks, such as:

- Dynamic color manipulation
- Powerful gradient generation
- Built-in color palettes
- Global terminal color scheme management (via palettes)
- Simple, intuitive, lightweight, and focused API

...and more!


# Kroma Showcase

Here are some code snippets showcasing Kroma's features (these snippets—and more—can be found on the docs):

## Complex Multi-Stop Gradients:

You can use Kroma to create complex gradients with multiple color stops.

```python
import kroma

print(kroma.gradient(
"This is a rainbow gradient across the text!",
stops=(
kroma.HTMLColors.RED,
kroma.HTMLColors.ORANGE,


/r/Python
https://redd.it/1oxeb6l
TS/Go --> Python

So I have been familiar with Go & Typescript, Now the thing is in my new job I have to use python and am not profecient in it. It's not like I can't go general programming in python but rather the complete environment for developing robust applications. Any good resource, content creators to check out for understanding the environment?

/r/Python
https://redd.it/1oxnmeq
Oxidized Python/Django packages?

Hey, I’m building own project using Django and many packages use Rust under the hood.

Interesting what people use.

My list of all I’ve used so far:

Django:
- django-minify-html

Logging:
- logly

Web:
- robyn

Database:
- psqlpy

Date time:
- whenever

JSON:
- orjson

Audio:
- sphn

Files:
- opendal

Web server:
- granian
- ferron

Templates:
- minijinja

Code checking:
- ruff

Venv:
- uv

#python #rust

/r/django
https://redd.it/1oxqwd3
UI/UX or Full Stack Web Development ?

What should I learn for a great and secure career?

/r/django
https://redd.it/1oxk6jp
Looking for architecture feedback on a Django multi-vendor marketplace (Stripe Connect, i18n)

Hi folks,

I’m working on a Django-based multi-vendor marketplace platform (vendors, Stripe Connect payouts, i18n, dark Bootstrap UI).

Before I continue adding features, I want to validate the overall *architecture* and make sure I’m not making any big mistakes.

Could someone more experienced with Django architecture share thoughts on:

- project/app structure
- separating vendor logic vs store logic
- the right way to organize Stripe Connect flows
- how to properly structure templates for multi-vendor dashboards
- what would you change before using such a project in production?

If it’s allowed, I can drop the link to the demo / repo in the comments.

Thanks a lot!

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