Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels
django-components v0.135 - Defaults, Vue-like class and style attributes, and extensions
Hey, I haven't shared updates on django-components in some time (last was on v0.122). Lots of new things! Some highlights:
\- Extensions \- Hook into component lifecycle, pre-/post-process components, add custom URLs, or custom commands.
\- Performance improvements (see 0.128 and 0.126) - 5x perf gain with Rust. Components can now be infinitely nested. Also, we now actively track performance of each release, see here. The aim is to get it to at least as fast as vanilla Django templates.
\- Add defaults to your components.
\- The {% html\_attrs %} tag allows you to manage class and style attributes with same granularity as seen in Vue.
\- Tests for your components are now easy to write with \``@djc_test`\` decorator. It ensures that all the internal state is reset after the test is done.
\- More debugging tools, such as to highlight components and / or slots in the UI
\- When using template tags from django-components, like `{% component %}
`, our tags have extra nicities, such as allowing you to define literal lists and dictionaries when writing an input for a component. You too can write template tags with these extra features, with \``@template_tag`\` decorator, or by subclassing from \``BaseNode`\`
/r/django
https://redd.it/1jo52ef
D Monthly Who's Hiring and Who wants to be Hired?
For Job Postings please use this template
>Hiring: [Location\], Salary:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] and [Brief overview, what you're looking for\]
For Those looking for jobs please use this template
>Want to be Hired: [Location\], Salary Expectation:[\], [Remote | Relocation\], [Full Time | Contract | Part Time\] Resume: [Link to resume\] and [Brief overview, what you're looking for\]
​
Please remember that this community is geared towards those with experience.
/r/MachineLearning
https://redd.it/1jnt4sp
Remote control with terminal client
Hi, created Python packages indipydriver and indipyterm which provide classes to interface with your own Python code controlling instruments, GPIO pins etc., and serves this data on a port. Indipyterm creates a terminal client which can then view and control the instrument, useful for headless raspberry pis or similar devices. Available on Pypi, and more info at
[readthedocs](https://indipydriver.readthedocs.io) and source at [github](https://github.com/bernie-skipole/indipydriver)
Terminal screenshot at
https://indipydriver.readthedocs.io/en/latest/_images/image2.png
/r/Python
https://redd.it/1jnysrb
PyAwaitable 2.0.0 Released - Call Asynchronous Code From An Extension Module
Hi everyone! I've released PyAwaitable with a major version bump to 2. I completely redesigned how it's distributed, so now it's solely a build time dependency; PyAwaitable doesn't have to be installed at runtime in your C extensions, making it extremely portable.
## What My Project Does
PyAwaitable is a library for using async
/await
with extension modules. Python's C API doesn't provide this by default, so PyAwaitable is pretty much the next best thing!
Anyways, in the past, basically all asynchronous functions have had to be implemented in pure-Python, or use some transpiler like Cython to generate a coroutine object at build time. In general, you can't just write a C function that can be used with await
at a Python level.
PyAwaitable lets you break that barrier; C extensions, without any additional transpilation step, can use PyAwaitable to very easily use async
/await
natively.
## Target audience
I'm targetting anyone who develops C extensions, or anyone who maintains transpilers for C extensions looking to add/improve asynchronous support (for example, mypyc
).
## Comparison
There basically isn't any other library like PyAwaitable that I know of. If you look up anything along the lines of "Using async in Python's C API," you get led to some of my DPO threads
/r/Python
https://redd.it/1jnl2e8
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/1jnqc6n
the backend doesn't support altering from IntegerField to AutoField.
Hello everybody.
I'm having issues with my models.py. I inherited a codebase from a few years ago which uses varios IntegerFields for its Primary Key.
At first it was fine but later on it started causing issues where it won't save rows properly, making me want to change the field to an Autofield as it should have been.
I'm using MSSQL where I can't alter into Autofields. I found a workaround where I delete the column from the id for 1 migration and recreate it, but it is very clunky as it deletes the values from the db and if the column is used as a foreign key elsewhere it becomes even clunkier to delete.
Wanted to know if anyone has any advice on how to more efficiently work around this. Preferably without deleting itema from the db.
/r/djangolearning
https://redd.it/1jlwp74
D Why is table extraction still not solved by modern multimodal models?
There is a lot of hype around multimodal models, such as Qwen 2.5 VL or Omni, GOT, SmolDocling, etc. I would like to know if others made a similar experience in practice: While they can do impressive things, they still struggle with table extraction, in cases which are straight-forward for humans.
Attached is a simple example, all I need is a reconstruction of the table as a flat CSV, preserving empty all empty cells correctly. Which open source model is able to do that?
https://preview.redd.it/krox7ytlhvre1.png?width=1650&format=png&auto=webp&s=5daa7f68f4acc55f4bdac3b2defa21b9ebfae0d9
/r/MachineLearning
https://redd.it/1jnjfaq
Unable to retrieve POST parameters from request. Getting None for the value.
I am trying to pass some params in a request body via post. This is what the client side code looks like:
const getCSRFToken = () => {
const cookies = document.cookie.split(";");
let csrfToken = cookies.find((ck) =>
ck.trim().startsWith("csrftoken=")
);
return decodeURIComponent(csrfToken.trim().substring(10));
};
/r/djangolearning
https://redd.it/1jm672l
iommi 7.12 released
The biggest new feature since last post is the introduction of `MainMenu`, a really nice system to declare your primary navigation AND manage access to views in the same place: https://docs.iommi.rocks/main_menu.html
* `Table` has a performance improvement that can go up to 20% for rendering the body contents
* Lots of fixes for the iommi admin
* And the usual cornucopia of small bug fixes
/r/django
https://redd.it/1jnexb2
Retto Social: Social network for modern web!
Hello friends, I'm Ekin. My journey started in 2019, and since then, I've been developing web applications with Python and Django while contributing to the free software community. Today, I want to introduce you to my latest and biggest project: Retto.
Retto is a social media platform built with a strong focus on anonymity and privacy. On Retto, you can share posts, follow discussions through groups, create forum threads on the community page, and even play mini-games (games will be added later). Although the platform is still in development, you can sign up now and be part of the growth of free software.
Our ultimate goal is to build a truly free social media platform, breaking away from the oppressive nature of big platforms like Instagram, Twitter, and more...
Platform: https://retto.social
GitHub Link: https://github.com/rettomedia/social
To contribute to Retto's development, you can reach out to me by posting in the Retto Help Center
/r/djangolearning
https://redd.it/1jnbd9e
I made airDrop2 with 3.11.3 and Flask.
What My Project Does:
iLocalShare is a simple, no-frills local file-sharing server built with Python 3.11.3 and Flask. It lets you share files between Windows and iOS devices using just a browser—no extra apps needed. It works in two modes: open access (no password) or secure (password-protected).
Target Audience:
This project is perfect for anyone who needs to quickly transfer files between their PC and iOS device without using Apple’s tools or dealing with clunky cloud services. It’s not meant for production environments, but it’s a great quick and dirty solution for personal use.
Comparison:
Unlike AirDrop, iLocalShare doesn't require any additional apps or device-specific software. It’s a lightweight solution that uses your local network, meaning it won’t rely on Apple’s ecosystem. Plus, it’s open-source, so you can tweak it as you like.
Check it out here!
/r/Python
https://redd.it/1jn7ohc
Django site for my two grandkids.
https://preview.redd.it/m9e0077zpkre1.png?width=4089&format=png&auto=webp&s=10a2753a81a56fe437bec972134bd65d7ba16876
/r/django
https://redd.it/1jmgbit
Help with Flask, Celery, Azure-Identity
Hello I am currently trying to setup an application that will authenticate users using Azure-Identity, then in a Celery Task I would like to make API calls to Azure using their bearer token.
This has taken me weeks of headaches and I have been so close so many times I just have not figured out how to correctly complete this.
/r/flask
https://redd.it/1jldagb
Sunday Daily Thread: What's everyone working on this week?
# Weekly Thread: What's Everyone Working On This Week? 🛠️
Hello /r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!
## How it Works:
1. Show & Tell: Share your current projects, completed works, or future ideas.
2. Discuss: Get feedback, find collaborators, or just chat about your project.
3. Inspire: Your project might inspire someone else, just as you might get inspired here.
## Guidelines:
Feel free to include as many details as you'd like. Code snippets, screenshots, and links are all welcome.
Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here.
## Example Shares:
1. Machine Learning Model: Working on a ML model to predict stock prices. Just cracked a 90% accuracy rate!
2. Web Scraping: Built a script to scrape and analyze news articles. It's helped me understand media bias better.
3. Automation: Automated my home lighting with Python and Raspberry Pi. My life has never been easier!
Let's build and grow together! Share your journey and learn from others. Happy coding! 🌟
/r/Python
https://redd.it/1jmzwh4
CSRF Protect not working in Flask
I have been trying to write a login page in Vue.JS and flask with CSRFProtect enabled, I can clearly see the X-CSRFToken header there. However, I am getting a response of that it is missing!
When I remove the CSRFProtect initialization, it works but with it I just the response it is missing, even though in the network tab I can see it being there
https://preview.redd.it/xyhl5mey6mre1.png?width=2015&format=png&auto=webp&s=67f7827a0ce7bf897c400b6cbe719c9e376f700c
https://preview.redd.it/t0oaqzrz6mre1.png?width=324&format=png&auto=webp&s=d24a6e40244e8c201ed0673df6a9f6db06c26415
https://preview.redd.it/jffl3ri17mre1.png?width=625&format=png&auto=webp&s=9268c5531387f4ba0ad5ec23976cee65c5658145
I even tried different names of the header with no luck
/r/flask
https://redd.it/1jmkacp
I built xlwings Lite as an alternative to Python in Excel
Hi all! I've previously written about why I wasn't a big fan of Microsoft's "Python in Excel" solution for using Python with Excel, see the [Reddit discussion](https://www.reddit.com/r/Python/comments/1de2hkw/my_thoughts_on_python_in_excel). Instead of just complaining, I have now published the "xlwings Lite" add-in, which you can install for free for both personal and commercial use via [Excel's add-in store](https://appsource.microsoft.com/en-us/product/office/wa200008175?tab=overview). I have made a [video walkthrough](https://youtu.be/amCCEbJ39W8?si=3vmVEZUr6RA0-IgS), or you can check out the [documentation](https://lite.xlwings.org/).
xlwings Lite allows analysts, engineers, and other advanced Excel users to program their custom functions ("UDFs") and automation scripts ("macros") in Python instead of VBA. Unlike the classic [open-source xlwings](https://github.com/xlwings/xlwings), it does not require a local Python installation and stores the Python code inside Excel for easy distribution. So the only requirement is to have the xlwings Lite add-in installed.
So what are the main differences from Microsoft's Python in Excel (PiE) solution?
* PiE runs in the cloud, xlwings Lite runs locally (via Pyodide/WebAssembly), respecting your privacy
* PiE has no access to the excel object model, xlwings Lite does have access, allowing you to insert new sheets, format data as an Excel table, set the color of a cell, etc.
* PiE turns Excel cells into Jupyter notebook cells and introduces a left to right and top to bottom
/r/Python
https://redd.it/1jnzepx
I have exhausted all my options to deploy my Django App on AWS EB, someone please chip in for help
I have been trying to deploy my Django app for a week now. I tried railway -> was getting errors there. Then moved to AWS. Now i am trying to deploy using EB. I have already set up my RDS. But I am unable to setup EB. I am following w3 tutorial to deploy.
I would really appreciate if someone could connect and help me with this.
/r/django
https://redd.it/1jnywkx
Multiprocessing & Threading guide in python 🚀
Hey, I have made a video which explains about multiprocessing and threading in python and shows a real world practical example, and the difference between using multiprocessing and threading and not.
The link is:
https://youtu.be/BfwQs1sEW7I?si=mSOMIEacUKmpgaQO
This video is not a low level os concurrency and parallelism course but more like a showcase for how concurrency and parallelism can be implemented in python, with straight to point examples and benchmarks to measure the performance differences 📊
/r/Python
https://redd.it/1jnrei1
Building a car service website
Hey everyone,
I’m building a Django app for a car booking service, and I’m trying to design a clean reservation + payment flow that’s flexible and user-friendly.
What I have:
• A Reservation model that holds all key info (vehicle, route, customer, pricing, status, etc.)
• A Rate model that links a vehicle and route (each with one-way and round-trip prices)
• When a user browses the site, they see route/vehicle combinations with prices
What I want to build:
• When a user clicks “Book Now” next to a specific rate (say, SUV from Airport to Hotel):
• They’re taken to a pre-filled reservation form with that vehicle and rate
• They fill in customer info, passenger count, special requests, flight info, etc.
• After submitting, they choose to either:
• Pay now via Stripe
• Save their card and pay later
I’m not using Stripe Checkout directly. Everything is tied to the Reservation object first, and then payment is triggered.
What I’m stuck on:
• What’s the best pattern for pre-filling the reservation form with a specific rate? I did a request.GET.get(‘vehicle_type’) and same for route and rate to get this information but i feel theres a better way
Is there a good way to cleanly separate form logic from payment logic without overcomplicating views?
How should I handle the “save card for later”
/r/django
https://redd.it/1jnw1t2
I have developed a web application with flask web framework, what to do next to make sure the webpage looks richer and effective
This is the first project I have done and I am new here, your advice will be very helpful for this and future projects.
/r/flask
https://redd.it/1jnr4dn
What is the best website to deploy a flask app in 2025
Hey, I'm ready to deploy my first flask app and I'm looking for the best way to deploy it. Do you guys have recommendations for the best/cheapest/simplest way to deploy it in 2025. Here's some specifications about my project:
My website is relatively simple and mostly does requests to public APIs.
I'm expecting about 500-1000 visits per day, but the traffic might grow.
I have a custom domain, so the server provider needs to allow it (PythonAnywhere's free tier won't work).
I'm willing to spend a few dollar (maybe up to 30) per month to host it
I've heard of Pythonanywhere, Vercel, Render and Digitalocean, but I would like to have some of your opinions before I chose one. Also, I'm worried about waking up one day and realizing that someone spammed my website with a bot and caused a crazy bill. So, I was also wondering if some of these hosting providers had built-in protection against that. Thanks!
/r/flask
https://redd.it/1jnqvun
I benchmarked Python's top HTTP clients (requests, httpx, aiohttp, etc.) and open sourced it
Hey folks
I’ve been working on a Python-heavy project that fires off tons of HTTP requests… and I started wondering:
**Which HTTP client should I actually be using?**
So I went looking for up-to-date benchmarks comparing `requests`, `httpx`, `aiohttp`, `urllib3`, and `pycurl`.
And... I found almost nothing. A few GitHub issues, some outdated blog posts, but nothing that benchmarks them all in one place — especially not including TLS handshake timings.
**What My Project Does**
This project benchmarks Python's most popular HTTP libraries — `requests`, `httpx`, `aiohttp`, `urllib3`, and `pycurl` — across key performance metrics like:
* Requests per second
* Total request duration
* Average connection time
* TLS handshake latency (where supported)
It runs each library multiple times with randomized order to minimize bias, logs results to CSV, and provides visualizations with `pandas` \+ `seaborn`.
GitHub repo: 👉 [https://github.com/perodriguezl/python-http-libraries-benchmark](https://github.com/perodriguezl/python-http-libraries-benchmark)
**Target Audience**
This is for developers, backend engineers, researchers or infrastructure teams who:
* Work with high-volume HTTP traffic (APIs, microservices, scrapers)
* Want to understand how different clients behave in real scenarios
* Are curious about TLS overhead or latency under concurrency
It’s production-oriented in that the benchmark simulates realistic usage (not just toy code), and could help you choose the best HTTP client for performance-critical systems.
**Comparison to Existing Alternatives**
I looked around but couldn’t find an open source benchmark
/r/Python
https://redd.it/1jnlrdl
Should I port my BE to Django?
Hi all,
I've been thinking about this for a while, but I'm stills unsure if I can justify the effort it will take.
I have a backend application written in python. I use SQLalchemy, flask rest and a few classes (pure python) that I made for the specifics of my project.
I spent a reasonable amount of time creating a generic DB class that implements similar things as Django (getone, getcreate, ....) and it works nicely. It also manages DB connections to master-replica cluster.
I miss a lot of the functionality of an admin panel..My understanding is that Django offers those built in, which is a great advantage...
The frontend (svelte) consumes API endpoints to Interact with the backend, so I won't be using views or they'll be just JSON responses.
The backend has two main funcionalities. In one hand, a bunch of scripts that work independently feeding info to the DB and the API that produces the info to the frontend.
All that is currently done in flask, which offers too much freedom to organise the code and I think it'll be a problem going forward. I understand Django is more rigid in that aspect.
So, is it worth port it to Django? What would you consider
/r/django
https://redd.it/1jndxt7
Implemented 18 RL Algorithms in a Simpler Way
# What My Project Does
I was learning RL from a long time so I decided to create a comprehensive learning project in a Jupyter Notebook to implement RL Algorithms such as PPO, SAC, A3C and more.
# Target audience
This project is designed for students and researchers who want to gain a clear understanding of RL algorithms in a simplified manner.
# Comparison
My repo has (Theory + Code). When I started learning RL, I found it very difficult to understand what was happening backstage. So this repo does exactly that showing how each algorithm works behind the scenes. This way, we can actually see what is happening. In some repos, I did use the OpenAI Gym library, but most of them have a custom-created grid environment.
# GitHub
Code, documentation, and example can all be found on GitHub:
https://github.com/FareedKhan-dev/all-rl-algorithms
/r/Python
https://redd.it/1jnduby
Guide for CPython
~~Hi everyone, I'd like to have your opinion and guide on CPython. How to start, Which are the docs I should look, Is it really a good idea to learn CPython at the current time?~~
~~I am looking to create Python bindings for a C based library, and there are some current bindings for Python, written in CPython. Please let me know, how to go forward, and what you all think.~~
EDIT: I was confused between CPython and Cython. This is none. What I need help is to write code that can be called via Python intrepretor, but will write in C.
https://github.com/OpenPrinting/pycups
This is the library I want to work on.
/r/Python
https://redd.it/1jn6znc
Self-contained Python scripts with uv
TLDR: You can add uv into the shebang line for a Python script to make it a self-contained executable.
I wrote a blog post about using uv to make a Python script self-contained.
Read about it here: https://blog.dusktreader.dev/2025/03/29/self-contained-python-scripts-with-uv/
/r/Python
https://redd.it/1jmyip9
Running scripts within django
Hi all,
I am trying to build a site where users can manage their stock trades and adjust their trade settings. The problem i am having is trying to figure out how to run a bot that pulls information from their brokerage every second. I have all my models in place but i am unsure of how to set up scripts if they aren’t django apps, models, views or templates. I guess my question is where would i put this script? How can i have it run every second within my django app?
Please be kind, Thanks in advance!
/r/django
https://redd.it/1jmun7b
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/1jm9hdd
How do Flask sessions behavior vary in different browsers?
I was watching a cs50 lecture on flask and Professor David Malin discussed about how sessions work and said that they vary depending on browser. I know that this question seems a bit all over the place but what are some good practices to ensure over sessions work properly. Thanks!
/r/flask
https://redd.it/1jlhf8p
Question
What’s the difference between Jupyter and another code editor like Vscode? I’ve been using Vscode, and briefly looked at jupyter but I don’t understand what advantages jupyter has over Vscode or other editors
/r/IPython
https://redd.it/1jjo3kz