Python Daily – Telegram
Python Daily
2.56K subscribers
1.49K photos
53 videos
2 files
39K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
What if groups are not enough for authorization?

In many cases, just a group doesn't give enough information to decide what a user can do or see.

Let's say I'm creating a site for car sharing. For the sake of simplicity, let's say we have administrators, car owners, and drivers. Administrators can do everything, so I'll just ignore those for now.

For a given car, we have different things that various users can do, and that depends on the relation between the user and the specific car/reservation, for example:

\- only the person who owns the car can edit the schedule for sharing it, and assign drivers to free slots in the schedule

\- everyone can request to reserve a slot in the schedule

\- only the owner of the car and the driver who made a reservation, can cancel that reservation

So we need to know the group someone is in, AND whether they are the owner of the current car, or the driver for the current reservation, etc. That makes the standard permissions framework a bit useless.

In the past I've use django-rules for this, but that seems to be poorly maintained. I was wondering how people in general implement this, do you extend the permissions framework somehow? Is there a best practice

/r/django
https://redd.it/1pj8ew3
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1pjisyw
Python tool to quickly create a nicely animated .gif out of an .stl for communicating ideas wout cad

* **What My Project Does**

takes a 3d model in stl and renders a quick isometric animation about two axes then does a crazy undo thing and loops all nice, just run, select .stl file and boom

