Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.8K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
app.run() not recommended for development server?

For me it would be convenient to run the Flask development server with Flask.run() however the documentation says:

> It is not recommended to use this function for development with automatic reloading as this is badly supported. Instead you should be using the flask command line script’s run support.

Documentation link: https://flask.palletsprojects.com/en/stable/api/#flask.Flask.run

Instead they suggest to use the command line flask run which I currently do.

But I wonder how its different. Why is Flask.run not recommended?

/r/flask
https://redd.it/1p9t86o
Do I need to remove WSGI_APPLICATION in settings.py ?

I just installed channels and in the docs I see ASGI\_APPLICATION but they never mentioned whether to remove
`WSGI_APPLICATION = 'myproject.wsgi.application'`

How does this settings affect production if I have only ASGI_APPLICATION variable. as I am planning to use **uvicorn** in production.

/r/django
https://redd.it/1pafm64
Birds Vs Bats - A Python Shell Game

Project Link: https://github.com/Onheiron/PY-birds-vs-bats

What My Project Does: It's a videogame for the command shell! Juggle birds and defeat bats!

Target Audience: Hobby project

Comparison: It has minimalist ASCII art and cool new mechanics!

SCORE: 75 | LEVEL: 1 | NEXT: 3400 | LIVES: ●●●●●
=============================================



















. .


/r/Python
https://redd.it/1padhh7
Advanced, Overlooked Python Typing

While quantitative research in software engineering is difficult to trust most of the time, some studies claim that type checking can reduce bugs by about 15% in Python. This post covers advanced typing features such as never types, type guards, concatenate, etc., that are often overlooked but can make a codebase more maintainable and easier to work with


https://martynassubonis.substack.com/p/advanced-overlooked-python-typing

/r/Python
https://redd.it/1paocj5
I built a fast Advent of Code helper CLI for Python called elf


Hi all! With Advent of Code about to start, I wanted to share a tool I built to make the workflow smoother for Python users.

What My Project Does

elf is a command line tool that handles the repetitive parts of Advent of Code. It fetches your puzzle input and caches it, submits answers safely, and pulls private leaderboards. It uses Typer and Rich for a clean CLI and Pydantic models for structured data. The goal is to reduce boilerplate so you can focus on solving puzzles.

GitHub: https://github.com/cak/elf

PyPI: https://pypi.org/project/elf/

Target Audience

This tool is meant for anyone solving Advent of Code in Python. It is designed for day to day AoC usage. It aims to help both new participants and long time AoC users who want a smoother daily workflow.

Comparison

There are a few existing AoC helpers, but most require manual scripting or lack caching, leaderboard support, or guardrails for answer submission. elf focuses on being fast, simple, and safe to use every day during AoC. It emphasizes clear output, transparent caching, and a consistent interface.

If you try it out, I would love any feedback: bugs, ideas, missing features, anything. Hope it helps make Day 1 a little smoother for you.

Happy coding and good

/r/Python
https://redd.it/1paj821
[D] Can you add an unpublished manuscript to PhD application CV?

/r/MachineLearning
https://redd.it/1pa8472
context-async-sqlalchemy - The best way to use sqlalchemy in an async python application

Hello! I’d like to introduce my new library - **context-async-sqlalchemy**. It makes working with SQLAlchemy in asynchronous Python applications incredibly easy. The library requires minimal code for simple use cases, yet offers maximum flexibility for more complex scenarios.

What My Project Does: greatly simplifies integrating sqlalchemy into an asynchronous Python application

Target Audience: Backend developers, use in production or hobby or anywhere

Comparison: There are no competitors with this approach. A couple of examples in the text below demonstrate why the library is superior.


Let’s briefly review the theory behind SQLAlchemy - what it consists of and how it integrates into a Python application. We’ll explore some of the nuances and see how **context-async-sqlalchemy** helps you work with it more conveniently. Note that everything here refers to asynchronous Python.

