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
Is Flask still one of the best options for integrating APIs for AI models?

Hi everyone,

I'm working on some AI and machine learning projects and need to make my models available through an API.
I know Flask is still commonly used for this, but I'm wondering if it's still the best choice these days.

Is Flask still the go-to option for serving AI models via an API, or are there better alternatives in 2025, like FastAPI, Django, or something else?


My main priorities are:
- Easy to use
- Good performance
- Simple deployment (like using Docker)
- Scalability if needed

I'd really appreciate hearing about your experiences or any recommendations for modern tools or stacks that work well for this kind of project.

Thanks I appreciate it!


/r/Python
https://redd.it/1mct7ds
Archivey - unified interface for ZIP, TAR, RAR, 7z and more

Hi! I've been working on [this project](https://github.com/davitf/archivey) ([PyPI](https://pypi.org/project/archivey)) for the past couple of months, and I feel it's time to share and get some feedback.

# Motivation

While building a tool to organize my backups, I noticed I had to write separate code for each archive type, as each of the format-specific libraries (`zipfile`, `tarfile`, `rarfile`, `py7zr`, etc) has slightly different APIs and quirks.

I couldn’t find a unified, Pythonic library that handled all common formats with the features I needed, so I decided to build one. I figured others might find it useful too.

# What my project does

It provides a simple interface for reading and extracting many archive formats with consistent behavior:

from archivey import open_archive

with open_archive("example.zip") as archive:
archive.extractall("output_dir/")

# Or process each file in the archive without extracting to disk
for member, stream in archive.iter_members_with_streams():
print(member.filename, member.type, member.file_size)
if stream is not

/r/Python
https://redd.it/1mcrerl
Training a "Tab Tab" Code Completion Model for Marimo Notebooks

In the spirit of building in public, we're collaborating with Marimo to build a "tab completion" model for their notebook cells, and we wanted to share our progress as we go in tutorial form.

The goal is to create a local, open-source model that provides a Cursor-like code-completion experience directly in notebook cells. You'll be able to download the weights and run it locally with Ollama or access it through a free API we provide.

We’re already seeing promising results by fine-tuning the Qwen and Llama models, but there’s still more work to do.

👉 Here’s the first post in what will be a series:
https://www.oxen.ai/blog/building-a-tab-tab-code-completion-model

If you’re interested in contributing to data collection or the project in general, let us know! We already have a working CodeMirror plugin and are focused on improving the model’s accuracy over the coming weeks.

/r/Python
https://redd.it/1mcrj71
I coded a prototype last night to solve API problems.

Five days ago, I posted here about the difficulty of finding a product on the market that would help my client manage interactions with my API.

I wanted something like a "Shopify" for my API, not an "Amazon" like RapidAPI.

Last night, during one of those sleepless late nights, I decided to finally bring the idea to life and code the prototype of a little product I had in mind.

The concept is simple: give API creators a quick and easy way for their customers to:

\- Generate and manage API keys
\- Track usage and set limits
\- Manage members
\- Set up payments

For now, it’s just a skeleton, but in the next few late nights, I’ll keep building it out.

The goal is to make life a lot easier for those selling APIs.

What do you think?

https://youtu.be/mlKegPNRSw4

/r/django
https://redd.it/1mcl88d
Azure interactions


Hi,

Anyone got any experience with implementing azure into an app with python?
Are there any good libraries for such things :)?

Asking couse I need to figure out an app/platform that actively cooperates with a data base, azure is kinda my first guess for a thing like that.

Any tips welcome :D

/r/Python
https://redd.it/1mczicz
Python Data Engineers: Meet Elusion v3.12.5 - Rust DataFrame Library with Familiar Syntax

Hey Python Data engineers! 👋

I know what you're thinking: "Another post trying to convince me to learn Rust?" But hear me out - Elusion v3.12.5 might be the easiest way for Python, Scala and SQL developers to dip their toes into Rust for data engineering, and here's why it's worth your time.

# 🤔 "I'm comfortable with Python/PySpark why switch?"

Because the syntax is almost identical to what you already know!

Target audience:

If you can write PySpark or SQL, you can write Elusion. Check this out:

PySpark style you know:

