r/Python • • 8d ago

Showcase Showcase Thread

18 Upvotes

Post all of your code/projects/showcases/AI slop here.

Recycles once a month.


r/Python • • 6h ago

Daily Thread Tuesday Daily Thread: Advanced questions

6 Upvotes

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 every Thursday.
  • Questions that are not advanced may be removed and redirected to the appropriate thread.

Recommended Resources:

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 performance implications of using native Python data structures vs NumPy arrays for large-scale data?
  9. Best practices for securing a Flask (or similar) REST API with OAuth 2.0?
  10. What are the best practices for using Python in a microservices architecture? (..and more generally, should I even use microservices?)

Let's deepen our Python knowledge together. Happy coding! 🌟


r/Python • • 22h ago

Discussion What are some features in Python that you discovered many years later?

128 Upvotes

For me, it was the the option to use & to find intersections of two sets, | operator to unionize two sets, as well as ^ for symmetric difference


r/Python • • 7m ago

Discussion Lessons from building a live IoT ingestion server in Python

• Upvotes

I've been working on a telematics backend that ingests TCP sensor data from heavy equipment. The pipeline is Python → local disk spool → RabbitMQ → PostgreSQL.

A few things we learned the hard way:

  • ACK only after durable storage. We acknowledge a packet after validating it and writing it to disk, not after the database insert. This lets us recover from downstream failures.
  • Async helped with thousands of connections. Moving from one thread per connection to asyncio reduced overhead, but blocking work still needs to stay off the event loop.
  • Queue backlogs can look like device failures. We separated live traffic from replay traffic and prioritized fresh data so old packets wouldn't delay current readings.
  • Offline uploads need different parsing. Reusing our live TCP parser silently dropped records because flash dumps had a different format.
  • Firmware changes break assumptions. Frame sizes, serial numbers, and counter widths changed. Explicit protocol versioning would have saved us some pain.
  • Logging every packet doesn't scale. We cut noisy logs and focused on actionable errors and dropped-record tracking.

The biggest lesson: receiving sensor data is the easy part. Making it reliable through retries, offline uploads, firmware changes, and database failures is where things get interesting.

For those running IoT ingestion in production, how do you handle ACK semantics and replay backlogs?


r/Python • • 1d ago

News GeoPolars is being actively developed again: geometry types, CRS-aware measurements and GeoParquet

182 Upvotes

GeoPolars, the geospatial extension for Polars, had been mostly dormant. Since mid-September, Aida van de Wetering has pushed around 125 commits to the dev branch. It now looks like a rebuild around a Polars-native geo expression namespace.

Highlights so far:

- Types: point, linestring and polygon, their multi-variants, and a bounding box type
- I/O: reading and writing WKB and WKT, and writing GeoParquet
- CRS: CRS metadata handling, with distance, length and area using the geodesic or planar method that fits the CRS
- Operations: centroid, boundary, interior, is_empty, longitude wrapping, and coordinate accessors
- Affine transforms: translate, rotate, scale and skew, plus arbitrary matrices, which can vary per row

It's still a prototype. Nothing has been released yet, and the API is changing. Still, it's worth watching if you'd like to do geospatial work in Polars without going through GeoPandas.


r/Python • • 1d ago

Daily Thread Monday Daily Thread: Project ideas!

9 Upvotes

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" 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

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

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

Let's help each other grow. Happy coding! 🌟


r/Python • • 1d ago

Resource I made 100 Python flashcards

18 Upvotes

I made 100 free Python interview flashcards

I've been putting together a set of Python flashcards covering common interview topics: fundamentals, data structures, OOP, functions, decorators, generators, async, testing, and more.

They're available as an Anki deck and completely free. No signup or email required.

https://github.com/tomaszs/python-interview-flashcards-free

Hopefully useful for anyone brushing up on Python or preparing for an interview.

If you spot something that's missing or could be improved, contributions and feedback are welcome.


r/Python • • 2d ago

Discussion Are fewer young people getting into Python these days?

42 Upvotes

I recently attended a local PyDay (a Python community event) in my city, and the auditorium was around 70% full.

That might sound pretty good, but I remember attending similar events a few years ago when the auditorium was packed, basically at 100% capacity.

I also got the impression that there weren't many young newcomers interested in getting into programming. Most of the attendees seemed to be people who were already established in the industry.

