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
[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
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/1pbt718
Want to ship a native-like launcher for your Python app? Meet PyAppExec

Hi all

I'm the developer of PyAppExec, a lightweight cross-platform bootstrapper / launcher that helps you distribute Python desktop applications almost like native executables without freezing them using PyInstaller / cx_Freeze / Nuitka, which are great tools for many use cases, but sometimes you need another approach.

# What My Project Does

Instead of packaging a full Python runtime and dependencies into a big bundled executable, PyAppExec automatically sets up the environment (and any third-party tools if needed) on first launch, keeps your actual Python sources untouched, and then runs your entry script directly.

PyAppExec consists of two components: an installer and a bootstrapper.

The installer scans your Python project, detects the entry point (supports various layouts such as src/\-based or flat modules), generates a .ini config, and copies the launcher (CLI or GUI) into place.

🎥 Short demo GIF:

https://github.com/hyperfield/pyappexec/blob/v0.4.0/resources/screenshots/pyappexec.gif

# Target Audience

PyAppExec is intended for developers who want to distribute Python desktop applications to end-users without requiring them to provision Python and third-party environments manually, but also without freezing the app into a large binary.

Ideal use cases:

Lightweight distribution requirements (small downloads)
Deploying Python apps to non-technical users
Tools that depend on external binaries
Apps that update frequently and need fast iteration

# Comparison With Alternatives

Freezing tools

/r/Python
https://redd.it/1pbp679
i built a key-value DB in python with a small tcp server

hello everyone im a CS student currently studying databases, and to practice i tried implementing a simple key-value db in python, with a TCP server that supports multiple clients. (im a redis fan)
my goal isn’t performance, but understanding the internal mechanisms (command parsing, concurrency, persistence, ecc…)

in this moment now it only supports lists and hashes, but id like to add more data structures.
i alao implemented a system that saves the data to an external file every 30 seconds, and id like to optimize it.

if anyone wants to take a look, leave some feedback, or even contribute, id really appreciate it 🙌
the repo is:

https://github.com/edoromanodev/photondb

/r/Python
https://redd.it/1pbpb8w
Introducing NetSnap - Linux net/route/neigh cfg & stats -> python without hardcoded kernel constants

What the project does: NetSnap generates python objects or JSON stdout of everything to do with networking setup and stats, routes, rules and neighbor/mdb info.

Target Audience: Those needing a stable, cross-distro, cross-kernel way to get everything to do with kernel networking setup and operations, that uses the runtime kernel as the single source of truth for all major constants -- no duplication as hardcoded numbers in python code.

Announcing a comprehensive, maintainable open-source python programming package for pulling nearly all details of Linux networking into reliable and broadly usable form as objects or JSON stdout.

Link here: https://github.com/hcoin/netsnap

From configuration to statistics, NetSnap uses the fastest available api: RTNetlink and Generic Netlink. NetSnap can fuction in either standalone fashion generating JSON output, or provide Python 3.8+ objects. NetSnap provides deep visibility into network interfaces, routing tables, neighbor tables, multicast databases, and routing rules through direct kernel communication via CFFI. More maintainable than alternatives as NetSnap avoids any hard-coded duplication of numeric constants. This improves NetSnap's portability and maintainability across distros and kernel releases since the kernel running on each system is the 'single source of truth' for all symbolic definitions.

In use cases where network configuration changes happen every second or

/r/Python
https://redd.it/1pbkih2
I created a open-source visual editable wiki for your codebase

Repo: https://github.com/davialabs/davia

What My Project Does

Davia is an open-source tool designed for AI coding agents to generate interactive internal documentation for your codebase. When your AI coding agent uses Davia, it writes documentation files locally with interactive visualizations and editable whiteboards that you can edit in a Notion-like platform or locally in your IDE.

Target Audience

Davia is for engineering teams and AI developers working in large or evolving codebases who want documentation that stays accurate over time. It turns AI agent reasoning and code changes into persistent, interactive technical knowledge.

It still an early project, and would love to have your feedbacks!

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