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
Programmatically navigate between directories in the file browser pane (JupyterLab)

Hello.

I would like to know if there is a way to programmatically change the folder shown in the file browser pane in JupyterLab?

For context.

I have a directory A and B both of which share a parent 5 folders up.

My notebook that I run is in directory A (and so the file browser pane will be showing the contents of directory A) and as part of the code it produces files that are saved in directory B. I would like there to be a quick way for the users of the notebook to quickly jump to the results folder (directory B) without having to navigate folder by folder to the results. Ideally with a click of a button.

Thank you in advance.

/r/IPython
https://redd.it/1kd6j86
How to Deploy Django Project with tailwind css styling on Render

So , when I locally want to test, first i build Tailwind CSS using the command python `manage.py` tailwind start When Tailwind is built, then on parallel I run python `manage.py` runserver . And that's how I get all the styling of Tailwind classes
The issue I am facing is that I have successfully deployed it on render but the styling is not being applied . What I tried was to use gunicorn to run it on port locally, and tried this:
import os

from django.core.wsgi import get_wsgi_application
from `django.core.management` import call_command

try:
call_command('tailwind', 'start')
except Exception as e:
print(f"Tailwind build failed: {e}")

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'wcp.settings')

application = get_wsgi_application()


import os


from django.core.wsgi import get_wsgi_application
from `django.core.management` import call_command


try:
call_command('tailwind', 'start')
except Exception as e:
print(f"Tailwind build failed: {e}")


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')


application = get_wsgi_application()

But the error is that tailwind is an unknown command. Can you guys help me? I know there

/r/django
https://redd.it/1kctslf
Is there a way to do this

Hello guys hope you are all doing well, i am working on an app that automate the process of cv creation because i am tired on updating my cv by hand each time to match a specific job description , espicially that for a lot of jobs i need to change the template i am using completely , and not only this but probably some freinds gonna use it too. Anyways here how it work , the user chose the templates he want , a form is then submited to the user where he fills his data , a prview of the template is generated then the user can download it if he want , my question is do i need to create a form and a view for each template manually or does anyone have an idea how to make this process dynamic . I hope i explained this well english isn t my first language and thank you in advance :)

/r/django
https://redd.it/1kcv3kn
D Self-Promotion Thread

Please post your personal projects, startups, product placements, collaboration needs, blogs etc.

Please mention the payment and pricing requirements for products and services.

Please do not post link shorteners, link aggregator websites , or auto-subscribe links.

\--

Any abuse of trust will lead to bans.

Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

\--

Meta: This is an experiment. If the community doesnt like this, we will cancel it. This is to encourage those in the community to promote their work by not spamming the main threads.

/r/MachineLearning
https://redd.it/1kcq3du
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/1kdfo8x
I built a PySpark data validation framework to replace PyDeequ — feedback welcome

