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
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
Looking for advice on a crash course

Hey everyone, I am a hobbyist that hasn't tinkered with django much for about 5+ years. I have previously only made very simple apps like a building directory in the past.

I am looking to create a new application and would like to re-familiarize myself with django and am hoping someone may be able to recommend a course covering the current version. I'm willing to pay for a course (I previously used Jose Portillo's course on udemy).

/r/django
https://redd.it/1mdr8qe
Real‑world ML course with personalized gamified challenges—feedback wanted on structure & format! 🎓

Hi everyone — I've been lurking these subreddits for years and finally wrapped up a course that’s very much inspired by what I’ve learned from this community.

I previously created a Udemy course—but in retrospect it felt too one‑size‑fits‑all and lacked engagement. Feedback showed that it wasn’t personalized enough, and students tends to drop off without reaching applied concepts.

So this iteration (on [Uphop.ai](https://www.uphop.ai/app/c/02d00637-0d71-40b3-af0b-ace55c2b6378?code=e12cd)) has been designed from scratch to tackle those issues:

* **Practice games at the end of every unit**, not just quiz questions—scenario-based immersive tasks. It’s true gamification applied to learning design, which literatures show can really boost engagement and performance when tailored to individual user preferences.
* **Hyper‑personalized experience**: learners get to pick challenges or paths that suit their goals, pacing, and interests, instead of being forced into a rigid progression.
* **Core modules**: Supervised/Unsupervised Learning, NLP, Deep Learning, AI ethics, Cloud deployments.

I’d love your honest feedback on:

1. Does the idea of challenge-based “games” at the end of modules sound motivating to you?
2. Would a hyper-personalized track (choose‑your‑own‑challenge or order) make a difference in how you'd stick with a course?
3. How balanced does the path from foundations → advanced topics sound? Any parts you’d reorder or expand?

The first unit is completely

/r/Python
https://redd.it/1mdvynt
datatrees & xdatatrees Release: Improved Forward Reference Handling and New XML Field Types

Just released a new version of the `datatrees` and `xdatatrees` libraries with several key updates.

* `datatrees 0.3.6`: An extension for Python `dataclasses`.
* `xdatatrees 0.1.2`: A declarative XML serialization library for `datatrees`.

# Key Changes:

**1. Improved Forward Reference Diagnostics (**`datatrees`**)** Using an undefined forward reference (e.g., `'MyClass'`) no longer results in a generic `NameError`. The library now raises a specific `TypeError` that clearly identifies the unresolved type hint and the class it belongs to, simplifying debugging.

**2. New Field Type:** `TextElement` **(**`xdatatrees`**)** This new field type directly maps a class attribute to a simple XML text element.

* **Example Class:**

&#8203;

@xdatatree
class Product:
name: str = xfield(ftype=TextElement)

* **Resulting XML:**
```xml
<product><name>My Product</name></product>

**3. New Field Type:** `TextContent` **(**`xdatatrees`**)** This new field type maps a class attribute to the text content of its parent XML element, which is essential for handling mixed-content XML.

* **Example Class:**

&#8203;

@xdatatree
class Address:
label: str = xfield(ftype=Attribute)


/r/Python
https://redd.it/1mdzcyf
How to encrypt the database?

I've seen many apps say their data is encrypted. I've personally never heard of encryption in django.
How to encrypt the data, (when) is that actually necessary?

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