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
Erys: A Terminal Interface for Jupyter Notebooks

Erys: A Terminal Interface for Jupyter Notebooks

I recently built a TUI tool called Erys that lets you open, edit, and run Jupyter Notebooks entirely from the terminal. This came out of frustration from having to open GUIs just to comfortably interact with and edit notebook files. Given the impressive rendering capabilities of modern terminals and Textualize.io's Textual library, which helps build great interactive and pretty terminal UI, I decided to build Erys.

What My Project Does
Erys is a TUI for editing, executing, and interacting with Jupyter Notebooks directly from your terminal. It uses the Textual library for creating the interface and `jupyter_client` for managing Python kernels. Some cool features are:

\- Interactive cell manipulation: split, merge, move, collapse, and change cell types.

\- Syntax highlighting for Python, Markdown, and more.

\- Background code cell execution.

\- Markup rendering of ANSI escaped text outputs resulting in pretty error messages, JSONs, and more.

\- Markdown cell rendering.

\- Rendering image and HTML output from code cell execution using Pillow and web-browser.

\- Works as a lightweight editor for source code and text files.

Code execution uses the Python environment in which Erys is opened and requires installation of ipykernel.

In the future, I would like to add code completion

/r/Python
https://redd.it/1ma0852
P Sub-millisecond GPU Task Queue: Optimized CUDA Kernels for Small-Batch ML Inference on GTX 1650.

Over the past month, I’ve been working on writing high-throughput, low-latency CUDA kernels for small-batch inference workloads typical in real-time ML use cases (e.g., finance, RL serving).

Despite running on a GTX 1650 (consumer laptop GPU), I achieved:

93,563 ops/sec
0.011 ms median latency
7.3× speedup over PyTorch (float32 GEMV)
30–40% faster than cuBLAS batched GEMV (in small-batch regime)

This was done by hand-optimizing a set of three core kernels:

Batched GEMV
Softmax
Vector elementwise ops (e.g., affine transforms)

# Engineering Highlights:

float4 vectorization with proper alignment checks
128-byte staged shared memory blocks (using padding for bank conflict mitigation)
Thread-per-output-element grid strategy
Aggressive loop unrolling and warp-aware memory access
Benchmarked with CUDA events, median+IQR over 1,000 trials

# Why it matters:

cuBLAS (and by extension PyTorch) is heavily tuned for large-batch throughput, but small-batch latency suffers. For real-time systems (e.g., financial models or reinforcement learning), this is a major bottleneck.

This kernel suite shows that even with modest hardware, you can cut inference latency significantly below PyTorch/cuBLAS levels through architecture-aware programming.

# Links:

[GitHub source & benchmark code](https://github.com/shreshthkapai/cuda_latency_benchmark)
Full write-up on Medium

Would love to hear feedback from others doing similar work—especially around kernel tuning strategies, warp divergence handling, and memory hierarchy tradeoffs.

/r/MachineLearning
https://redd.it/1m9vauo
Polylith: a Monorepo Architecture

Project name: The Python tools for the Polylith Architecture

# What My Project Does

The main use case is to support Microservices (or apps) in a Monorepo, and easily share code between the services. You can use Polylith with uv, Poetry, Hatch, Pixi or any of your favorite packaging & dependency management tool.

Polylith is an Architecture with tooling support. The architecture is about writing small & reusable Python components - building blocks - that are very much like LEGO bricks. Features are built by composing bricks. It’s really simple. The tooling adds visualization of the Monorepo, templating for creating new bricks and CI-specific features (such as determining which services to deploy when code has changed).

# Target Audience

Python developer teams that develop and maintain services using a Microservice setup.

# Comparison

There’s similar solutions, such as uv workspaces or Pants build. Polylith adds the Architecture and Organization of a Monorepo. All code in a Polylith setup - yes, all Python code - is available for reuse. All code lives in the same virtual environment. This means you have one set of linting and typing rules, and run all code with the same versions of dependencies.

This fits very well with REPL Driven Development and interactive Notebooks.

Recently,

/r/Python
https://redd.it/1m9so08
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/1ma85ub
CSRF cookie set but not sent with POST request in frontend (works with curl)



---

**Title: CSRF cookie set but not sent with POST request in frontend (works with curl)**

Hey everyone,

I'm stuck with a frustrating CSRF issue and could really use some help. This has been bugging me for two days straight.

### 🧱 Project Setup

- **Backend** (Django, running locally at `localhost:8000` and exposed via Ngrok):
```
https://0394b903a90d.ngrok-free.app/
```

- **Frontend** (Vite/React, running on a different machine at `localhost:5173` and also exposed via Ngrok):
```
https://6226c43205c9.ngrok-free.app/
```

---

### What’s Working

1. **CSRF GET request from frontend**:
- Frontend sends a request to:
`https://0394b903a90d.ngrok-free.app/api/accounts/csrf/`
- Response includes:
```
set-cookie: csrftoken=CSsCzLxxuYy2Nn4xq0Dabrg0aZdtYShy; expires=...; SameSite=None; Secure
```
- The cookie **shows up in the network tab**, but not accessible via JavaScript (as expected since it's HTTPOnly=False).
- Backend view:
```python
def get_csrf_token(request):
allow_all = getattr(settings, 'CORS_ALLOW_ALL_ORIGINS', 'NOT_FOUND')
allowed_list = getattr(settings, 'CORS_ALLOWED_ORIGINS', 'NOT_FOUND')
return JsonResponse({


/r/django
https://redd.it/1m9y71m
Python 3.14: time for a release name?

I know we don't have release names, but if it's not called "Pi-thon" it's gonna be such a missed opportunity. There will only be one version 3.14 ever...

/r/Python
https://redd.it/1ma6dbd
Karaoke maker python project

Hii,

I tried using some of the karaoke video makers but from what I've seen, they use speech-to-text to time the lyrics. However, I am lazy and wondered why we can't just use the already timed lyrics in musixmatch and lrclib. The only drawback is that most of them are done per line as opposed to per word but that was an okay compromise for me.

So I (vibe) coded this simple python workflow that takes everything from a search query or youtube url to a karaoke video. It goes like this:

search term or url -> downloads mp3 -> split vocals / instrumental using nomadkaraoke/python-audio-separator\-> get synced lyrics using moehmeni/syncedlyrics\-> convert to subtitles -> burn subtitles with instrumental for final video

here's the project: el-tahir/karaoke. and here is an example of the generated video : https://youtu.be/vKunrdRmMCE?si=xsyavSAVk43t5GnB .

I would love some feedback, especially from experienced devs!!


What My Project Does:
creates karaoke videos from a search term or youtube url.

Target Audience:
just a toy project

Comparison:
Instead of trying to use speech-to-text to time lyrics, it uses already synced lyrics from sources like musixmatch and lrclib.

/r/Python
https://redd.it/1m9zwfh
Speech-to-speech conversational agent

Has anyone been able to build a conversational AI app? I’m looking for affordable speech-to-speech APIs, came across Hume AI EVI 3 APIs, but it’s been frustrating to say the least as I haven’t been successful. I also implemented deep gram for transcripts then sending to openAI for text response and then openAI text to speech, but looking for an affordable speech-to-speech workflow. OpenAI’s conversational API are expensive, so anything other than that. Any suggestions? Django integration is what’s needed. Thanks.

/r/django
https://redd.it/1madeki
I would like to integrate my cookiecutter django with my vite+react+tanstackrouter frontend.

Is there a way to do it cleanly? I think allauth complicates things a lot but I am recently started to use cookiecutter django. How do I configure it in order to use jwt?

/r/django
https://redd.it/1machm5
Save form data with a foreign key added?

I have a model, `Division` which is one section of a `Tournament`, created via `Division(tournament=tournament, name=name)`. I want to add divisions to a tournament via a form embedded in the tournament detail view, `Add division: ____ [submit]`, so that the `AddDivisionForm` has a single field for the division name.

I'm having trouble figuring out how I retrieve the parent tournament when the form is submitted (the `???` in the code below), i.e. how I pass the tournament id between the `get_context_data` and `post` calls:


class TournamentDetailView(TemplateView):
template_name = "director/tournament_detail.html"

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
tournament = Tournament.objects.get(pk=context["pk"])
context["object"] = tournament
context["form"] = AddDivisionForm()
return context

def post(self, request, *args, **kwargs):
form = AddDivisionForm(request.POST)
if form.is_valid():
name = form.cleaned_data["name"]


/r/django
https://redd.it/1m9hhj9
Seeking AI Video Translation English-to-German (Dubbing/Voiceover) – Approx. 5400

Seeking AI Video Translation English-to-German (Dubbing/Voiceover) – Approx. 5400 Min./Month – Cost-Efficient Solutions & GitHub Projects?



Hello dear Community!

I'm looking for effective and cost-efficient AI tools for video translation from English to German. My requirement is around 5400 minutes of video per month, primarily for dubbing/voiceover.

Which commercial providers can you recommend for this volume, also considering price-performance ratio and cost models?

Are there also any interesting open-source projects on GitHub that go in this direction and could be usable or adaptable for such a volume? Perhaps solutions that one could self-host?

I'm also open to project ideas where such tools could be effectively utilized at this scale.

Looking forward to your recommendations and insights!

/r/Python
https://redd.it/1malx1e
Any good pygame tutorials?

I really need a short, clear Pygame tutorial. Watched Clear Code, but his explanations feel too long and I forget details. Any recommendations?

/r/Python
https://redd.it/1ma72k4
📊 Check Out djangokpi: A Work-in-Progress KPI Management Package for Django!

Hey everyone! 👋

I'm excited to share my ongoing project, **django
kpi, a Django package designed for creating, tracking, and managing Key Performance Indicators (KPIs) in your projects.

### Current Status:
While the package is still under active development and not yet ready for production use, I’m thrilled to announce that the KPI cards API is ready for preview!

### Features (WIP):
- Define Custom KPIs: Tailor KPIs to fit your project's needs.
- Track Performance Over Time: Monitor KPI evolution (in progress).
- Flexible Configuration: Easy integration into existing Django projects.
- Django Admin Support: Manage KPIs via the Django admin interface or API.

### Preview the KPI Cards:
Check out the API for KPI cards and see how it can enhance your project!

### Installation:
To install, use pip:
pip install django_kpi

Add it to your INSTALLED_APPS and include the URLs in your project!

### Contribution:
I'm looking for contributors! If you're interested, please submit a pull request or open an issue with your ideas.

Check it out on GitHub and let me know your thoughts! Any feedback is appreciated as I work to improve it!

Thanks! 😊

/r/django
https://redd.it/1maozo5
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/1mb1j12
Caching API Responses in Flask

Guys, kindly have a read about implementing simple caching in your Flask APIs. It is an easy to understand guide for a first timer.

https://flask-india.hashnode.dev/caching-api-responses-in-flask

/r/flask
https://redd.it/1maybu0
Am I doing this right?

id: "models.PositiveBigIntegerFieldint" = models.PositiveBigIntegerField(
default=intid, primarykey=True, editable=False
)

email: "models.CharFieldstr | None" = models.CharField(
maxlength=256,
unique=True,
blank=True,
null=True,
validators=(EmailValidator(message="Invalid email address"),),
)

country
code: "models.CharFieldstr | None" = models.CharField(
maxlength=2,
blank=True,
null=True,
validators=(validators.validate
countrycode,),
)
dial
code: "models.CharFieldstr |

/r/djangolearning
[https://redd.it/1marbhd
robinzhon: a library for fast and concurrent S3 object downloads

What My Project Does

robinzhon is a high-performance Python library for fast, concurrent S3 object downloads. Recently at work I have faced that we need to pull a lot of files from S3 but the existing solutions are slow so I was thinking in ways to solve this and that's why I decided to create robinzhon.

The main purpose of robinzhon is to download high amounts of S3 Objects without having to do extensive manual work trying to achieve optimizations.

Target Audience
If you are using AWS S3 then this is meant for you, any dev or company that have a high s3 objects download can use it to improve their process performance

Comparison
I know that you can implement your own concurrent approach to try to improve your download speed but robinzhon can be 3 times faster even 4x if you start to increase the max_concurrent_downloads but you must be careful because AWS can start to fail due to the amount of requests.

GitHub: https://github.com/rohaquinlop/robinzhon

/r/Python
https://redd.it/1maocfk
Need Career Advice: Stuck in .NET Web Forms, Should I Switch to Python Flask?

Hi everyone,

I’ve been working at a company for the past 4 months. I was hired to work on a .NET Web Forms project, but the pace of work is extremely slow. For the last 3 months, I haven’t written any real code — I’ve just been learning about Web Forms.

The company is saying they’ll give me actual work on an ERP project starting next week, but honestly, I’m not feeling confident. I’ve been told there will be no proper mentorship or guidance, and I find ERP systems really hard to grasp.

On the other hand, I’m passionate about innovation and working with new technologies. I really enjoy Python and I’ve been considering switching over to Flask development instead, since it aligns more with what I want to do in the future.

I’m feeling a lot of stress and confusion right now. Should I stick it out with this company and the ERP/.NET stuff, or should I start focusing on Python Flask and make a shift in that direction?

Any advice from experienced developers would be really appreciated. Thanks!

\#CareerAdvice #DotNet #Python #Flask #ERP #WebForms #JuniorDeveloper #ProgrammingHelp

/r/flask
https://redd.it/1mbebbe