* **Target Audience** (e.g., Is it meant for production, just a toy project, etc.

anyone working with 3d models that want to quickly send a visual to a colleague / friend / investor etc.

* **Comparison** (A brief comparison explaining how it differs from existing alternatives.)

I googled around for 5 minutes and it didn't exist in the form I imagined where it just selects a file and plops out a perfectly animated and scaled isometric rotating gif that loops all aesthetically perfectly and yes I did use claude but this is art okay

[https://github.com/adamdevmedia/stl2gif](https://github.com/adamdevmedia/stl2gif)

/r/Python
https://redd.it/1pjklha
Just created a css utility class generator for my admin panel

Features:

* Generates a minified file for CSS utility classes.
* Generates a guide file for quick explaination and for feeding into AI models with as few tokens as possible.
* Compresses with brotli 11 because the main file is massive

[https://github.com/flicksell/css-utils-generator/](https://github.com/flicksell/css-utils-generator/)

Note - since it's something I made for my project, I don't imagine many people being able to use it as-is, but I think this could be an inspiration for something you might build (or vibe code) yourself in an opinionated manner.

/r/Python
https://redd.it/1pk6ij4
Just had the weirdest bug today

My plugin loading system started to hang indefinitely in all my tests randomly during one of my refactors. After a lot of painful stepping through I finally found out the bug was in fact cause by aiohttp which was hanging indefinitely on import for only God knows why. Rebooted my pc and it fixed itself and i couldn't replicate the bug since. Im on python 3.14 with the latest version of aiohttp anyone else had something similar to this happen to them recently? Trying to figure out the cause so it doesn't make my tests shit themselves again wasting debug time

/r/Python
https://redd.it/1pk5hnv
Massive Excel exportation problem

I was assigned to solve a problem with a report. The problem is exporting massive amounts of data without overloading the container's CPU.

My solution was to create a streaming Excel exporter, processing and writing all the data in chunks. The details of my implementation were, first, to use the iterator() method of Django QuerySet to query the data in chunks from the database and then pass it to Pandas Dataframe, apply some transformations and overwrite a temporary file to complete all the data in the report, and finally upload it to a bucket.

This solution works very well, but I would like to know if you know of a better way to solve it.


/r/django
https://redd.it/1pkfzr4
Sveltekit authentication using better-auth and Django

I've been working on a side SaaS project for a couple of days and have reached a point where I'm satisfied with the backend and thinking on creating a Sveltekit front end. I've read a bit on how to setup authentication and a lot of resources mentioned better-auth which offers out of the box support for Sveltekit. However, I went through the documentation and it seems intended to be used as its own authentication backend/frontend, where better-auth saves user credentials and sessions in its own database separate from Django. I spent some time thinking about it and consulted stack overflow as well as ChatGPT and was recommended the following approach:

- Better auth handles all authentication and user registration, and saves credentials in its own database
- Sveltekit receives session token from better-auth as well as a JWT token
- Sveltekit uses the token to add an Authorization header to request made to Django
- Django decodes the JWT token, extracts the user making the request from the token claims, and authorizes the request

I'm not sure if this approach would be valid, since this would mean either having the credentials saved on both the Django db and authentication db/table, or the SaaS users would

/r/djangolearning
https://redd.it/1pkne5h
Manage database sessionsor connections

I have API service using
(Python + MYSQL + SQLAlchemy + Celery workers)


Application starting to see more traffic.
I want to make sure I avoid connection leaks, timeouts, or overloading the DB.

1. How to monitor the connection count properly ?
2. Should every request open/close a DB connection or should I rely on a global connection pool ?
3. Rule of thumb for max connections vs DB instance size ?



Any references , appreciated Thanks

/r/flask
https://redd.it/1pkjdeo
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/1pkd3is
D Interview preparation for research scientist/engineer or Member of Technical staff position for frontier labs

How do people prepare for interviews at frontier labs for research oriented positions or member of techncial staff positions? I am particularly interested in as someone interested in post-training, reinforcement learning, finetuning, etc.

1. ⁠How do you prepare for research aspect of things
2. ⁠How do you prepare for technical parts (coding, leetcode, system design etc)

/r/MachineLearning
https://redd.it/1pkhblb
Open-sourcing my “boring auth” defaults for FastAPI services

What My Project Does

I bundled the auth-related parts we kept re-implementing in FastAPI services into an open-source package so auth stays “boring” (predictable defaults, fewer footguns).

from svc_infra.api.fastapi.auth.add import add_auth_users

add_auth_users(app)


Under the hood it covers the usual “infrastructure” chores (JWT/session patterns, password hashing, OAuth hooks, rate limiting, and related glue).

Project hub/docs: https://nfrax.com
Repo: https://github.com/nfraxlab/svc-infra

Target Audience

- Python devs building production APIs/services with FastAPI.
- Teams who want an opinionated baseline they can override instead of reinventing auth each project.

Comparison

- Vs rolling auth in-house: this packages the boring defaults + integration surface so you don’t keep rebuilding the same flows.
- Vs hosted providers: you can still use hosted auth, but this helps when you want auth in your stack and need consistent plumbing.
- Vs copy-pasting snippets/templates: upgrading a package is usually less error-prone than maintaining many repo forks.

(Companion repos: https://github.com/nfraxlab/ai-infra and https://github.com/nfraxlab/fin-infra)

/r/Python
https://redd.it/1pkto7d
Open-source Flask projects to contribute to?

I’ve been working with Flask for two years, mostly on my own projects, but now I’d like to join a larger project and contribute to the open-source ecosystem.

Do you maintain or know of any projects where I could get some practice?

/r/flask
https://redd.it/1pkajq1
D On the essence of the diffusion model

Hi all, I am learning about diffusion models and want to understand their essence rather than just applications. My initial understanding is that diffusion models can generate a series of new data starting from isotropic Gaussian noise.

I noticed that some instructions describe the inference of the diffusion model as a denoising process, which can be represented as a set of regression tasks. However, I still find it confusing. I want to understand the essence of the diffusion model, but its derivation is rather mathematically heavy. The more abstract summaries would be helpful. Thanks in advance.

/r/MachineLearning
https://redd.it/1pkuoay
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/1pl76y8
D HTTP Anomaly Detection Research ?

I recently worked on a side project of anomaly detection of Malicious HTTP Requests by training only on Benign Samples - with the idea of making a firewall robust against zero day exploits, It involved working on

1. A NLP architecture to learn the semantics and structure of a safe HTTP Request and differ it from malicious requests
2. Re Training the Model on incoming safe data to improve perfomance
3. Domain Generalization across websites not in the test data.

What are the adjacent research areas/papers i can work upon and explore to improve this project ?

and what is the current SOTA of this field ?

/r/MachineLearning
https://redd.it/1pktkx6
VSCode extension that supports jumping to partial definition?

Hello guys, since 6.0 introduced partials, I've been looking for a VSCode extension that support jumping to the partial definition when you press CTRL + click. I've tried both https://marketplace.visualstudio.com/items?itemName=batisteo.vscode-django and https://marketplace.visualstudio.com/items?itemName=almahdi.code-django and I have even submited requests for this feature but these extensions have not been updated in a long tine. Do you guys have any solution for this? These extensions both support "jump to template". What I mean is for example, if you have this line:

return render(request, 'index.html#somepartial', {})

CTRL + clicking the template name would take you to the partial defition. Right now

return render(request, 'index.html', {})

works but adding the '#somepartial' breaks the "jump to template" functionality.

/r/django
https://redd.it/1pl6stj
I kept bouncing between GUI frameworks and Electron, so I tried building something in between

I’ve been trying to build small desktop apps in Python for a while and honestly it was kind of frustrating



Every time I started something new, I ended up in the same place. Either I was fighting with a GUI framework that felt heavy and awkward, or I went with Electron and suddenly a tiny app turned into a huge bundle



What really annoyed me was the result. Apps were big, startup felt slow, and doing anything native always felt harder than it should be. Especially from Python



Sometimes I actually got things working in Python, but it was slow… like, slow as fk. And once native stuff got involved, everything became even more messy.

After going in circles like that for a while, I just stopped looking for the “right” tool and started experimenting on my own. That experiment slowly turned into a small project called TauPy



What surprised me most wasn’t even the tech side, but how it felt to work with it. I can tweak Python code and the window reacts almost immediately. No full rebuilds, no waiting forever.



Starting the app feels fast too. More like running a noscript than launching a full desktop framework.



I’m still very much figuring out where this

/r/Python
https://redd.it/1pl76qm
PyPulsar — a Python-based Electron-like framework for desktop apps

# What My Project Does

**PyPulsar** is an open-source framework for building **cross-platform desktop applications** using **Python for application logic** and **HTML/CSS/JavaScript for the UI**.

It provides an Electron-inspired architecture where a Python “main” process manages the application lifecycle and communicates with a WebView-based renderer responsible for displaying the frontend.

The goal is to make it easy for Python developers to create modern desktop applications without introducing Node.js into the stack.

Repository (early-stage / WIP):
[https://github.com/dannyx-hub/PyPulsar](https://github.com/dannyx-hub/PyPulsar)

# Target Audience

PyPulsar is currently an **early-stage project** and is **not production-ready** yet.

It is primarily intended for:

* Python developers who want to build desktop apps using web technologies
* Hobbyists and open-source contributors interested in framework design
* Developers exploring alternatives to Electron with a Python-first approach

At this stage, the focus is on **architecture, API design, and experimentation**, rather than stability or long-term support guarantees.

# Comparison

PyPulsar is inspired by Electron but differs in several key ways:

* **Electron**: Uses Node.js for the main process and bundles Chromium. **PyPulsar** uses Python as the main runtime and relies on system WebViews instead of shipping a full browser.
* **Tauri**: Focuses on a Rust backend and a minimal binary size. **PyPulsar** targets Python developers who prefer Python over Rust and want a more hackable, noscriptable

/r/Python
https://redd.it/1pl2qso
RenderCV v2.5: Write your CV in YAML, version control it, get pixel-perfect PDFs

TLDR: Check out github.com/rendercv/rendercv

Been a while since the last update here. RenderCV has gotten much better, much more robust, and it's still actively maintained.

## The idea

Separate your content from how it looks. Write what you've done, and let the tool handle typography.

cv:
name: John Doe
email: john@example.com
sections:
experience:
- company: Anthropic
position: ML Engineer
start_date: 2023-01
highlights:
- Built large language models
- Deployed inference pipelines at scale


Run rendercv render John_Doe_CV.yaml, get a pixel-perfect PDF. Consistent spacing. Aligned columns. Nothing out of place. Ever.

## Why engineers love it

It's text. git diff your CV changes. Review them in PRs. Your CV history is your commit history. Use LLMs to help write and refine your content.

Full control over every design detail. Margins, fonts, colors, spacing, alignment; all configurable in YAML.

Real-time preview. Set up live preview in VS Code and watch your PDF update as you type.

JSON Schema autocomplete. VS Code lights

/r/Python
https://redd.it/1plhus1