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
Ai Agents for Django

Hey guys,

I understand most of you here use Langchain and LangGraph for building agents and using them in Django projects. But the problem is Langchain has its own learning curve and it is too much wrapped code on LLMs makes it very heavy.

So in search of a simple tool, I ended up creating my own. I felt, I need a simple tool that should be very much flexible to use wherever I want in django project (Views, Background Tasks, etc) and access to popular LLMs and should be able to switch them easily, So I built a simple pip installable package that can do below

* Define agents with specific roles and instructions
* Assign models to agents (e.g., OpenAI models)
* Equip agents with tools for performing tasks
* Seamlessly orchestrate interactions between multiple agents

# Here are supported Models

* OpenAI
* Grok
* DeepSeek
* Anthropic
* Llama


Please check it out and show some love giving stars and feedback.


[https://github.com/sandeshnaroju/agents\_manager](https://github.com/sandeshnaroju/agents_manager)



/r/django
https://redd.it/1iza51h
Matrixfuncs – A Fast and Flexible Python Package for Matrix Functions

🚀 New Release: matrixfuncs – A Fast and Flexible Python Package for Matrix Functions

Hey everyone,

# Target Audience

I just released a new version of matrixfuncs, a lightweight Python package for computing matrix functions efficiently. The target audiences are researchers and computer scientists. If you work with linear algebra, numerical methods, or recurrence relations, this might be useful for you!

The project is still in beta, but I’ve added an example (examples/many_frequencies.py) that:

Samples a random function and determines the recurrence relation between the sampled points.
Uses matrixfuncs to generate a function that solves the recurrence relation anywhere—including between sampled data points.

📊 Example Plot: Example

# 🔍 Comparison

An equivalent solution could be implemented with scipy.linalg.fractional_matrix_power, but matrixfuncs has two key advantages:

1️⃣ Memory & Speed Optimizations

The library uses a special representation that allows changing the order of function computation and matrix multiplication.
This means in expressions like A @ f(M), you can evaluate @ before computing f(M).
As a result, it requires less memory and scales better if you need to evaluate many functions at the same matrix , since it avoids storing large matrices.

# What My Project Does As Well

Supports Arbitrary Functions

SciPy provides matrix functions for common cases (expm, logm, sqrtm,

/r/Python
https://redd.it/1izf8wd
Ajuda com hospedagem flask + mongo db

galera alguem pode me dizer onde eu consigo hosperdar um site que o back and são esses dois?? to desesperado, sou meio que iniciante e vou ter que entregar meu primeiro freela, alguem pfv se puder me ajudar

/r/flask
https://redd.it/1izgau7
Most Efficient Way To Deploy Flask app on Ubuntu Server

So currently my backend code is done with AWS lambdas, however I have a project in flask that I need to deploy.

Before using python for pretty much everything backend, I used to use PHP at the time (years ago) and it was always easy to just create an ubuntu server instance somewhere and ssh into it to install apache2. After a lil bit of config everything runs pretty smooth.


However with Flask apps going the apache route feels a little less streamlined.

What is currently the smoothest and simplest way to deploy a flask app to a production server running ubuntu server and not using something like Digital Ocean App platform or similar?

/r/flask
https://redd.it/1iy6179
What happened to Python Weekly newsletter?

I used to love Python weekly newsletter, but a few months (?) ago it changed dramatically.

Now it has ads (!), referrals, I apparently have an "account" at something called "beehive". There's X, Facebook and Linkedin social icons, which I can only assume are tracking delivery...

Disappointed. Although the core content seems unchanged, I'm unsubscribing. What happened?

/r/Python
https://redd.it/1izky8q
Django Rest Framework Status

Does anyone know the status of DRF these days? I see the Github repo is still getting commits, but they removed the Issues and Discussion pages (which sucks, because I wanted to look into an issue I was hitting to see if anyone else had hit it). They now have a Google Groups page for support, which seems to be littered with spam.

I'm not sure what's going on, but this is not very reassuring given I just lead an effort to refactor our API to use DRF recently.

/r/django
https://redd.it/1izmvln
I Built a Simple Yet Effective SMS Spam Classifier Without Neural Networks

Hey everyone,

I just wanted to share a project I recently completed for SMS text classification. While everyone seems to be jumping to neural networks for text problems these days, I took a different approach and am pretty happy with the results.

What My Project Does: My SMS classifier distinguishes between legitimate messages ("ham") and spam with high accuracy. It analyzes message content using a combination of natural language processing and custom features designed specifically for SMS spam detection. The model processes text messages and outputs a classification (spam or ham) along with a probability score.

Target Audience: This project is intended for:

Developers looking to implement lightweight spam filtering in messaging applications
Data science students learning about text classification alternatives to neural networks
Anyone interested in practical NLP solutions that don't require extensive computing resources

While it's production-ready in terms of accuracy, it's currently packaged as an educational tool rather than a complete service.

Comparison to Alternatives:

vs. Neural Networks: My approach trains in seconds, not hours, requires far less data (thousands vs. millions of examples), and is completely interpretable
vs. Rule-based Systems: More flexible and generalizable than hard-coded rules, with better ability to handle novel spam patterns
vs. Commercial Solutions: Provides comparable accuracy

/r/Python
https://redd.it/1izepi6
Dependancy hell

So, today I embarked on what I thought was going to be a productive day of coding only to find myself in the middle of a never-ending dependency loop with a widely used object detection API.

I’m talking HOURS of downloading modules, running into errors that shouldn’t even exist in 2025, and debugging code that clearly hasn’t been touched in years. On top of that, the way the module was designed made setting everything up so unnecessarily hard. The whole setup felt like it was designed in the 90s, with no clear documentation or updates, and no one seems to care anymore. After all the hype about AI and machine learning, I was just trying to make something work, and it felt like I was back in 1998 with no docs, no support, and a pile of outdated code that hasn’t been maintained in forever.

Anyone ever felt this frustration?

/r/Python
https://redd.it/1izr0q9
How do you style a Django app?

Hi, I'm a TypeScript dev trying to use Django + HTMX for side projects.

So far I've used Django with DRF.

In the JavaScript world, it was easy to add Tailwind css to React and be off to the races.

What are the go-to options for styling and managing themes in Django and minify the CSS for production.

/r/djangolearning
https://redd.it/1izqql8
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/1izueaz
Spider: Distributed Web Crawler Built with Async Python

Hey everyone,

I'm a junior dev diving into the world of web scraping and distributed systems, and I've built a modern web crawler that I wanted to share. Here’s a quick rundown:

* **What It Does:** It’s a distributed web crawler that fetches, processes, and saves web data using asynchronous Python (aiohttp), Celery for managing tasks, and PostgreSQL for storage. Plus, it comes with a flexible plugin system so you can easily add custom features.
* **Target Audience:** This isn’t just a toy project—it's designed and meant to be used for real-world use. If you're a developer, data engineer, or just curious about scalable web scraping solutions, this might be right up your alley. It’s also a great learning resource if you’re getting started with async programming and distributed architectures.
* **How It Differs:** Unlike many basic crawlers that run in a single thread or block on I/O, my crawler uses asynchronous calls and distributed task management to handle lots of URLs efficiently. Its modular design and plugin architecture make it super flexible compared to more rigid, traditional alternatives.

I’d love to get your thoughts, feedback, or even tips on improving it further! Check out the repo here: [https://github.com/roshanlam/Spider](https://github.com/roshanlam/Spider)

/r/Python
https://redd.it/1izqk1x
Is there an LSP or other tool that works well with pytest?

Is there an LSP server or linter that works well w/ pytest? I'd like for fixtures to not show as "unused" in a test function's params, and to be able to "go to definition" from a used fixture. It would also be nice if I could "go to definition" on a mock.patch string that brings me to the place it was mocked, or show a linter error if the mock string points to something that doesn't exist.

/r/Python
https://redd.it/1izwg6r
django-allauth and django-recaptcha custom form rendering ReCaptchaField as plain text input and no functional ReCAPTCHA

Has anyone encountered this issue trying to get django-allauth and django-recaptcha to play nice together?

Despite various stackoverflow articles suggesting this should work, this form always ends up with no functional reCAPTCHA and instead a plain text form field labelled Captcha.

https://preview.redd.it/4bxgrufxvele1.png?width=858&format=png&auto=webp&s=b88e216b50c9ae5bf47975c1469daf5651ada742

Here's my custom form code as per the django-recaptcha docs [https://github.com/django-recaptcha/django-recaptcha](https://github.com/django-recaptcha/django-recaptcha)

from allauth.account.forms import SignupForm
from django_recaptcha.fields import ReCaptchaField

class CustomSignupForm(SignupForm):
captcha = ReCaptchaField() # tried all widget variations as well

**Relevant dependency versions:**

* Django==5.1.4 (also tried downgrading to 5.0.12 with no luck)
* django-recaptcha==4.0.0
* django-allauth==65.3.1

Happy to provide any additional information necessary. Any help is greatly appreciated.

/r/djangolearning
https://redd.it/1iyfj0z
Django Templates on VsCode


Hi, I've been working with Django on VSCode for a while, but I can't find a good formatter for Django templates (DTL). I tried Prettier, but it messed up the template,. Haven't figured out a solution yet — any recommendations?



/r/django
https://redd.it/1j058xw
Do you remember Django syntax?

Django developers do understand how the line of code works but do they have it in memory perfectly cause even giving a tiny space in the code messes up everything and i will be struggling to figure out what went wrong like it happened recently when i was an image from static files and the actual code was

<img src=“{% static ‘images/test.jpeg’ %}”>

and i entered it as

<img src=“{% static ‘images/test.jpeg’ % }”>

you know have a space after the 2nd “%”. and spent lot of time trying to figure out what went wrong I couldn’t find it out at all. Then i finally figured it out. I didn’t know that spaces mattered a lot in Django, my question is mentioned in the title.

/r/djangolearning
https://redd.it/1ixxr7i
R Training-free Chroma Key Content Generation Diffusion Model

We’re thrilled to announce that our paper “TKG-DM: Training-free Chroma Key Content Generation Diffusion Model” has been accepted for CVPR 2025! 🎉

arXiv: https://arxiv.org/abs/2411.15580



TL;DR: We introduce TKG-DM, a novel training-free diffusion model that optimizes initial noise to generate foreground objects on a chroma key background - without fine-tuning! Or, in other words, you can use pre-trained diffusion models (any) to generate foreground objects (with specific sizes and positions) on monochromatic backgrounds (without fine-tuning) :-)

/r/MachineLearning
https://redd.it/1j00bbs
Introducing AirDoodle – I built an application to make presentations with Hand Gestures! 👌#python

I believe presentations should be seamless, interactive, and futuristic—so I built AirDoodle to make that happen! No clickers, no keyboards—just hand gestures powered by programming. 🖐️

https://youtu.be/vJzXBaDmKYg

/r/Python
https://redd.it/1izzw4t
PyKomodo – Codebase/PDF Processing and Chunking for Python

# 🚀 New Release: PyKomodo – Codebase/PDF Processing and Chunking for Python

Hey everyone,

I just released a new version of PyKomodo, a comprehensive Python package for advanced document processing and intelligent chunking. The target audiences are AI developers, knowledge base creators, data scientists, or basically anyone who needs to chunk stuff.

Features:

Process PDFs or codebases across multiple directories with customizable chunking strategies
Enhance document metadata and provide context-aware processing

# 📊 Example Use Case

PyKomodo processes PDFs, code repositories creating semantically chunks that maintain context while optimizing for retrieval systems.

# 🔍 Comparison

An equivalent solution could be implemented with basic text splitters like Repomix, but PyKomodo has several key advantages:

# 1️⃣ Performance & Flexibility Optimizations

The library uses parallel processing that significantly speeds up document chunking
Adaptive chunk sizing based on content semantics, not just character count
Handles multi-directory processing with configurable ignore patterns and priority rules

# What's New?

Parallel processing with customizable thread count
Improved metadata extraction and summary generation
Chunking for PDF although not yet perfect.
Comprehensive documentation and examples

# 🔗 Check it out:

GitHub: github.com/duriantaco/pykomodo
PyPI: [pypi.org/project/pykomodo](http://pypi.org/project/pykomodo)
Documentation: pykomodo.readthedocs.io

Would love to hear your thoughts—feedback & feature requests are welcome! 🚀

/r/Python
https://redd.it/1j03kbm
Help Needed with fixing indentation error in Flask + Twilio Al Webhook (Python)


Hey everyone, I need some help with a Python Flask app that connects Twilio to OpenAl's GPT-4 for Al-powered phone calls
Pleaaase I feel I'm so close to figuring this out lol

The Problem-
• I keep getting IndentationError: unindent does not match any outer indentation level when running app.py • I suspect there's a mix of tabs and spaces in my file, but I can't figure out where • I tried manually fixing the indentation and even used sed to replace tabs with spaces, but the error is still there

What I Have-
• A Linux system with a Python virtual environment (venv) • A working Twilio account and OpenAl API key • The app.py script (I can share the full code if needed)

What I Need-
Someone to review my script, fix the indentation issue, and ensure it runs correctly. • If needed, help me set up a proper environment (Flask, Twilio API, OpenAl API). • Guide me on best practices for avoiding indentation errors in the future

Would really appreciate anyone willing to help either through text guidance or screen share! Any type of tip helps

/r/flask
https://redd.it/1j03e39