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
Django Foreign Keys nuances(why explicit db_index?), migrations and more

Good Talk, lot to learn

[http://youtube.com/watch?v=l1xi\_yKnhbE](http://youtube.com/watch?v=l1xi_yKnhbE)

/r/django
https://redd.it/1nssddm
Stop uploading your code to sketchy “online obfuscators” like freecodingtools.org

So I googled one of those “free online Python obfuscor things” (say, freecodingtools.org) and oh boy… I have to rant for a minute.

You sell pitch is just “just paste your code in this box and we’ll keep it for you.” Right. Because clearly the best way to keep your intellectual property is to deposit it on a who-knows-what site you’ve never ever known, owned and operated people you’ll never ever meet, with no idea anywhere your source goes. Completely secure.

Even if you think the site will not retain a copy of your code, the real “obfuscation” is going to be farcical. We discuss base64, XOR, hex encoding, perhaps zlib compression, in a few spaghetti exec function calls. This isn’t security, painting and crafts. It can be unwritten anybody who possesses a ten-minute-half-decent Google. But geez, at least it does look menacing from a first glance, doesn’t it?

You actually experience a false sense of security and the true probability of having just opened your complete codebase to a dodgy server somewhere. And if you’re particularly unlucky, they’ll mail back to you a “protected” file that not only includes a delicious little backdoor but also one you’ll eagerly send off to your

/r/Python
https://redd.it/1nstje8
Beginner: How to start a CRM project in Django (forms, reports, PDFs)

Hi all,

I started working in a company to build an internal CRM app, and I'm lost af. I'm using Django, that's why I'm posting here. ¯\\_(ツ)_/¯

First of all, I'm a software development student who usually works with C/C++ and makes simple videogames in his free time with Unity or Godot. A few weeks ago, I was hired to cover a sick leave in a non-dev department of a big company that needs a new reporting system. The interview was weird because I specifically said I had never made this type of software. At first, they promised me that I didn’t need to be the best developer since the person who built the current system used no-code tools and isn’t a “technical developer like me” (in their words). So I accepted. The vibes were nice, and after two hours of confusion, I got a call confirming that I was on the team. A team of one, cuz Im alone. :/

The sick guy was trying to build the successor of the current system with AI, without really knowing what he was doing. I can’t access his code because he refuses to share “his” work. I saw that he used Streamlit, and even

/r/django
https://redd.it/1nspnv8
Any course or resource (free or paid) for an experienced FastAPI dev?

I got hired by as a fullstack dev (5 yoe) at a manufacturing company. I've worked with Python and FastAPI for 3 years but my role has been 70% frontend, 30% backend. This new role will be more backend focused. I've very briefly used Django over 4 years ago so I need a refresher. I was given a 50 dollar stipend to purchase learning material, so are there any suggestions for people like me?

/r/djangolearning
https://redd.it/1nqllun
Doubts about static and templates folder

Hello django people!

I'm new in web development and just started the development of a simple CRM (probably, will use to build my portfolio). For now i'm having this problem: I can't get the static folder of the project to "be found". I can use the CSS code i'm building with common HTML code but not with django jinja.

The current structure of the folder looks like this

myproject/
├── manage.py
├── settings.py
├── urls.py
├── wsgi.py
├── static/
│ ├── css/
│ │ ├── components/
│ │ └── main.css
│ ├── js/
│ └── img/
├── templates/ # Project-level templates
│ └── header.html
│ └── footer.html
├── myapp1/
│ ├── models.py
│ ├── views.py
│ ├── urls.py


/r/django
https://redd.it/1nt8swc
Experienced Django & Software Developer Seeking New Role

Hi everyone,

I’m currently looking for new opportunities related to Django development. I have 5 years of experience with Django (backend) and over 7 years in software development overall.

Beyond Django, I’ve worked with Vue, Nuxt, Golang, PHP (Laravel), PostgreSQL, MongoDB, and more. I also bring DevOps experience, including provisioning AWS (EKS, EC2, S3, CloudFront, Route53), managing Kubernetes, and setting up monitoring tools like Prometheus and Grafana.

If you know of any opportunities, please feel free to reach out at **mcong.1994@gmail.com** — I’ll be happy to share my resume and more details.

Thank you! 🙏



/r/django
https://redd.it/1ntan1x
Celebrating the first corporate sponsor for django-components 🎉

We've got sponsored by Ohne-Makler to reach v1 for django-components and help bring Laravel Livewire on top of django-components.

This means that I will be able to work on django-components full-time for the next \~6-9 months. Dream come true! ❤️

So with that, I invite everyone to give django-components a try. We now also have a Discord server.

For those who don't know, django-components is a frontend framework for Django. It combines the best of both the Django and JS (Vue, React) worlds.

Unlike other libraries, django-components is more of a meta framework - it extends almost every aspect of Django templates:

Richer template syntax
Automatically managing JS / CSS dependencies
Component-level caching
Support for HTMX - Serving HTML either as whole pages or as HTLM fragments
Extension system that allows us to integrate with many other [libraries or tools](https://github.com/orgs/django-components/projects/1/views/1?query=sort%3Aupdated-desc+is%3Aopen&sliceBy%5Bvalue%5D=topic--ext)

There's still lots to build, here's our [roadmap for v1](
https://github.com/orgs/django-components/projects/1/views/1?query=sort%3Aupdated-desc+is%3Aopen&sliceBy%5Bvalue%5D=milestone--v1). Appreciate any feedback / ideas.

This also means I will have the capacity to mentor a few people. So if you're in need of professional experience or just love challenges, this is a project for you. DM me on Discord or email me.

Altho it's a frontend framework, we do have to count references, or

/r/django
https://redd.it/1ntlal8
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/1nt3lqa
Instead jinja using pure python to generate html makes life easier.

Jinja templating becomes unmanagable for complex templating, maybe i am using it wrong. I find it easier to use regular python functions to generate html. And then expose that function to jinja context to use it in a extended template, like {{my_post_renderer()}}.

But remember to use Markup or escape to make safe html.


/r/flask
https://redd.it/1nt1z2e
R No Prompt Left Behind: Exploiting Zero-Variance Prompts in LLM Reinforcement Learning via Entropy-Guided Advantage Shaping

Arxiv: https://arxiv.org/pdf/2509.21880

Huggingface paper: https://huggingface.co/papers/2509.21880

I’ve been working on improving the reasoning abilities of large language models, and I wanted to share something I’m really excited about. Reinforcement Learning with Verifiable Rewards (RLVR) is already a powerful framework, but I noticed a gap: current methods like GRPO only use problems where model responses differ in correctness. They completely ignore the so-called “zero-variance prompts” — cases where all responses receive the same reward.

At first glance, these prompts look useless, but I started wondering if they actually contain valuable learning signals. That led me to develop RL with Zero-Variance Prompts (RL-ZVP). Instead of discarding those prompts, RL-ZVP extracts meaningful feedback from them. It directly rewards correctness and penalizes errors without needing contrasting responses, and it uses token-level entropy to guide the advantage shaping.

We evaluated RL-ZVP on six math reasoning benchmarks, and it delivered some really promising results — up to 8.61 points higher accuracy and 7.77 points higher pass rates compared to GRPO. It also consistently outperformed other baselines that just filter out zero-variance prompts.

I am happy to take comments in this sub and the HuggingFace paper.

/r/MachineLearning
https://redd.it/1ntm0pf
Tuesday Daily Thread: Advanced questions

# Weekly Wednesday Thread: Advanced Questions 🐍

Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.

## How it Works:

1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.

## Guidelines:

* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.

## Recommended Resources:

* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.

## Example Questions:

1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the

/r/Python
https://redd.it/1nty93i
Why would I not use Visual Studio code

I’m doing a college project that wants me to use Mobaxterm for my terminal and WinSCP to transfer files and I’m using a college provided Linux server. In mobaxterm I use a code editor called nedit.

I’ve used VSC on a project before and it was so much easier , and everything was built in one. I told the professor and he said well you could but I think this is better.

I’m confused how this slow multi step process can be better than VSC?

(This is a bioinformatics project using biopython)

/r/Python
https://redd.it/1ntmao7
uv-ship: a CLI tool for shipping with uv

Hello r/Python.
I know, I know, there are several release-bumping tools out there, but none integrate with uv the way I would like them to. They also feel kind of bloated for what I need them to do. I simply wanted to use uv version to update my project metadata, paired with a small pipeline that safeguards the process and ships the changes + version tag to the repo.

If you're curious, please check out **uv-ship**

What My Project Does

>

>preflight checks: guard your release workflow by verifying branch, tags, and a clean working tree before shipping.

>changelog generation: auto-builds changelog sections from commits since the latest tag.

>one-shot release: stage, commit, tag, and push in a single step.

>dry-run mode: preview every action before making changes.

Target Audience 

maintainers of uv-managed projects with strict release workflows.

Comparison
uv-ship is similar in scope to bump-my-version but it integrates with uv out-of-the-box. For example, if you use bump-my-version you need to set up the following workflow:

1. execute version bump with bump-my-version bump minor
2. include a pre-commit hook that runs uv sync
3. tell bump-my-version that pyproject.toml and uv.lock need to be committed
4. create the tag and push it manually

bump-my-version offers automation with pre- and post-commit hooks, but it does not evaluate if the tag is safe to

/r/Python
https://redd.it/1ntnbgn
sparkenforce: Type Annotations & Runtime Schema Validation for PySpark DataFrames

sparkenforce is a PySpark type annotation package that lets you specify and enforce DataFrame schemas using Python type hints.

## What My Project Does

Working with PySpark DataFrames can be frustrating when schemas don’t match what you expect, especially when they lead to runtime errors downstream.

sparkenforce solves this by:

* Adding type annotations for DataFrames (columns + types) using Python type hints.
* Providing a `@validate` decorator to enforce schemas at runtime for function arguments and return values.
* Offering clear error messages when mismatches occur (missing/extra columns, wrong types, etc.).
* Supporting flexible schemas with ..., optional columns, and even custom Python Spark type mappings.

Example:

```
from sparkenforce import validate
from pyspark.sql import DataFrame, functions as fn

@validate
def add_length(df: DataFrame["firstname": str]) -> DataFrame["name": str, "length": int]:
return df.select(
df.firstname.alias("name"),
fn.length("firstname").alias("length")
)
```

If the input DataFrame doesn’t contain "firstname", you’ll get a `DataFrameValidationError` immediately.

## Target Audience

* PySpark developers who want stronger contracts between DataFrame transformations.
* Data engineers maintaining ETL pipelines, where schema changes often breaks stuff.
* Teams that want to make their PySpark code more self-documenting and easier to understand.

## Comparison

* Inspired by [dataenforce](https://github.com/CedricFR/dataenforce) (Pandas-oriented), but extended for PySpark DataFrames.
*

/r/Python
https://redd.it/1nu118l
Would you use a low-code GUI tool to build and publish Django REST API project

Hi,

In the last 2 years, I built 3 web apps using Django REST framework for backend.

I realised that most of the work like defining models, auth, simple CRUD apis are repetitive. Also, having a GUI to do all this can be great to configure, visualise the database models and APIs.

This is how I imagine to use such a GUI based Django REST app generator

Define your project and apps
Define and visualise database models
Configure user auth (from various options like username-password / google / x etc.)
Add basic CRUD APIs by simply defining request response payload structure
Add custom APIs
Publish with CICD

Other benefits would be that the generator will use good quality refactored code keeping SOLID principles in mind.

Would you use such a tool to build Django REST based backend projects?

What other features would you need?



/r/django
https://redd.it/1nu4q5t
Crawlee for Python v1.0 is LIVE!

Hi everyone, our team just launched **Crawlee for Python 🐍** v1.0, an open source web scraping and automation library. We launched the beta version in Aug 2024 here, and got a lot of feedback. With new features like Adaptive crawler, unified storage client system, Impit HTTP client, and a lot of new things, the library is ready for its public launch.

What My Project Does

It's an open-source web scraping and automation library, which provides a unified interface for HTTP and browser-based scraping, using popular libraries like beautifulsoup4 and Playwright under the hood.

Target Audience

The target audience is developers who wants to try a scalable crawling and automation library which offers a suite of features that makes life easier than others. We launched the beta version a year ago, got a lot of feedback, worked on it with help of early adopters and launched Crawlee for Python v1.0.

New features

Unified storage client system: less duplication, better extensibility, and a cleaner developer experience. It also opens the door for the community to build and share their own storage client implementations.
Adaptive Playwright crawler: makes your crawls faster and cheaper, while still allowing you to reliably handle complex, dynamic websites. In practice, you get the best of both worlds: speed on simple

/r/Python
https://redd.it/1nu8tt6
WHAT is wrong with my static files?

Hello, all. I am trying to deploy my django app on Digital Ocean and I am having quite a bit of trouble doing so. I am following the How to Set Up a Scalable Django App with DigitalOcean Managed Databases and Spaces tutorial on the DO website, but I cannot seem to get my static files into my Spaces bucket. I have edited my settings.py file as follows:

AWS_ACCESS_KEY_ID = '<key_id>'

AWS_SECRET_ACCESS_KEY = '<secret_key_id>'

AWS_STORAGE_BUCKET_NAME = '<storage_bucket_name>'

AWS_S3_ENDPOINT_URL = 'https://nyc3.digitaloceanspaces.com'




AWS_S3_OBJECT_PARAMETERS = {

'CacheControl': 'max-age=86400',

}

AWS_LOCATION = 'static'

AWS_DEFAULT_ACL = 'public-read'




#Static files configuration

STATICFILES_STORAGE = '<app_name>.storage_backends.StaticStorage'

#STATICFILES_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

STATIC_URL = f"https://{AWS_STORAGE_BUCKET_NAME}.nyc3.digitaloceanspaces.com/static/"

STATIC_ROOT = 'static/'




With this, when i run the command python manage.py collectstatic, I get the following output:
134 static files copied to '/home/<username>/<project_name>/<project_name>/<project_name>staticfiles' with nothing sent to my spaces bucket on DO. Can anyone see what I am doing wrong?


I have tried removing the STATIC_ROOT = 'static/' line, but that just causes the following error:

django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.

/r/djangolearning
https://redd.it/1ntyz88
Telelog: A high-performance diagnostic & visualization tool for Python, powered by Rust

GitHub Link: https://github.com/vedant-asati03/telelog

# What My Project Does

Telelog is a diagnostic framework for Python with a Rust core. It helps you understand how your code runs, not just what it outputs.

Visualizes Code Flow: Automatically generates flowcharts and timelines from your code's execution.
High-Performance: 5-8x faster than the built-in logging module.
Built-in Profiling: Find bottlenecks easily with `with logger.profile():`.
Smart Context: Adds persistent context (user_id, request_id) to all events.

# Target Audience

Developers debugging complex systems (e.g., data pipelines, state machines).
Engineers building performance-sensitive applications.
Anyone who wants to visually understand and document their code's logic.

# Comparison (vs. built-in logging)

Scope: logging is for text records. Telelog is an instrumentation framework with profiling & visualization.
Visualization: Telelog's automatic diagram generation is a unique feature.
Performance: Telelog's Rust core offers a significant speed advantage.

/r/Python
https://redd.it/1nu9n4l
What's the best approach to send mails at 1 day, 5 hours, 30 min, 15 min and 5 minutes before the scheduled time?

Hey everyone, I am working in a project and I want to send mails before the scheduled time.... But the issue is if I run the task every minute it will unnecessarily run if there is no meeting scheduled...
Suggest some approaches if you have ever encountered something like this.

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