Of course, this is just one event in one city, so I don't want to draw any big conclusions from it.

But it got me wondering:

  • Have Python meetups and conferences in your area seen a similar decline in attendance?
  • Are fewer young people getting into Python, or are they just participating in different communities and online spaces?
  • Or was this simply a one-off, and I'm reading too much into it?

I'm curious to hear what people are seeing in their local Python communities.


r/Python • • 2d ago

Daily Thread Sunday Daily Thread: What's everyone working on this week?

18 Upvotes

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 • • 1d ago

News I wrote a funny esoteric interpreter in Python called CatScript

0 Upvotes

Hi everyone!

I was a bit bored and decided to write a lightweight, hilarious interpreter from scratch using pure Python.

Meet CatScript — the ultimate esoteric language inspired entirely by feline behavior.

Some core mechanics:

• It operates on a single accumulator register called the "belly" (where it stores the current value).

• No human words like if, while, or print. Control flow is handled via commands like EyesWide (conditional branch) and TailUp/TailDown (loops).

• The main technical constraint: Every single instruction introduces a mandatory 5ms delay using time.sleep(0.005) because cats do not care about your high-tech CPU or your deadlines.

Quick Syntax Examples:

• Meow — (+1 to the belly)

• Tygydyk — midnight zoomies (multiply belly value by 2)

• Purr — happy vibration (prints the belly value as an ASCII character)

• Bite — stops the program execution gracefully

I've already managed to write a program that prints "Hello" using only cat syntax.

The project is fully open-source. You can check out the lexer logic, read the full command reference, or run the "Hello" example yourself! repo


r/Python • • 3d ago

News Python 3.15 Released

525 Upvotes

https://www.python.org/downloads/release/python-3150/

Release announcement: https://discuss.python.org/t/python-3-15-0-final-is-here/109415

What's New: https://docs.python.org/3.15/whatsnew/3.15.html

Some of the major new features and changes in Python 3.15:

Interpreter improvements

  • PEP 661: sentinel built-in type
  • PEP 686: UTF-8 is now the default encoding
  • PEP 798: Unpacking in comprehensions
  • PEP 810: Explicit lazy imports for faster startup times
  • PEP 814: frozendict built-in type
  • PEP 829: Package startup configuration files
  • The experimental JIT compiler got a significant upgrade (7-8% faster on x86-64 Linux, 11-12% on AArch64 macOS)
  • Improved error messages

Standard library

  • PEP 799: A dedicated profiling package, including Tachyon, a high-frequency sampling profiler
  • New math.integer module
  • re.prefixmatch() as a clearer name for the now soft-deprecated re.match()
  • pprint gets an expand option for JSON-style output
  • collections.Counter supports ^ (symmetric difference)
  • unicodedata.iter_graphemes() for iterating over grapheme clusters
  • python -m http.server gains -H/--header and --content-type
  • timeit gains --target-time
  • More color

Typing

  • PEP 728: TypedDict with typed extra items
  • PEP 747: Annotating type forms with TypeForm
  • PEP 800: Disjoint bases in the type system

Release changes

  • Official Windows 64-bit binaries now use the tail-calling interpreter
  • Official macOS binaries now install free-threading support by default

And for fun, Barry Warsaw made a text adventure through the new features: uvx --python 3.15 whatsnewt

Thanks to Hugo van Kemenade and the release team! Hugo live-posted the whole release process if you're curious what goes on behind the scenes: https://mastodon.social/@hugovk/117411399858939022


r/Python • • 3d ago

Daily Thread Saturday Daily Thread: Resource Request and Sharing! Daily Thread

11 Upvotes

Weekly Thread: Resource Request and Sharing 📚

Stumbled upon a useful Python resource? Or are you looking for a guide on a specific topic? Welcome to the Resource Request and Sharing thread!

How it Works:

  1. Request: Can't find a resource on a particular topic? Ask here!
  2. Share: Found something useful? Share it with the community.
  3. Review: Give or get opinions on Python resources you've used.

Guidelines:

  • Please include the type of resource (e.g., book, video, article) and the topic.
  • Always be respectful when reviewing someone else's shared resource.

Example Shares:

  1. Book: "Fluent Python" - Great for understanding Pythonic idioms.
  2. Video: Python Data Structures - Excellent overview of Python's built-in data structures.
  3. Article: Understanding Python Decorators - A deep dive into decorators.

