Daily Python News Question, Tips and Tricks, Best Practices on Python Programming Language Find more reddit channels over at @r_channels
🎉 Update on django-lastdayofmonth integration
Hi everyone!
I recently released **django-lastdayofmonth v1.1.0**, officially tested with **Django 3.2 – 5.2** and **Python 3.10 – 3.12**. The package provides a convenient, database-agnostic ORM function for determining the last day of any month.
The main highlights since the original proposal:
* ✅ **Official Django 5.2 support** (just released!)
* ✅ Simplified usage — no longer requires adding to `INSTALLED_APPS`
* ✅ Fully tested and stable across supported Django and Python versions.
📌 **Link to PyPI:**
[https://pypi.org/project/django-lastdayofmonth/](https://pypi.org/project/django-lastdayofmonth/)
📌 **GitHub Repository:**
[https://github.com/nobilebeniamino/django-lastdayofmonth](https://github.com/nobilebeniamino/django-lastdayofmonth)
I'd still love to see this functionality become a core part of Django, making date calculations easier for everyone.
If you find this feature valuable, please consider showing your support by adding a 👍 reaction to the GitHub issue below:
👉 [**Django Issue #38**](https://github.com/django/new-features/issues/38) 👈
Thanks again for your help and support—let's see if we can make Django even better together! 🚀
/r/django
https://redd.it/1lb1tgk
MCPGex - MCP server for finding, testing and refining regex patterns
Hello,
Wanted to showcase my recently published project, MCPGex, which may be of use to many of you that want to find, test, and refine regex patterns with LLMs.
What My Project Does
MCPGex is an MCP server that allows LLMs to test and validate regex patterns against test cases. It provides a systematic way to develop regex patterns by defining or generating expected outcomes and iteratively testing patterns until all requirements are satisfied. LLMs sometimes fail to capture the correct regex pattern on the first or even second try, so MCPGex allows them to test their regex patterns out.
Target Audience
MCPGex is for anyone who uses regex patterns and would like to have a quick way to generate regex patterns that work. Instead of searching for regex patterns when you forget them, you can ask to have them generated. Of all the regex tasks given thus far, MCPGex has provided the LLM the ability to successfully get the right pattern.
Comparison
As far as I know, there is nothing similar to MCPGex that allows LLMs to test and refine their generated regex patterns. I may be mistaken, and if I am, feel free to correct me! :)
You can go to the project GitHub page by
/r/Python
https://redd.it/1lav4s8
How do I implement rate limiting?
How do I implement rate limiting in my api? Would I have to use redis?
/r/flask
https://redd.it/1lav24s
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/1lauzll
Django Channels
Hi so i need to implement notifications in my application and I have a few questions about Django channel layer(COuld really use some help here):
1. Does every consumer instance get its own channel layer name ? ( lets say i have 2 websocket URLs mapped to 2 consumers , and every client establishes a connection to both these consumers via the url router )
2. Is the channel layer name uniquely generated only for that specific connection ? and therefore might be different if the same consumer spins up another instance of itself for a connection ?
3. How do i store and access these channel layer names for each user when i need to add them to a group or something . Do i just store them in a database for the duration of the connection and get rid of them after ?
/r/django
https://redd.it/1lak6tk
How do you guys secure your django websites?
recently i was working on a freelance project
i wrote a small function for deleting objects but each time i notice that there's something wrong and it was the lack if security and its driving me crazy that each time i have to implement a new security function
so my question is:
How do you guys implement the security features?
do you create all of the security features at once? or wait the production and user feedback?
https://preview.redd.it/lepcn95y5n6f1.png?width=1360&format=png&auto=webp&s=f59125378d9d256b372ad14c3a9c5dc04791b0de
/r/django
https://redd.it/1la9cc8
Pypp: A Python to C++ transpiler WIP. Gauging interest and open to advice.
I am trying to gauge interest in this project, and I am also open to any advice people want to give. Here is the project github: https://github.com/curtispuetz/pypp
# Pypp (a Python to C++ transpiler)
This project is a work-in-progress. Below you will find sections: The goal, The idea (What My Project Does), How is this possible?, The inspiration (Target Audience), Why not cython, pypy, or Nuitka? (Comparison), and What works today?
## The goal
The primary goal of this project is to make the end-product of your Python projects execute faster.
## What My Project Does
The idea is to transpile your Python project into a C++ cmake project, which can be built and executed much faster, as C/C++ is the fastest high-level language of today.
You will be able to run your code either with the Python interpreter, or by transpiling it to C++ and then building it with cmake. The steps will be something like this:
1. install pypp
2. setup your project with cmd: `pypp init`
3. install any dependencies you want with cmd: `pypp install [name\]` (e.g. pypp install numpy)
4. run your code with the python interpreter with cmd: `python my_file.py`
5. transpile your code to C++ with cmd: `pypp transpile`
6. build the C++ code with
/r/Python
https://redd.it/1laf5ss
WTForms SelectField
https://redd.it/1laauir
@pythondaily
JupyterLite 0.6.0 is released! 🎉
https://blog.jupyter.org/jupyterlite-0-6-0-is-released-b4bc69bfc8f4
/r/IPython
https://redd.it/1l9oup2
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/1la1w5g
Website version of Christopher Manson's 1985 puzzle book, "Maze"
This out of print book was from before my time, but Maze: Solve the World's Most Challenging Puzzle by Christopher Manson was a sort of choose-your-own-adventure book that had a $10,000 prize for whoever solved it first. (No one did; the prize was eventually split up among twelve people who got the closest.)
I created a modern, mobile-friendly web version of the book.
GitHub (with Python source): https://github.com/asweigart/mazewebsite
Website: https://inventwithpython.com/mazewebsite/
Start of the maze: https://inventwithpython.com/mazewebsite/directions.html
There are 45 "rooms" in the maze. I created HTML image maps and gathered the text descriptions into a throwaway Python script that generates the html files for the maze. I didn't want it to rely on a database or backend, just HTML, CSS, and a little Bootstrap to make it mobile-friendly. The Python code is in the git repo.
## What My Project Does
Generates HTML files for a web version of Christopher Manson's 1985 puzzle book, "Maze"
## Target Audience
Anyone can view the output website. The Python code may be of interest to people who have similar one-off projects.
## Comparison
The throwaway script spits out html files, making it easy for me to make updates to all 45 pages at once. It's a one-off project that doesn't use other modules, so it's
/r/Python
https://redd.it/1l9urle
Django 101 - High-Level Overview of Django Project Components
https://www.youtube.com/watch?v=deMO0wIwJis
/r/django
https://redd.it/1l9l2p2
P: I reimplemented all of frontier deep learning from scratch to help you learn
Hey friends, the world needs more serious AI researchers. Many AI/LLM beginners mentioned to me that they learn better from implementations than from papers/math, but existing open-source examples rarely go beyond basic nanoGPT-level demos.
To help bridge the gap, I spent the last two months full-time reimplementing and open-sourcing a self-contained implementation of most modern deep learning techniques from scratch. The result is beyond-nanoGPT, containing 20k+ lines of handcrafted, minimal, and extensively annotated PyTorch code for your educational pleasure.
It contains a clean, working implementation + demo of everything from KV caching to linear attention to diffusion Transformers to AlphaZero to even a minimal coding agent that can make end-to-end PRs autonomously.
I'd love feedback on how to make it more helpful for people interested in transitioning into deep learning research. I will continue to add features and maintain the repo for the foreseeable future. The roaring 2020s are a surreal time to be alive, and we need all hands on deck.
/r/MachineLearning
https://redd.it/1l9lb0c
History of time and date
Hi all
Would anyone be so kind to write some sort of code to get me the results of when the NQ and ES made the daily high or low. The date and time of when this happened. Have a good day
Thank you
/r/Python
https://redd.it/1l9ku4j
What ever happened to "Zope"?!
This is just a question out of curiosity, but back in 1999 I had to work with Python and Zope, as time progressed, I noticed that Zope is hardly if ever mentioned anywhere. Is Zope still being used? Or has it kinda fallen into obscurity? Or has it evolved in to something else ?
/r/Python
https://redd.it/1l9furl
My HDR Photo Maker
https://github.com/Coolythecoder/HDR-Photo-Maker is my repo and converts SDR to HDR.
/r/Python
https://redd.it/1laqarr
I built "Submind" – a beautiful PyQt6 app to batch transcribe and auto-translate subtitles
# What My Project Does
**Submind** is a minimal, modern PyQt6-based desktop app that lets you transcribe audio or video files into `.srt` Subtitles using OpenAI’s Whisper model.
🎧 **Features**:
* Transcribe single or multiple files at once (batch mode)
* Optional auto-translation into another language
* Save the original and translated subtitles separately
* Whisper runs locally (no API key required)
* Clean UI with tabs for single/batch processing
It uses the open-source Whisper model ([https://github.com/openai/whisper](https://github.com/openai/whisper)) and supports common media formats like `.mp3`, `.mp4`, `.wav`, `.mkv`, etc.
# Target Audience
This tool is aimed at:
* Content creators or editors who work with subtitles frequently
* Students or educators needing quick lecture transcription
* Developers who want a clean UI example integrating Whisper
* Anyone looking for a fast, local way to convert media to `.srt`
It’s not yet meant for large-scale production, but it’s a polished MVP with useful features for individuals and small teams.
# Comparison
I didn't see any Qt Apps for Whisper yet. Please comment if you have seen any.
# Try it out
GitHub: [rohankishore/Submind](https://github.com/rohankishore/Submind)
Let me know what you think! I'm open to feature suggestions — I’m considering adding drag-and-drop, speaker labeling, and live waveform preview soon. 😄
/r/Python
https://redd.it/1lap8mz
How do I implement rate limiting?
How do I implement rate limiting? Would I have to use redis?
/r/django
https://redd.it/1lav2ko
I built a modern, AI-powered admin for Django using Next.js & shadcn/ui, and I'm looking for contributors!
https://redd.it/1lau7ln
@pythondaily
[Project] I built an open-source tool to turn handwriting into a font using PyTorch and OpenCV.
I'm excited to share HandFonted, a project I built that uses a Python-powered backend to convert a photo of handwriting into an installable .ttf font file.
**Live Demo:** [https://handfonted.xyz](https://www.google.com/url?sa=E&q=https%3A%2F%2Fhandfonted.xyz)
**GitHub Repo:** [https://github.com/reshamgaire/HandFonted](https://github.com/reshamgaire/HandFonted)
**What My Project Does**
HandFonted is a web application that allows a user to upload a single image of their handwritten alphabet. The backend processes this image, isolates each character, identifies it using a machine learning model, and then generates a fully functional font file (.ttf) that the user can download and install on their computer.
**Target Audience**
This is primarily a portfolio project to demonstrate a full-stack application combining computer vision, ML, and web development. It's meant for:
* **Developers and students** to explore how these different technologies can be integrated.
* **Hobbyists and creatives** who want a fun, free tool to create a personal font without the complexity of professional software.
**How it Differs from Alternatives**
While there are commercial services like Calligraphr, HandFonted differs in a few key ways:
* **No Template Required:** You can write on any plain piece of paper, whereas many alternatives require you to print and fill out a specific template.
* **Fully Free & Open-Source:** There are no premium features or sign-ups. The entire codebase is available on GitHub for anyone to inspect, use, or learn from.
* **AI-Powered Recognition:** It
/r/Python
https://redd.it/1laipn1
open-source portfolio website with Django , TailwindCss & Alphin.js
https://redd.it/1la9u38
@pythondaily
SQLAlchemy just the core - but improved - for no-ORM folks
Project: https://github.com/sayanarijit/sqla-fancy-core
What my project does:
There are plenty of ORMs to choose from in Python world, but not many sql query makers for folks who prefer to stay close to the original SQL syntax, without sacrificing security and code readability. The closest, most mature and most flexible query maker you can find is SQLAlchemy core.
But the syntax of defining tables and making queries has a lot of scope for improvement. For example, the table.c.column syntax is too dynamic, unreadable, and probably has performance impact too. It also doesn’t play along with static type checkers and linting tools.
So here I present one attempt at getting the best out of SQLAlchemy core by changing the way we define tables.
The table factory class it exposes, helps define tables in a way that eliminates the above drawbacks. Moreover, you can subclass it to add your preferred global defaults for columns (e.g. not null as default). Or specify custom column types with consistent naming (e.g. created_at).
Target audience:
Production. For folks who prefer query maker over ORM.
Comparison with other projects:
Piccolo: Tight integration with drivers. Very opinionated. Not as flexible or mature as sqlalchemy core.
Pypika: Doesn’t prevent sql injection by default. Hence can be considered insecure.
Raw queries as strings
/r/Python
https://redd.it/1la4yvk
I can't seem to get the flask app with blueprints. Does anyone know how to fix this?
I have a flask app structured similar to this https://github.com/miguelgrinberg/microblog.
Also instead of microblog.py I just called the file run.py
Here is my file-path in the app in powershell.
(my_env) PS C:\\Users\\user\\Downloads\\myapp
The first picture is myapp folder and files within them.
https://imgur.com/a/OUOtQ5N
The second picture is app folder and files within them though I removed some names because I am working on an original idea
https://imgur.com/a/ZBXGnQr
Also am I correct folder and Should I setup my flask app like https://github.com/miguelgrinberg/microblog ?
Here is myapp/config.py.
https://paste.pythondiscord.com/PEHA
Here is my init.py folder in the app folder.
https://paste.pythondiscord.com/YKAQ
Here is models.py
https://paste.pythondiscord.com/IVRA
myapp/run.py
```py
from app import create_app
app = create_app()
```
Here is what I am using to run the flask app
```
$env:FLASK_DEBUG=1
(some_env) PS C:\\Users\\user\\Downloads\\myapp> $env:FLASK_ENV='dev'
(some_env) PS C:\\Users\\user\\Downloads\\myapp> $env:FLASK_DEBUG=1
(some_env) PS C:\\Users\\user\\Downloads\\myapp> $env:FLASK_APP = "run.py"
(some_env) PS C:\\Users\\user\\Downloads\\myapp> flask run
```
Here is the error and output after I run `flask run`
```py
Usage: flask run [OPTIONS\]
Try 'flask run --help' for help.
Error: While importing 'myapp.app', an ImportError was raised:
Traceback (most recent call last):
File "C:\\Users\\user\\Downloads\\myapp\\my_env\\Lib\\site-packages\\flask\\cli.py", line 245, in locate_app
__import__(module_name)
\~\~\~\~\~\~\~\~\~\~\^\^\^\^\^\^\^\^\^\^\^\^\^
File "C:\\Users\\user\\Downloads\\myapp\\app\\__init__.py", line 17, in <module>
from .models import User
File "C:\\Users\\user\\Downloads\\myapp\\app\\models.py", line 10, in <module>
from ..app import db
ImportError: cannot import name 'db' from partially initialized module 'mylapp.app' (most likely due to
/r/flask
https://redd.it/1la2vuo
Blog: ReThinking Django Template: Part 2
Tired of SVG mess in your Django templates?
My latest post, "ReThinking Django Template: Part 2," dives deep into efficient ways to handle inline SVG icons. From handy packages like heroicons
and dj-svg
to building your own powerful components, I've got solutions to clean up your Django template code and boost reusability.
Ready to make your Django templates much cleaner?
ReThinking Django Template: Part 2
/r/django
https://redd.it/1l9iywe
Productivity Tracker CLI
Hi there!
I've completed a project recently that I would like to share. It is a productivity tracker that allows you to record how much time you spend working on something. Here is a link to it https://github.com/tossik8/tracker.
I made this project because I wanted to improve my time management. Feel free to leave your feedback and I hope some of you find it useful as well!
/r/Python
https://redd.it/1l9re6v
Django statics won't work for admin & drf
Workign on updating my django 4.x to 5.x. I noticed that statics for django admin & drf weren't working.
Solution: Disabled (comment out) django debug toolbar from installed apps and middleware section in settings.py. FYI, I have a local docker compose serving minio s3.
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static"),
os.path.join(BASE_DIR, "media"),
]
# Static files
STATIC_URL = f"{STATIC_URL_BUCKET}/static/" # Or use your public MinIO endpoint
# Media files (user uploads)
MEDIA_URL = "/media/" # Not used for direct serving, but required by Django
/r/django
https://redd.it/1l9xedh
Is using if TYPE_CHECKING
: to type the objects
manager a good practice?
Hey everyone,
To get my linter and IDE (free PyCharm) to recognize the type of the default objects
manager, I'm using this pattern:
# models.py
from typing import TYPE_CHECKING
from django.db import models
if TYPE_CHECKING:
from django.db.models.manager import Manager
class MyModel(models.Model):
# ... fields ...
# is this ok?
if TYPE_CHECKING:
objects: Manager["MyModel"]
I built a fullstack solopreneur project template with free cloud hosting and detailed tutorials
Hey everyone,
I’ve been working on a fullstack template aimed at solo devs or indie hackers who want to build and ship something without spending money on infrastructure. I put a lot of effort into making sure everything works out of the box and included step-by-step guides so you can actually deploy it—even if you’ve never done it before.
What’s in it:
Detailed Tutorials & config template to eploy backend to Vercel and frontend to Cloudflare (both have free tiers)
Supabase for database and auth (also free tier)
Generate frontend client based on backend API
Dashboard with metrics and analytics
User management and role-based access control
Sign up / sign in with OAuth
Task management with full CRUD
Pre-configured dev setup with Docker and hot reload
it’s meant to be used as a quick project starter for app developed by a single person, It followed solid backend/frontend practices, used modern tools (React 19, TypeScript, Tailwind, OpenAPI, etc.), and tried to keep the architecture clean and easy to extend.
frontend is based on this great project called shadcn-admin (https://github.com/satnaing/shadcn-admin)
If you’re trying to build and deploy a real app with no cost, this could be interesting to you. Whether you’re making a SaaS,
/r/Python
https://redd.it/1l9q16q
SimplePyQ - Queueing tasks in Python doesn't have to be complicated
Hey everybody!
I just wanted to share a small library I wrote for some internal tooling that I thought could be useful for the wider community, called SimplePyQ.
The motivation for this was to have something minimalistic and self-contained that could handle basic task queueing without any external dependencies (such as Airflow, Redis, RabbitMQ, Celery, etc) to minimize the time and effort to get that part of a project up and running, so that I could focus on the actual things that I needed.
There's a long list of potential improvements and new features this library could have, so I wanted to get some real feedback from users to see if it's worth spending the time. You can find more information and share your ideas on our GitHub.
Do you have any questions? Ask away!
TL;DR to keep the automod happy
# What My Project Does
It's a minimalistic task queueing library with minimal external dependencies.
# Target Audience
Any kind users, ideally suitable for fast "zero to value" projects.
# Comparison
Much simpler to set up and use compared to Celery. Even more minimalistic with less requirements than RQ.
/r/Python
https://redd.it/1l9frz7
Mastering Modern Time Series Forecasting: A Python Guide to Statistical, ML & Deep Learning Methods
I’ve been working on a Python-focused book called Mastering Modern Time Series Forecasting — written to bridge the gap between theory and practice for time series modeling.
It covers a wide range of methods, from classical models like ARIMA, ETS, Theta, MSTL, TBATS to modern machine learning and deep learning techniques like CatBoost, LightGBM, Transformers, N-BEATS, and TFT.
The focus is on both fundamentals and practical implementation, using tools like statsforecast
, mlforecast
, neuralforecast
, scikit-learn
, statsmodels
, PyTorch
, and Darts
. Topics include handling messy time series data, feature engineering, evaluation, and deployment.
📘 The book is in early release (220+ pages) and growing fast.
📂 A companion GitHub repo is live and code will be added progressively:
🔗 GitHub Repo
I’m publishing the book on Gumroad and LeanPub — links will be in the comments if anyone’s interested.
Open to feedback or discussion — thanks for reading!
/r/Python
https://redd.it/1l9gdhu