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
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
snakeHDL: A simple tool for creating digital logic circuits in Python

# What My Project Does

snakeHDL is a new library for creating digital logic circuits in Python with a focus on simplicity and accessibility.

There are two main components to snakeHDL. It's an API for expressing abstract trees of boolean logic, and it's also an optimizing compiler for converting these logic trees into hardware. So far the compiler can output Verilog, VHDL, and dill-pickled Python functions (for unit testing purposes).

You can find the project on GitHub, along with documentation and examples to help you learn how to use it. You can also `$ pip install snakehdl` if you don't want to clone the repo.

I uploaded a demo video to YouTube: https://www.youtube.com/watch?v=SjTPqguMc84

We are going to use snakeHDL to build parts of the Snake Processing Unit, an idea for a Python bytecode interpreter implemented in hardware to serve as a mega-fast Python coprocessor chip.

# Target Audience

I don't think snakeHDL is likely to displace the industry heavyweights for professional circuit design, but if you're a real hardware engineer I'd be interested to hear what you think. Other than that, the project is mainly intended for hackers, makers, and educators to have a quick, simple, and fun way to prototype logic circuits in Python.

# Comparison

There are

/r/Python
https://redd.it/1j0geal
D How do you write math heavy ML papers?

People who published theory ML papers or math heavy papers at ICLR/NeurIPS/ICML, how do you write math heavy papers? What is the strategy to write the method section?

/r/MachineLearning
https://redd.it/1j0efdm
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/1j0m7aq
Python for JS Developer: Recommendations for Learning Path or Resources?

Hello fellow Redditors!

I'm primarily a JavaScript developer with some practical Python experience.

I'd like to refresh my skills, or 'reacquaint' myself, if you will. In short, what project-based learning resources or books would you recommend to get back into Python development?

Thank you very much in advance!

/r/Python
https://redd.it/1j0b0tl
D Visual explanation of "Backpropagation: Differentiation Rules Part 3

Hi,

I previously shared part 1 and part 2 of the post here:

1. Part 1: https://www.reddit.com/r/MachineLearning/comments/1irs3gn/d\_visual\_explanation\_of\_backpropagation/
2. Part 2: https://www.reddit.com/r/MachineLearning/comments/1iy0d47/d\_visual\_explanation\_of\_backpropagation\_forward/

Here is the part 3 where I share how to derive the differentiation rules from scratch using the computation graph.

While learning the backpropagation, I realized that x\^n can be derived from the product rule x1*x2*..*xn where xi(x)=x. I found it quite interesting, hence sharing.

Thanks,

/r/MachineLearning
https://redd.it/1j0ez5y
FanBase-apui released

Just released fanbase-api — an unofficial FanBase API wrapper.

It supports:

Login & token authentication

Fetching user data

Sending private messages

Liking & commenting


The library will keep getting better with more features until it covers everything users need.

GitHub: https://github.com/nfrx1/fanbase-api
Contributions and feedback are welcome.

/r/Python
https://redd.it/1j02hnp
Text-Parable : Text-based Interactive Narrative Game

##What My Project Does
Text Parable is a text-based interactive narrative game. Inspired by The Stanley Parable, this game presents a branching story with multiple endings. Enjoy an engaging narrative experience complete with a typewriter text effect and intuitive arrow-key navigation for making choices.

If you are interested in, try it!

Github : https://github.com/tanczacy-ziemniak/Text-Parable

##Target Audience
It's just a toy project for fun.

##Comparison
It has achievement features?

/r/Python
https://redd.it/1j0uvre
[R] marsopt: Mixed Adaptive Random Search for Optimization

**marsopt** (Mixed Adaptive Random Search for Optimization) is designed to address the challenges of optimizing complex systems with multiple parameter types. The library implements an adaptive random search algorithm that dynamically balances exploration and exploitation through:

* Adaptive noise for efficient parameter space sampling
* Elite selection mechanisms to guide search toward promising regions
* Integrated support for log-scale and categorical parameters
* Flexible objective handling (minimization or maximization)

# Technical Highlights

Our benchmarking shows that marsopt achieves remarkable performance:

**Up to 150× faster** than Optuna's TPE sampler in optimization tasks with 10 floating-point parameters

[timing results](https://preview.redd.it/s4nw6eehq1me1.png?width=4395&format=png&auto=webp&s=2b51adfc1325acf7b410345ec877a18ab562d7ce)

**Consistently top ranks** across standard black-box optimization benchmarks from [SigOpt evalset](https://github.com/sigopt/evalset)

[ranks ](https://preview.redd.it/2ckzh7skq1me1.png?width=4469&format=png&auto=webp&s=a7dda9a23311fab819c672e7df78bc5eb19619b9)

# Comprehensive Variable Support

The library handles the complete spectrum of parameter types required for modern ML pipelines:

* **Continuous variables** (with optional log-scale sampling)
* **Integer variables** (with appropriate neighborhood sampling)
* **Categorical variables** (with intelligent representation)

# Practical ML Application

In our experiments with LightGBM hyperparameter tuning on the California Housing dataset, marsopt showed promising results compared to well-established optimizers like Optuna. The library efficiently handled both simple parameter spaces and more complex scenarios involving different boosting types, regularization parameters, and sampling configurations.

[california housing benchmark optuna tpe vs marsopt](https://preview.redd.it/c6nuabeqq1me1.png?width=4495&format=png&auto=webp&s=2dcdea65a86c7ef39d5b64ad5a322e8ff43011ab)

Using marsopt is straightforward:

from marsopt import Study, Trial
import numpy

/r/MachineLearning
https://redd.it/1j0vsct