result = (salesdf
.join(customers
df, salesdf.CustomerKey == customersdf.CustomerKey, "inner")
.select("c.FirstName", "c.LastName", "s.OrderQuantity")
.groupBy("c.FirstName", "c.LastName")
.agg(sum("s.OrderQuantity").alias("totalquantity"))
.filter(col("total
quantity") > 100)
.orderBy(desc("totalquantity"))
.limit(10))

**Elusion in Rust (almost the same!):**

let result = sales
df
.join(customersdf, ["s.CustomerKey = c.CustomerKey"], "INNER")
.select(["c.FirstName", "c.LastName", "s.OrderQuantity"])
.agg(["SUM(s.OrderQuantity) AS total
quantity"])


/r/Python
https://redd.it/1md030c
Django tip Show Images In Admin Panel

/r/django
https://redd.it/1md39gw
If you want to use vibe coding, make sure you fully understand the whole project

I am using python and finite element library FEnicsx0.9 to write a project about compressible flow, I am using FEnicsx0.9, few weeks ago I think AI can let me code the project in one night as long as I give it the whole project algorithm and formulas, now I figure out that if you don't fully understand the whole library you are using and the detail of the whole project you are coding, relying on AI too much will become a disaster, vibe coding is hyped too much

/r/Python
https://redd.it/1md01j6
Flask + PostgreSQL + Flask-Migrate works locally but not on Render (no tables created)

I'm deploying a Flask app to Render using PostgreSQL and Flask-Migrate. Everything works fine on localhost — tables get created, data stores properly, no issues at all.

But after deploying to Render:

* The app runs, but any DB-related operation causes a 500 Internal Server Error.
* I’ve added the `DATABASE_URL` in Render environment .
* My app uses Flask-Migrate. I’ve run `flask db init`, m`igrate`, and `upgrade` locally.
* On Render, I don’t see any tables created in the database (even after deployment).
* How to solve this ? Can anybody give full steps i asked claude , gpt ,grok etc but no use i am missing out something.

/r/flask
https://redd.it/1md6i0f
I coded a prototype last night to solve API problems.

Five days ago, I posted here about the difficulty of finding a product on the market that would help my client manage interactions with my API.

I wanted something like a "Shopify" for my API, not an "Amazon" like RapidAPI.

Last night, during one of those sleepless late nights, I decided to finally bring the idea to life and code the prototype of a little product I had in mind.

The concept is simple: give API creators a quick and easy way for their customers to:

\- Generate and manage API keys
\- Track usage and set limits
\- Manage members
\- Set up payments

For now, it’s just a skeleton, but in the next few late nights, I’ll keep building it out.

The goal is to make life a lot easier for those selling APIs.

What do you think?

https://reddit.com/link/1mclbrj/video/8nakl4hj9vff1/player



/r/flask
https://redd.it/1mclbrj
Lessons Learned While Trying to Scrape Google Search Results With Python

I’ve been experimenting with Python web scraping recently, and one of the toughest challenges so far has been scraping Google search results reliably. I expected it to be as simple as requests + BeautifulSoup, but it wasn’t.

Here’s what I’ve learned from trial and error:

🔹 Google is quick to detect scraping attempts.
Even with random headers, delays, and proxies, it doesn’t take long before CAPTCHAs or temporary blocks pop up. At one point, I could barely scrape 2–3 pages before getting cut off.

🔹 Pagination isn’t consistent.
It’s not just &start=10 for every page—sometimes the results shift or display fewer items than what’s in the browser. You need to account for unexpected page behavior.

🔹 JavaScript rendering is almost a requirement now.
Some SERPs don’t fully load without JS enabled. Static requests often return stripped-down or incomplete results, which makes BeautifulSoup parsing unreliable unless you use something like Playwright or an API that supports rendering.

🔹 Data cleaning matters.
Google adds a ton of extra formatting, tracking parameters, and “People Also Ask” blocks. I ended up writing extra functions just to extract clean titles, links, and snippets.

I know scraping Google is a grey area, but it’s a common data engineering

/r/Python
https://redd.it/1md4zmu
large django project experiencing 502

My project has been experiencing 502 recently. I am running on gunicon with nginx. I don't really want to increase the timeout unless I have too. I have several models with object counts into 400k and another in 2 million objects. The 502 only occurs on PATCH requests. I suspect that the number of objects is causing the issue. What are some possible solutions I should look into?

/r/django
https://redd.it/1mddk6d
`tokenize`: a tip and a trap

[`tokenize`](https://docs.python.org/3/library/tokenize.html) from the standard library is not often useful, but I had the pleasure of using it in a recent project.

Try `python -m tokenize <some-short-program>`, or `python -m tokenize` to experiment at the command line.

-----

The tip is this: `tokenize.generate_tokens` expects [a readline function that spits out lines as strings when called repeatedly](https://docs.python.org/3/library/tokenize.html#tokenize.generate_tokens), so if you want to mock calls to it, you need something like this:

lines = s.splitlines()
return tokenize.generate_tokens(iter(lines).__next__)

(Use `tokenize.tokenize` if you always have strings.)

----

The trap: there was a breaking change in the tokenizer between Python 3.11 and Python 3.12 because of the formalization of the grammar for f-strings from [PEP 701](https://docs.python.org/3/whatsnew/3.12.html#pep-701-syntactic-formalization-of-f-strings).

$ echo 'a = f" {h:{w}} "' | python3.11 -m tokenize
1,0-1,1: NAME 'a'
1,2-1,3: OP '='

/r/Python
https://redd.it/1mdag10
CLI Tool For Quickly Navigating Your File System (Arch Linux)

So i just made and uploaded my first package to the aur, the source code is availble at https://github.com/BravestCheetah/DirLink .

The Idea

So as i am an arch user and is obsessed with clean folder structure, so my coding projects are quite deep in my file system, i looked for some type of macro or tool to store paths to quickly access them later so i dont have to type out " cd /mnt/nvme0/programming/python/DirLinkAUR/dirlink" all the time when coding (thats an example path). Sadly i found nothing and decided to develop it myself.

Problems I Encountered

I encountered one big problem, my first idea was to save paths and then with a single command it would automatically cd into that directory, but i realised quite quickly i couldnt run a cd command in the users active command prompt, so i kinda went around it, by utilizing pyperclip i managed to copy the command to the users clipboard instead of automatically running the command, even though the user now has to do one more step it turned out great and it is still a REALLY useful tool, at least for me.

What My Project Does

I resulted in a cli tool which has the "dirlink" command with

/r/Python
https://redd.it/1mdfeh3
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1mdmo51
Granian 2.5 is out

Granian – the Rust HTTP server for Python applications – 2.5 was just released.

Main highlights from this release are:

support for listening on Unix Domain Sockets
memory limiter for workers

Full release details: https://github.com/emmett-framework/granian/releases/tag/v2.5.0
Project repo: https://github.com/emmett-framework/granian
PyPi: https://pypi.org/p/granian

/r/Python
https://redd.it/1mdi14s
Step-by-step guide to deploy your FastAPI app using Railway, Dokku on a VPS, or AWS EC2 — with real

[https://fastlaunchapi.dev/blog/how-to-deploy-fastapi-app/](https://fastlaunchapi.dev/blog/how-to-deploy-fastapi-app/)

# How to Deploy a FastAPI App (Railway, Dokku, AWS EC2)

Once you’ve finished building your FastAPI app and tested it locally, the next big step is getting it online so others can use it. Deployment can seem a little overwhelming at first, especially if you're deciding between different hosting options, but it doesn’t have to be.

In this guide, I’ll walk you through how to deploy a FastAPI application using three different platforms. Each option suits a slightly different use case, whether you're experimenting with a personal project or deploying something more production-ready.

We’ll cover:

* **Railway**, for quick and easy deployments with minimal setup
* **Dokku**, a self-hosted solution that gives you more control while keeping things simple
* **AWS EC2**, for when you need full control over your server environment

/r/Python
https://redd.it/1mdkmvd
How to properly render select2 widget in a modal window?

Hi, i have a Book model that has a authors field which is a ManyToMany field to Author model.

I'm using django-autocomplete-light to render a select2 widget in my templates that will allow me to select more than one authors when creating new books. (Using ModelSelect2Multiple)

So the field renders OK in a regular html page. But when i try to render the same exact form in a DaisyUI modal window, the dropdown menu that it should open will be opened in the back of the modal window (like i can see it is being displayed behind the modal window).

Here is my form:

class BookForm(forms.ModelForm):    
class Meta:
        model = Book
        fields = (
            'title',
            'authors',
        )

        widgets = {
            'authors': autocomplete.ModelSelect2Multiple(


/r/djangolearning
https://redd.it/1md535t
Is it a sin to serve just the password reset from Django directly?

Right. Ive been avoiding asking thinking I will eventually fix this but no dice. It’s nearly midnight(wrecked), I’m now in bed(fiance will kill me if I wake her), spiritually defeated(it's temporary), and here we are.

I’m building a personal project with a decoupled setup: DRF as the backend and a super minimal HTML and JS(it's as vanilla as you can get) frontend... essentially a glorified test harness. Nothing fancy, just enough to click buttons and cry.

Here’s the problem: I can't get the password reset form to show up properly after clicking the reset link that gets emailed. The link to send the reset email works fine when I use Django’s built-in templates on port 8000. But when I try to handle it through my frontend setup? Nada. Just silence and broken dreams(empty index file).

So now I’m wondering would it really be that bad if I just let Django serve this one thing directly? Let it have its moment in the spotlight with the password reset form while the rest of the app sticks to the decoupled API and JS plan?

Is this a common workaround? A sign of weakness? A pact with the devil? Just looking for some wisdom (or permission) from

/r/django
https://redd.it/1mdla52
Proxy for using LSP in a Docker container

I just solved a specific problem: handling the LSP inside a Docker container without requiring the libraries to be installed on the host. This was focused in Python using Pyright and Ruff, but can be extensible to another language.

https://github.com/richardhapb/lsproxy

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