Hey everyone,
I’d like to share a project I’ve been working on: [**SparkDQ**](https://github.com/sparkdq-community/sparkdq) — an open-source framework for validating data in PySpark.

**What it does:**
SparkDQ helps you validate your data — both at the row level and aggregate level — directly inside your Spark pipelines.
It supports Python-native and declarative configs (e.g. YAML, JSON, or external sources like DynamoDB), with built-in support for fail-fast and quarantine-based validation strategies.

**Target audience:**
This is built for data engineers and analysts working with Spark in production. Whether you're building ETL pipelines or preparing data for ML, SparkDQ is designed to give you full control over your data quality logic — without relying on heavy wrappers.

**Comparison:**

* Fully written in Python
* Row-level visibility with structured error metadata
* Plugin architecture for custom checks
* Zero heavy dependencies (just PySpark + Pydantic)
* Clean separation of valid and invalid data — with built-in handling for quarantining bad records

If you’ve used PyDeequ or struggled with validating Spark data in a Pythonic way, I’d love your feedback — on naming, structure, design, anything.

* [GitHub Repo – SparkDQ](https://github.com/sparkdq-community/sparkdq)
* ✍️ [Medium article – Why I moved beyond PyDeequ](https://medium.com/aws-tip/goodbye-pydeequ-time-to-upgrade-your-data-quality-stack-d86fe9cdc5be)

Thanks for reading!

/r/Python
https://redd.it/1kdgumc
Learned the Basics, Now I’m Broke, HELP

Hey everyone,

I'm a university student who recently completed the basics of Python (I feel pretty confident with the language now), and I also learned C through my university coursework. Since I need a bit of side income to support myself, I started looking into freelancing opportunities. After doing some research, Django seemed like a solid option—it's Python-based, powerful, and in demand.

I started a Django course and was making decent progress, but then my finals came up, and I had to put everything on hold. Now that my exams are over, I have around 15–20 free days before things pick up again, and I'm wondering—should I continue with Django and try to build something that could help me earn a little through freelancing (on platforms like Fiverr or LinkedIn)? Or is there something else that might get me to my goal faster?

Just to clarify—I'm not chasing big money. Even a small side income would be helpful right now while I continue learning and growing. Long-term, my dream is to pursue a master's in Machine Learning and become an ML engineer. I have a huge passion for AI and ML, and I want to build a strong foundation while also being practical

/r/djangolearning
https://redd.it/1kd585m
Flask-Admin error when showing foreign keys: alueError: not enough values to unpack (expected 4, got 3)

Flask 3.1.0
Flask-Admin 1.6.1
Python 3.13.3

I'm trying to use Flask-Admin for CRUD on a table with a foreign key, but when I try to create or edit a row I get the error traceback:


File "...\.venv\Lib\site-packages\wtforms\widgets\core.py", line 374, in call
val, label, selected, renderkw = choice
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 4, got 3)

Here is some minimal example code that replicates the issue:

from flask import Flask, redirect, url
for
from flasksqlalchemy import SQLAlchemy
from flask
admin import Admin
from flaskadmin.contrib.sqla import ModelView


## CONFIG
app = Flask(name)
app.config['SQLALCHEMY
DATABASEURI'] = 'sqlite:///:memory:'
db = SQLAlchemy(app)
admin = Admin(app)


## MODELS
class Manufacturer(db.Model):
id = db.Column(db.Integer, primary
key=True)
name = db.Column(db.String(25))
location = db.Column(db.String(25))
drinks

/r/flask
https://redd.it/1kdj92t
PgQueuer – PostgreSQL-native job & schedule queue, gathering ideas for 1.0 🎯

### What My Project Does
PgQueuer converts any PostgreSQL database into a durable background-job and cron scheduler. It relies on **LISTEN/NOTIFY** for real-time worker wake-ups and `FOR UPDATE SKIP LOCKED` for high-concurrency locking, so you don’t need Redis, RabbitMQ, Celery, or any extra broker.
Everything—jobs, schedules, retries, statistics—lives as rows you can query.

**Highlights since my last post**

* Cron-style recurring jobs (`* * * * *`) with automatic `next_run`
* Heartbeat API to re-queue tasks that die mid-run
* Async **and** sync drivers (asyncpg & psycopg v3) plus a one-command CLI for install / upgrade / live dashboard
* Pluggable executors with back-off helpers
* Zero-downtime schema migrations (`pgqueuer upgrade`)

Source & docs → **https://github.com/janbjorge/pgqueuer**

---

### Target Audience
* Teams already running PostgreSQL who want *one fewer* moving part in production
* Python devs who love `async/await` but need sync compatibility
* Apps on Heroku/Fly.io/Railway or serverless platforms where running Redis isn’t practical

---

### How PgQueuer Stands Out
* **Single-service architecture** – everything runs inside the DB you already use
* **SQL-backed durability** – jobs are ACID rows you can inspect and JOIN
* **Extensible** – swap in your own executor, customise retries, stream metrics from the stats table

---

### I’d Love Your Feedback 🙏
I’m drafting the

/r/Python
https://redd.it/1kd6ci0
AtlasServer-Core — Soon for Django (currently Flask/FastAPI)

Hello Django learners! I’m working on AtlasServer-Core, an open-core admin panel currently supporting Flask & FastAPI, with Django support on the roadmap.

Current features

🔹 Lifecycle: create, start, stop, delete apps
🔹 Ngrok tunnels for public previews
🔹 Basic auth & roles
🔹 Live logging interface

Feel free to explore the code or file issues to guide our Django integration: 👉 https://github.com/AtlasServer-Core/AtlasServer-Core

Thanks for checking it out—your input will help shape the Django support!

/r/djangolearning
https://redd.it/1kdc6xi
🚀 FlaskGuard – Plug-and-Play Firewall for Flask Apps (Open Source)

Hey Flask devs! 👋

I just released **FlaskGuard**, a plug-and-play firewall library for Flask applications. It protects your app from common web vulnerabilities like SQL injection, XSS, path traversal, and more. 🛡️

---

### **What My Project Does:**

FlaskGuard analyzes incoming HTTP requests in real-time and blocks malicious patterns such as SQL injection, XSS, path traversal, command injection, and more. It's designed to act as a security layer for any Flask web app with minimal setup required.

---

### **Target Audience:**

This project is meant for **Flask developers** who are building production-ready applications and want a lightweight but effective first line of defense against common web threats. Whether you're running a small API or a larger web service, FlaskGuard can help secure it.

---

### **Comparison:**

Unlike more complex full-stack WAFs or security middleware that require external setups (like ModSecurity), **FlaskGuard** is built purely in Python, installs via `pip`, and integrates directly with Flask. It requires zero configuration to get started but is fully extensible for advanced users.

---

### **🔒 Features:**

- Detects and blocks malicious requests.
- ⚙️ Configurable rules and whitelisting.
- 🧩 Seamless Flask integration.
- 📄 Logging with color-coded output for quick threat analysis.
- 🧠 Supports detection of common vulnerabilities.

---

### **📦 Installation:**

From PyPI:

```bash
pip install safe-flask
```

From GitHub:

```bash
pip install git+https://github.com/CodeGuardianSOF/FlaskGuard.git
```

---

### **📚 Example Usage:**

```python
from

/r/Python
https://redd.it/1kdq1zy
How go about with modular monolithic architecture

# Hello guys, hope you're doing good

I'm working on an ecommerce site project using fastapi and next-js, so I would like some insides and advice on the architecture. Firstly I was thinking to go with microservice architecture, but I was overwhelmed by it's complexity, so I made some research and found out people suggesting that better to start with modular monolithic, which emphasizes dividing each component into a separate module, but

Couple concerns here:

Communication between modules: If anyone have already build a project using a similar approach then how should modules communicate in a decoupled manner, some have suggested using an even bus instead of rabbitMQ since the architecture is still a monolith.

A simple scenario here, I have a notification module and a user module, so when a new user creates an account the notification should be able to receive the email and sends it in the background.

I've seen how popular this architecture is .NET Ecosystem.

Thank you in advance

/r/Python
https://redd.it/1kdroea
How to shut down a Flask app without killing the process it's in?

I have a separate process to run my Flask app. I'm currently shutting it down by making it so that when a request is made to the /shutdown route, it runs os.kill(os.getpid(), signal.SIGINT like:

def shutdownserver():
    """Helper function for shutdown route"""
    print("Shutting down Flask server...")
    pid = os.getpid()
    assert pid == PID
    os.kill(pid, signal.SIGINT)
@bp.route("/shutdown")
def shutdown():
    """Shutdown the Flask app by mimicking CTRL+C"""
    shutdown
server()
    return "OK", 200

but I want to have the Python thread the app's running in do some stuff, then close itself with sys.exit(0) so that it can be picked up by a listener in another app. So, in the `run.py` file, it would look like:

app=createapp()

if name=="main":
try:
app.run(debug=True, usereloader=False)


/r/flask
https://redd.it/1ke1e5h
🚀AtlasServer-Core — Admin panel for local Flask deployments

Hey everyone! I’ve just released AtlasServer-Core, an open-source admin panel that lets you spin up, manage and tear down your Flask apps locally—no Docker, no cloud needed.

Key features

🔹 One-click start/stop/delete of your Flask apps
🔹 Automatic Ngrok tunnel creation for public demos
🔹 Built-in auth & basic roles
🔹 Real-time log viewer

It’s still early, so any feedback on usability, stability or missing features is super welcome. You can check it out or grab the code here: 👉 https://github.com/AtlasServer-Core/AtlasServer-Core

Thanks for taking a look! 🙏

/r/flask
https://redd.it/1kdbyfg
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/1ke6s0y
After #ruff and #uv, #astral announced their next tool for the python ecosystem


A new type checker for python (like e.g. mypy or pyright) called Ty

- Ty: A new Python type checker (previously codenamed "Rednot")
- The team has been working on it for almost a year
- The name follows Astral's pattern of short, easy-to-type commands (like "ty check")

Source: https://www.youtube.com/watch?v=XVwpL_cAvrw

In your own opinion, after this, what tool do you think they should work on next in the python ecosystem?

Edit: Development is in the ruff repo under the red-knot label.

https://github.com/astral-sh/ruff/issues?q=%20label%3Ared-knot%20

There's also an online playground.
- https://types.ruff.rs/

/r/Python
https://redd.it/1kdui8w
I wasted 6 months on a Django project… to learn one simple lesson.

Last year, I had an idea to build a new kind of social network using Django—minimalist, interest-based, no toxic algorithms, just real conversations.
I was fully committed.

I spent six months coding everything with Django: authentication, personalized feed, post creation, moderation, notifications… it all seemed perfect.
But I forgot one thing: no one was waiting for it.

When I finally launched it… crickets.
A few positive comments, but nothing that justified six months of hard work. That’s when the lesson hit me.

I should have built a simple prototype in just one week.
Got real feedback. Made pivots. Or moved on to something better.

Now, with every Django project, I focus on building something testable in days, not months.
Build fast. Show early. That’s how you make real progress.

Anyone else experienced this? Or maybe you're working on a similar project right now?

/r/django
https://redd.it/1keh3sz
Is there a way to create a video streaming app like Netflix on flask with out using AWS ? It can be a mini version of Netflix and not exactly like Netflix.I would like to know your thoughts



/r/flask
https://redd.it/1kebdyd
Django firefly tasks - simple and easy to use background tasks in Django

What My Project Does

Simple and easy to use background tasks in Django without dependencies!

Documentation: https://lukas346.github.io/django\_firefly\_tasks/

Github: https://github.com/lukas346/django\_firefly\_tasks

Features

Easy background task creation
🛤️ Multiple queue support
🔄 Automatic task retrying
🛠️ Well integrated with your chosen database
🚫 No additional dependencies
🔀 Supports both sync and async functions

Target Audience

Is it meant for production/hobby projects

Comparison

It's really easy to use without extra databases/dependencies and it's support retry on fail.

/r/Python
https://redd.it/1kei45r
Future of Django UI - Vue-like components with reactivity and AlpineJS (help wanted)

I'm one of authors of django-components. I'm also maintaining one mid-sized Django web app to pay the bills (and using it as a playground for experiments).

Using JavaScript with django-components (or any alternatives) is still clunky - HTMX forces you to use solely the HTML fragment paradigm. AlpineJS is more flexible in this case, but you still need to somehow pass the data from Python to JS, and it gets messy once you need to pass Alpine variables across 5 or more templates.

However, we just designed how it would be possible to write UI components with clean JS integration - Vue-like components on top of django-components and AlpineJS.

This has been at the back of my head for almost a year now, so I'm glad we finally got clear steps for implementation. You can read more details here.

Let me know what y'all think.

PS: There's still lots to build. The end goal is to be able to write Vue files directly in Python, and to port Vuetify component library to Python. If you want to see this come to fruition, support us with your time, money, talk about this project, or help us with grant applications!

\---

Here's how it would look like:

First, in

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