Example Requests:

  1. Looking for: Video tutorials on web scraping with Python.
  2. Need: Book recommendations for Python machine learning.

Share the knowledge, enrich the community. Happy learning! 🌟


r/Python • • 4d ago

Discussion Google Open Source Blog: Adopting Pyrefly as the Python type checker at Google

180 Upvotes

The full blog post is here: https://opensource.googleblog.com/2026/10/adopting-pyrefly-as-the-python-type-checker-at-google.html

TLDR:

Google released a blog post about migrating Python type checking from the internally-developed Pytype to Pyrefly.

They cover some challenges around Pytype’s bytecode analysis & performance, along with the reasons for choosing Pyrefly: speed, typing spec conformance, and actionable error messages.

The blog also has some quotes & outlines wins from the migration:

  • Up to 98% faster incremental rebuilds
  • >90% critical-path reduction in clean builds
  • >80% compute hardware savings

r/Python • • 4d ago

Discussion Runtime overhead of wildcard import

14 Upvotes

Assuming a large project which might have say fifty variables in Constants.py is there likely to be any runtime overhead in having from Constants import * at the beginning of each module? As far as I know this creates entries for each of those variables in the current local namespace.

I know it could be done as import constants as x which after the first import then has virtually no overhead, but that then means referring to all constants as x.const1...


r/Python • • 4d ago

Daily Thread Friday Daily Thread: r/Python Meta and Free-Talk Fridays

6 Upvotes

Weekly Thread: Meta Discussions and Free Talk Friday 🎙️

Welcome to Free Talk Friday on /r/Python! This is the place to discuss the r/Python community (meta discussions), Python news, projects, or anything else Python-related!

How it Works:

  1. Open Mic: Share your thoughts, questions, or anything you'd like related to Python or the community.
  2. Community Pulse: Discuss what you feel is working well or what could be improved in the /r/python community.
  3. News & Updates: Keep up-to-date with the latest in Python and share any news you find interesting.

Guidelines:

Example Topics:

  1. New Python Release: What do you think about the new features in Python 3.11?
  2. Community Events: Any Python meetups or webinars coming up?
  3. Learning Resources: Found a great Python tutorial? Share it here!
  4. Job Market: How has Python impacted your career?
  5. Hot Takes: Got a controversial Python opinion? Let's hear it!
  6. Community Ideas: Something you'd like to see us do? tell us.

Let's keep the conversation going. Happy discussing! 🌟


r/Python • • 3d ago

Discussion Spreadsheet automation idea

0 Upvotes

I'm developing a spreadsheet automation project capable of merging multiple spreadsheets into one and automatically performing calculations, among other things. One of the functionalities would be, for example, to allow someone to gather all the spreadsheets from those months into a single spreadsheet over the course of an entire year, obtaining an overall result for the year. This could work based on week, day, month, or some other parameter. I'm having doubts, but the project seems promising. I'm using the openpyxl library and to create the website or app (I'm still undecided) I'll use HTML, CSS, and Flask.


r/Python • • 4d ago

Resource Where to learn computational neuroscience?

16 Upvotes