# Short Summary of SQLAlchemy

SQLAlchemy provides an Engine, which manages the database connection pool, and a Session, through which SQL queries are executed. Each session uses a single connection that it obtains from the engine.

The engine should have a long lifespan to keep the connection pool active. Sessions, on the other hand, should be short-lived, returning their connections to the pool as quickly as possible.

# Integration and Usage in an Application

# Direct Usage

Let’s start with the simplest

/r/Python
https://redd.it/1pamid8
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/1paxlzf
Join the Advent of Code Challenge with Python!

# Join the Advent of Code Challenge with Python!

Hey Pythonistas! 🐍

It's almost that exciting time of the year again! The Advent of Code is just around the corner, and we're inviting everyone to join in the fun!

## What is Advent of Code?

Advent of Code is an annual online event that runs from December 1st to December 25th. Each day, a new coding challenge is released—two puzzles that are part of a continuing story. It's a fantastic way to improve your coding skills and get into the holiday spirit!

You can read more about it here.

## Why Python?

Python is a great choice for these challenges due to its readability and wide range of libraries. Whether you're a beginner or an experienced coder, Python makes solving these puzzles both fun and educational.

## How to Participate?

1. **Sign Up/In**.
2. Join the r/Python private leaderboard with code 2186960-67024e32
3. Start solving the puzzles released each day using Python.
4. Share your solutions and discuss strategies with the community.

## Join the r/Python Leaderboard!

We can have up to 200 people in a private leaderboard, so this may go over poorly - but you can join us with the following code: 2186960-67024e32

## How to Share Your Solutions?

You can join the Python

