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 ABAC implementation - handling fine-grained permissions across API boundaries?

Hey everyone, working on a Django + DRF project where I need to implement attribute-based access control that goes beyond the standard Django permissions model.

Context: I've got a dashboard frontend that needs to conditionally render UI components based on user permissions that are determined server-side. Think stuff like:

Showing/hiding specific tabs or sections based on user attributes + resource properties
Enabling/disabling actions on list items based on ownership, department, or time-based rules
Dynamic form field access based on user role + object state
Right now I'm using Django's built-in permissions for basic CRUD, but I need something more flexible that can handle rules like "users can edit documents they created, but only if the document is in draft status and they're in the same department as the original author."

The challenge: I want to send these permission decisions to the frontend efficiently - probably just bundle them with API responses or have a lightweight endpoint that returns permission maps for specific resources.

I've looked at django-guardian (solid but seems clunky with DRF) and drf-access-policy (looks abandoned?). I'm trying to avoid external services like Keycloak for this.

Question: How are you folks handling ABAC in Django? Are you rolling your own permission classes, extending Django's framework, or using

/r/django
https://redd.it/1mxrf1z
Glyph.Flow: a minimalist project and task manager

**Hey everyone,**

I’ve been working on a project called **Glyph.Flow**, a minimalist workflow manager written in **Python** with [Textual](https://github.com/Textualize/textual) (and Rich).
It’s basically a text-based project/phase/task/subtask manager that runs in the terminal.

[GitHub](https://github.com/daemonic01/Glyph.Flow)

**What My Project Does**
Glyph.Flow is a **text-based workflow manager** written in Python with [Textual](https://github.com/Textualize/textual).
It manages projects hierarchically (Project → Phase → Task → Subtask) and tracks progress as subtasks are marked complete.
Commands are typed like in a little shell, and now defined declaratively through a central **command registry**.
The plan is to build a full **TUI interface** on top of this backend once the CLI core is stable.

**Target Audience**
Right now it’s a **prototype / devlog project**.
It’s not production-ready, but intended for:

* developers who like working inside the terminal,
* folks curious about **Textual/Rich** as a platform for building non-trivial apps,
* anyone who wants a lightweight project/task manager without web/app overhead.

**Comparison**
Most workflow managers are web-based or GUI-driven.

* Compared to **taskwarrior** or **todo.txt**: Glyph.Flow emphasizes **hierarchical structures** (phases, tasks, subtasks) rather than flat task lists.
* Compared to existing **Python CLI tools**: it’s built on Textual, aiming to evolve into a TUI with styled logs, tables, and panels, closer to

/r/Python
https://redd.it/1mxj62r
Looking for ppl to Collaborate with!!!

Hey everyone,

I’ve recently graduated from college and I’m currently working as a Software Engineer in Pune, India. I’m looking to connect with people who’d like to collaborate on projects — both to grow my knowledge and for networking.

If you have any project ideas we could build together, or even if you just want to brainstorm and see where it leads, feel free to DM me!

A little about me:

* Fluent in **Python** 🐍
* Experience with frameworks like **Django**, **FastAPI**, and some **Streamlit**
* Recently started exploring **Django Ninja** for a more Pydantic-style experience

Always excited to learn and work on fun projects with like-minded people.

/r/Python
https://redd.it/1mxvre9
Created E commerce website

/r/flask
https://redd.it/1mx27wa
A Simple TUI SSH Manager

# What My Project Does:

This is a TUI (Terminal User Interface) python app that shows a list of hosts configured from a yaml file and when that host is selected will ssh directly into that host. The goal is SSH Management for those who manage a large number of hosts that you SSH into on a regular basis.

# Target Audience:

* System Administrator's
* DevOps
* ITOps

# Comparison:

I have been searching for a simple to use SSH Manager that runs in the terminal yet I cam across some that don't work or function the way I wanted, and others that are only web-based or use a paid Desktop GUI. So I decided to write my own in python. I wonder if this is beneficial to anyone so maybe I can expand on it?

**Tested & Compatible OS's:** Windows 11, macOS, Linux, FreeBSD and OpenBSD

**GitHub Source Code:** [https://github.com/WMRamadan/sshup-tui](https://github.com/WMRamadan/sshup-tui)

**PyPi Library:** [https://pypi.org/project/sshup/](https://pypi.org/project/sshup/)

/r/Python
https://redd.it/1mxtbt1
D AAAI considered 2nd tier now?

Isn’t AAAI in the same tier as NeurIPS/ICML/ICLR?
ICLR literally has >30% acceptance rate.

/r/MachineLearning
https://redd.it/1mxrt1y
Python devs, what’s the feature you still can’t live without after years of coding?

I’ve been coding in Python for about 4 years now, and even after all this time, I still catch myself appreciating the little things that make it so enjoyable. Clean syntax, readability, and just how “pythonic” solutions often feel! it’s hard to beat.

Some features have become second nature for me, like list comprehensions, enumerate(), and Python’s super flexible dictionaries. But I’m curious what it’s like for others who work with Python daily.

Would love to hear your go-to gems, whether it’s something obvious or a lesser-known trick you can’t live without 👇

/r/Python
https://redd.it/1mxxrvn
Stop refreshing Google Flights - build your own flight price tracker!

In my latest tutorial, I'll show you how to scrape real-time flight data (prices, airlines, layovers, even logos) using Python, Flask, and SerpAPI - all displayed in a simple web app you control.

This is perfect if you:
\- Want the cheapest flights without checking manually every day
\- Are a dev curious about scraping + automation
\- Need a starter project for building a full flight tracker with alerts

Tools: Python, Flask, SerpAPI, Bootstrap
Check the video here: YouTube video

📌 Bonus: In my next video, I'll show you how to add price drop alerts via Telegram/Email

/r/flask
https://redd.it/1my6rd8
I wrote a guide on Layered Reward Architecture (LRA) to fix the "single-reward fallacy" in

I wanted to share a framework for making RLHF more robust, especially for complex systems that chain LLMs, RAG, and tools.

We all know a single scalar reward is brittle. It gets gamed, starves components (like the retriever), and is a nightmare to debug. I call this the "single-reward fallacy."

My post details the **Layered Reward Architecture (LRA)**, which decomposes the reward into a vector of verifiable signals from specialized models and rules. The core idea is to fail fast and reward granularly.

The layers I propose are:

* **Structural:** Is the output format (JSON, code syntax) correct?
* **Task-Specific:** Does it pass unit tests or match a ground truth?
* **Semantic:** Is it factually grounded in the provided context?
* **Behavioral/Safety:** Does it pass safety filters?
* **Qualitative:** Is it helpful and well-written? (The final, expensive check)

In the guide, I cover the architecture, different methods for weighting the layers (including regressing against human labels), and provide code examples for Best-of-N reranking and PPO integration.

Would love to hear how you all are approaching this problem. Are you using multi-objective rewards? How are you handling credit assignment in chained systems?

**Full guide here:**[The Layered Reward Architecture (LRA): A Complete Guide to Multi-Layer, Multi-Model Reward Mechanisms | by Pavan Kunchala | Aug, 2025 | Medium](https://pavankunchalapk.medium.com/the-layered-reward-architecture-lra-a-complete-guide-to-multi-layer-multi-model-reward-631405e1c1af)

**TL;DR:** Single rewards in

/r/Python
https://redd.it/1mydedk
I’m starting a series on Python performance optimizations, Looking for real-world use cases!

Hey everyone,

I’m planning to start a series (not sure yet if it’ll be a blog, video, podcast, or something else) focused on **Python performance**. The idea is to explore concrete ways to:

* Make Python code run faster
* Optimize memory usage
* Reduce infrastructure costs (e.g., cloud bills)

I’d love to base this on **real-world use cases** instead of just micro-benchmarks or contrived examples.

If you’ve ever run into performance issues in Python whether it’s slow scripts, web backends costing too much to run, or anything else I’d really appreciate if you could share your story.

These will serve as case studies for me to propose optimizations, compare approaches, and hopefully make the series valuable for the community.

Thanks in advance for any examples you can provide!

/r/Python
https://redd.it/1my65vc
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/1myh2vu
D How did JAX fare in the post transformer world?

A few years ago, there was a lot of buzz around JAX, with some enthusiasts going as far as saying it would disrupt PyTorch. Every now and then, some big AI lab would release stuff in JAX or a PyTorch dev would write a post about it, and some insightful and inspired discourse would ensue with big prospects. However, chatter and development have considerably quieted down since transformers, large multimodal models, and the ongoing LLM fever. Is it still promising?

Or at least, this is my impression, which I concede might be myopic due to my research and industry needs.

/r/MachineLearning
https://redd.it/1mybwih
I made a MkDocs plugin to embed interactive jupyter notebooks in your docs via jupyterlite.

I made https://github.com/NickCrews/mkdocs-jupyterlite after being disappointed with the existing options for sharing notebooks on my doc site:

\- Binder: sharable, interactive environments. Requires a full docker environment and a remote server. Hosted separately from your docs, so a user has to click away. Takes 30-60 seconds to boot up. Similar to this would be a link to a google colab notebook.

\- mkdocs-jupyter: A MkDocs plugin that embeds static Jupyter notebooks into your MkDocs site. Easy to use, but with the main downside that all the content is static. Users can't play around with the notebook.

\- jupyterlite-sphinx: A Sphinx extension that integrates JupyterLite within your Sphinx docs site. Nearly exactly what I wanted, but I use MkDocs, not sphinx.

I just wanted to share this project here as an FYI. I would love to see people file issues and PRs to make this useful to a larger community!

/r/Python
https://redd.it/1myfkuw
Authorization and Workflow Engine

Hi,


So Authorization takes care of thing where a user can only access certain resources we can make it no access, view only or everything as per business requirement by using custom permission, permit io, django guardian and also by writing inefficient bunch of if else conditions.


My Scenario:

Example : Building a HRMS (Human Resource Management Service) portal

RM = Reporting Manager , AM = Assistant Manager , GM = Group Manager

A employee applies for leave.

Case 1: 1 day leave, RM is available. RM will receive a notification, he can see and approve the leave.

Case 2: 3 Days Leave, RM will approve and post that it will go to AM for approval. Both will be notified.

Case 3: 1 Week Leave, Directly go to GM for approval, RM & AM can't see it even on their end.

Case 4: 1 day leave, RM himself in on vacation, AM will get notification and he can approve.

Case 5: 3 day leave, RM is on leave, GM is available. Directly GM will get notification.

Case 6: 1 leave leave, RM is on leave but before going on leave he assigned someone in his team the power of approving leave, no leave

/r/django
https://redd.it/1mypuqg
Django Email Verification

Hey I tried to implement email verification in django using https://pypi.org/project/Django-Verify-Email/ but the package in the specfied steps is showing as it doesn't exists..any other strategy for email verification?

/r/django
https://redd.it/1myrs86
I got tired of Django project setup, so I built a tool to automate it all

/r/django
https://redd.it/1myuri6
I created a 5 hour free tutorial on creating your own git from scratch using Python

Ever wondered what happens when you run git init, git add, or git commit? In this 5 hour tutorial, we’ll build a minimal version of Git from scratch in Python. By the end, you’ll understand the internals - objects, commits, branches and more because you’ll have written them yourself!

Watch the video here - https://www.youtube.com/watch?v=g2cfjDENSyw

/r/Python
https://redd.it/1myvz9i
need help with comparation values for function to validate closing date

hi guys i've been stuck with this, seems easy but idk what happends

i have this in my serializer, this is a debug i made to varify the type of data

\`\`\`

\[23/Aug/2025 19:29:43\] "GET /vacancies/ HTTP/1.1" 200 13361

<class 'datetime.date'>

<class 'datetime.date'>



def validate\_closing\_date(self, value):



today = timezone.now().date()

print(type(value))

print(type(today))



if value and value <= today:

raise serializers.ValidationError(

"Closing date must be in the future."

)



return value


\`\`\`

and this is the field in my Model

closing_date = models.DateTimeField(
null=True,
blank=True,
help_text="When applications close."
)

```

but the server returns me this error:
TypeError: '<=' not supported between instances of 'datetime.datetime' and 'datetime.date'

idk how to convert the value on my funcition in datetime.datatime or datetime.date

/r/django
https://redd.it/1mz4smi
AsyncFlow: Open-source simulator for async backends (built on SimPy)

Hey r/Python 👋

I’d like to share AsyncFlow, an open-source simulator I’m building to model asynchronous, distributed backends in Python.

# 🔹 What My Project Does

AsyncFlow lets you describe a system topology (client → load balancer → servers → edges) and run discrete-event simulationswith event-loop semantics:

Servers emulate FastAPI+Uvicorn behavior (CPU-bound = blocking, I/O = yields).
Edges simulate network latency, drops, and even chaos events like spikes or outages.
Out-of-the-box metrics: latency distributions (p95/p99), throughput, queues, RAM, concurrent connections.
Input is YAML (validated by Pydantic) or Python objects.

Think of it as a digital twin of a service: you can run “what-if” scenarios in seconds before touching real infra.

# 🔹 Target Audience

Learners: people who want to see what happens in async systems (event loop, blocking vs async tasks, effects of failures).
Educators: use it in teaching distributed systems or Python async programming.
Planners: devs who want a quick, pre-deployment view of capacity, latency, or resilience trade-offs.

Repo: 👉 [
https://github.com/AsyncFlow-Sim/AsyncFlow](https://github.com/AsyncFlow-Sim/AsyncFlow)

I’d love feedback on:

Whether the abstractions (actors, edges, events) feel useful.
Which features/metrics would matter most to you.
Any OSS tips on docs and examples.

Thanks, happy to answer questions! 🚀

/r/Python
https://redd.it/1myuda8
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/1mzbnhm