I heard about this online course for computational neuroscience, but i forgot the name of the website/app (I think it's a website, dik). Would any of the Redditors know more about the course or the website, which is a verified, full place to learn the field efficiently?
Oh!! It would be nice if the platform was free or cheap, cause I am broke


r/Python • • 4d ago

Discussion Title: What message broker are you using with Celery today, and why?

12 Upvotes

I'm curious how Python developers are using Celery in production and what influenced their choice of message broker.

I work with LavinMQ, an open-source AMQP message broker, and we're exploring how to make it a more compelling option for Celery users.

For those running Celery in production, what broker are you using, and what's been your experience with reliability, performance, and maintenance?

If you were starting a new project today, would you make the same choice?

I'd be interested in hearing about the trade-offs you've encountered, especially from developers running Celery at scale.


r/Python • • 4d ago

Discussion What's your approach to testing your Python code?

6 Upvotes

For small scripts I usually just try a few inputs and check if everything works.

For larger projects i fell testing needs to be more structured.

How do you personally decide how much testing a Python code needs?


r/Python • • 5d ago

Daily Thread Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

15 Upvotes

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 • • 6d ago

Discussion Python you grewI up so fast!

51 Upvotes

I received the 5th edition of Mark Lutz' 'Python Pocket Reference' today. I dug out my first edition from 1998 and found the new one is three times thicker (3/16" vs 9/16") =, 75 pages vs 254. I'm not complaining but it shows how much has been added. Thanks to all the developers and maintainers!


r/Python • • 6d ago

News Polars 2.0 release

656 Upvotes

Hey all! We just released Polars 2.0.

We are really happy with the results. It removed many of our "legacy decisions" (mistakes), makes the streaming engine our default and promotes SQL to a first class citizen within Polars. We initially said it would be a small ("boring") release, but we managed to sneak in a lot more than anticipated.

It comes with our initial out-of-core (spill to disk) support, a new Map data type and a lot of performance improvements. In fact, we think Polars is now one of the fastest analytical SQL engines on a single node. See benchmarks in the post: https://pola.rs/posts/release-polars-2/

To help you upgrade, we also posted a migration guide: https://docs.pola.rs/releases/upgrade/2/


r/Python • • 6d ago

Resource Native PyQt5 wheels for Windows ARM64 (because they don't exist upstream)

19 Upvotes

PyQt5-WinARM64: native PyQt5 wheels for Windows ARM64

I have released PyQt5-WinARM64, an independent distribution of PyQt5 for native Windows ARM64.

https://github.com/ViciousSquid/PyQt5-WinARM64

```

pip install PyQt5-WinARM64

```

The project provides WinARM64 builds of:

  • Qt 5
  • SIP
  • PyQt5

The motivation is Windows ARM development. CPython and packages such as NumPy provide native Windows ARM64 builds, but PyQt5 has not historically provided an upstream Windows ARM64 wheel.

This means a Python application can have a native ARM64 interpreter and numerical stack while still depending on an x86 PyQt5 installation and Windows' x86 emulation.

PyQt5-WinARM64 provides the missing native Qt layer.

I'm using it for Fio, a Python/Qt game editor and runtime. Fio 3.0 is moving to Python 3.14 and will have a native Windows ARM64 target.

The resulting stack is:

Windows ARM64
CPython 3.14 ARM64
PyQt5 ARM64
NumPy ARM64
Fio ARM64
OpenGL

The project is MIT licensed

The repository also contains the GitHub Actions build and PyPI publishing configuration.


r/Python • • 5d ago

Discussion Why does my test suite pass in full but fail when I run one test alone?

0 Upvotes

Ran into this last week and it took me an embarrassing amount of time.

u/pytest.fixture(scope="module")
def client():
    return make_client()

def test_create_user(client):
    client.create_user("sam")
    assert client.count_users() == 1

def test_list_users(client):
    assert client.count_users() == 1

Full run: green. Run test_list_users by itself: fails with a count of 0. The second test only passed because the first one had already run and left a user behind in the shared client.

Nothing was wrong with either test on its own. The fixture was module-scoped, so state leaked between them, and I'd never run them in any other order or in isolation, so I never saw it. Dropping the scope back to function fixed it, though it made the suite slower since make_client() isn't cheap.

I'm still not sure what the right trade-off is. Function scope is safer but slow. Module scope is faster but means every test has to clean up after itself, and I don't trust myself to remember that on the twentieth test. Running with pytest-randomly would have caught this on day one, which is its own argument.


r/Python • • 6d ago

Discussion From statically typed languages to Python and IDE IntelliSense/Auto complete

34 Upvotes

This might be a bit odd, or maybe I'm odd, I don't know.

I've been programming for 10+ years, always with statically typed languages (mainly Java, a tiny bit of Kotlin, Swift, and C many years ago). Due to a diverse set of events I wanted to learn a new language and Python looked good for it (being professionally or leisure).

But there's this thing holding me back, which is the IDE!! I'm used to IntelliJ/Eclipse and Java, where you have a string and just put the '.' and the popup just shows you the available methods. And this is mostly how I usually discover and check which operations are available on a given type and go from there.
My understanding is that due to Python being dynamic, this is not possible, or is hard to get. I've heard that now you can add types to parameters or something like that... but does it work fine in this regard? And I assume if some package doesn't have it, it's not possible, right?

So my "question" is... how do people who come from statically typed languages get around this? Do you just have the std documentation open? Or the docs on the package you're using? I know with time you just know the types and methods, but in the beginning? It seems very strange to me.

I know, maybe I'm just being picky or whatever, but maybe someone has gone through this and can share some insights.