/r/Python
[https://redd.it/1pb2jch
django-cotton 2.5.0 now supports rendering components from views!

Perfect for HTMX workflows. From the README:

> ### Rendering Components from Views (HTMX Partials)
> When building HTMX-powered interfaces, you often need to return partial HTML from view functions. Cotton provides render_component() to programmatically render components from views:
>
>
> from django.http import HttpResponse
> from django_cotton import render_component
>
> def user_deleted(request, id):
> user = User.objects.get(id=id)
> user.delete()
> return HttpResponse(
> render_component(request, "notification",
> message=f"{user.name} deleted",
> type="success"
> )
> )
>


This is a game-changer for server-side component reusability with HTMX!

Docs: https://github.com/wrabit/django-cotton#rendering-components-from-views-htmx-partials
PR: https://github.com/wrabit/django-cotton/pull/320

/r/django
https://redd.it/1pb61a9
Redis cluster support introduced for dj-redis-panel v0.7.0

Hey all, you can now use dj-redis-panel to view and manage keys on redis clusters.

dj-redis-panel is a full featured GUI to view, search and manage redis keys straight from the django admin. Its a safe and useful tool that can likely find a home in just about any django project.


github: https://github.com/yassi/dj-redis-panel

docs: https://yassi.github.io/dj-redis-panel/

pypi: https://pypi.org/project/dj-redis-panel/

/r/django
https://redd.it/1pb4vip
mcputil 0.6.0: Enable code execution with MCP for you.

# What My Project Does

mcputil 0.6.0 comes with a CLI for generating a file tree of all available tools from connected MCP servers, which helps with Code execution with MCP.

# Why

As MCP usage scales, there are two common patterns that can increase agent cost and latency:

1. Tool definitions overload the context window;
2. Intermediate tool results consume additional tokens.

As a solution, Code execution with MCP thus came into being:

1. Present MCP servers as code APIs rather than direct tool calls;
2. The agent can then write code to interact with MCP servers.

This approach addresses both challenges: agents can load only the tools they need and process data in the execution environment before passing results back to the model.

# Prerequisites

Install mcputil:

pip install mcputil

Install dependencies:

pip install deepagents
pip install langchain-community
pip install langchain-experimental

# Quickstart

Run the MCP servers:

python examples/code-execution/googledrive.py

# In another terminal
python examples/code-execution/
salesforce.py

Generate a file tree of all available tools from MCP servers:

mcputil \
--server='{"name": "google
drive", "url": "http://localhost:8000"}' \


/r/Python
https://redd.it/1pb4wjg
Anyone here looking to get referral as a Senior/Staff Code Review Expert position | $40 to $125 / H

We’re seeking technically sharp experts (especially those with experience in code review, testing, or documentation) to assess full transcripts of user–AI coding conversations. This short-term, fully remote engagement helps shape the future of developer-assisting AI systems.

Key Responsibilities

• Review long-form transcripts between users and AI coding assistants

• Analyze the AI’s logic, execution, and stated actions in detail

• Score each transcript using a 10-point rubric across multiple criteria

• Optionally write brief justifications citing examples from the dialogue

• Detect mismatches between claims and actions (e.g., saying “I’ll run tests” but not doing so)

Ideal Qualifications

Top choices:

• Senior or Staff Engineers with deep code review experience and execution insight

• QA Engineers with strong verification and consistency-checking habits

• Technical Writers or Documentation Specialists skilled at comparing instructions vs. implementation

Also a strong fit:

• Backend or Full-Stack Developers comfortable with function calls, APIs, and test workflows

• DevOps or SRE professionals familiar with tool orchestration and system behavior analysis

Languages and Tools:

• Proficiency in Python is helpful (most transcripts are Python-based)

• Familiarity with other languages like JavaScript, TypeScript, Java, C++, Go, Ruby, Rust, or Bash is a plus

• Comfort with Git workflows, testing frameworks, and debugging tools is valuable

More About the Opportunity

• Remote and asynchronous — complete tasks on your

/r/Python
https://redd.it/1pb83nq
Django allauth urls

Hello,

Django allauth provides socalaccount template tags. The providder\_login\_url takes a provider as a parameter. In case of 'openid_connect' is it possible to directly link to a specific identity provider? We only use one provider and that page that lets the user select the identity provider simply adds an (unnecessary) extra click to the login flow.

/r/django
https://redd.it/1pasz51
Tired of static reports? I built a CLI War Room for live C2 tracking.

Hi everyone! 👋



I work in cybersecurity, and I've always been frustrated by static malware analysis reports. They tell you a file is malicious, but they don't give you the "live" feeling of the attack.



So, I spent the last few weeks building ZeroScout. It’s an open-source CLI tool that acts as a Cyber Defense HQ right in your terminal.



🎥 What does it actually do?

Instead of just scanning a file, it:

1. Live War Room: Extracts C2 IPs and simulates the network traffic on an ASCII World Map in real-time.

2. Genetic Attribution: Uses ImpHash and code analysis to identify the APT Group (e.g., Lazarus, APT28) even if the file is a 0-day.

3. Auto-Defense: It automatically writes **YARA** and **SIGMA** rules for you based on the analysis.

4. Hybrid Engine: Works offline (Local Heuristics) or online (Cloud Sandbox integration).



📺 Demo Video: https://youtu.be/P-MemgcX8g8



💻 Source Code:

It's fully open-source (MIT License). I’d love to hear your feedback or feature requests!

👉 **GitHub:** https://github.com/SUmidcyber/ZeroScout



If you find it useful, a on GitHub would mean the world to me!



Thanks for checking it out.

/r/Python
https://redd.it/1pbcpbj
Learning AI/ML as a CS Student

Hello there!
I'm curious about how AI works in the backend this curiosity drives me to learn AIML
As I researched now this topic I got various Roadmaps but that blown me up. Someone say learn xyz some say abc and the list continues
But there were some common things in all of them which isp
1.python
2.pandas
3.numpy
4.matplotlib
5.seaborn

After that they seperate
As I started the journey I got python, pandas, numpy almost done now I'm confused😵 what to learn after that
Plzz guide me with actual things I should learn
As I saw here working professionals and developers lots of experience hope you guys will help 😃

/r/Python
https://redd.it/1pbam48
Mp4-To-Srv3 - Convert Video Into Colored-Braille Subtitles For YouTube

### What My Project Does

This project converts an MP4 video, or a single PNG image (useful for thumbnails), into YouTube's internal SRV3 subtitle format, rendering frames as colored braille characters.
It optionally takes an SRT file and uses it to overlay subtitles onto the generated output.

For each braille character, the converter selects up to 8 subpixels to approximate brightness and assigns an average 12-bit color. This is not color-optimal but is very fast.
For better color control you can stack up to 8 layers per frame; colors are grouped by brightness and file size grows accordingly.

Resolutions up to 84 rows are supported (portrait mode required above 63 rows). Higher resolutions reduce FPS quadratically, so the tool applies motion blur to maintain motion perception when frames are skipped.

Demo video cycling weekly through multiple examples (Never Gonna Give You Up, Bad Apple, Plants vs. Zombies, Minecraft and Geometry Dash): https://youtu.be/XtfY7RMEPIg
(files: https://github.com/nineteendo/yt-editor-public)

Source code: https://github.com/nineteendo/Mp4-To-Srv3
(Fork of https://github.com/Nachtwind1/Mp4-To-Srt)

### Target Audience

- Anyone experimenting with ASCII/Unicode rendering or nonstandard video encodings
- Hobbyists interested in creative visualizations or color quantization experiments
- Not intended for production encoding, mainly an experimental and creative tool

### Comparison

Compared to the original Mp4-To-Srt:

- Outputs full SRV3 with colored braille rendering
- Supports layered color control, motion blur,

/r/Python
https://redd.it/1pblbal
Show & Tell: Python lib to track logging costs by file:line (find expensive statements in production

What My Project Does

LogCost is a small Python library + CLI that shows which specific logging calls in your code (file:line) generate the most log data and cost.



It:

wraps the standard logging module (and optionally print)
aggregates per call site: {file, line, level, message_template, count, bytes}
estimates cost for GCP/AWS/Azure based on current pricing
exports JSON you can analyze via a CLI (no raw log payloads stored)
works with logging.getLogger() in plain apps, Django, Flask, FastAPI, etc.



The main question it tries to answer is:

“for this Python service, which log statements are actually burning most of the logging budget?”

Repo (MIT): [
https://github.com/ubermorgenland/LogCost](https://github.com/ubermorgenland/LogCost)

———

Target Audience



Python developers running services in production (APIs, workers, web apps) where cloud logging cost is non‑trivial.
People in small teams/startups who both:
write the Python code, and
feel the CloudWatch / GCP Logging bill.
Platform/SRE/DevOps engineers supporting Python apps who get asked “why are logs so expensive?” and need a more concrete answer than “this log group is big”.

It’s intended for real production use (we run it on live services), not just a toy, but you can also point it at local/dev traffic to get a feel for your log patterns.

———

Comparison (How it

/r/Python
https://redd.it/1pblatk
AI Agent from scratch: Django + Ollama + Pydantic AI - A Step-by-Step Guide

Hey-up Reddit. I’m excited to share my latest project with you, a detailed, step-by-step guide on building a basic AI agent using Django, Ollama, and Pydantic AI.

I’ve broken down the entire process, making it accessible even if you’re just starting with Python. In the first part I'll show you how to:

Set up a Django project with Django Ninja for rapid API development.
Integrate your local Ollama engine.
Use Pydantic AI to manage your agent’s context and tool calls.
Build a functional AI agent in just a few lines of code!

This is a great starting point for anyone wanting to experiment with local LLMs and build their own AI agents from scratch.

Read the full article **here**.

In the next part I'll be diving into memory management – giving your agent the ability to remember past conversations and interactions.

Looking forward to your comments!

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