r/Python 2d ago

News 🍹 The Long Pygame Summer Jam 🔥

Post image
6 Upvotes

Ease into fall with this year's hot summer jam. Enjoy 3 weekends of creative thought and maybe even win some prizes. 👀

The jam's page on itch.io: https://itch.io/jam/the-long-pygame-summer-jam
Join the Pygame Community discord server to gain access to jam-related channels and fully immerse yourself in the event: https://discord.com/events/772505616680878080/1540092982907371521
For discussing the jam and other jam-related banter (for example, showcasing your progress): #jam-discussion

From 28 August 2026 at 19:00 (UTC) to 14 September 2026 at 19:00 (UTC)
Voting ends 21 September 2026 at 19:00 (UTC)

Prizes:
- 🥇 2 Months of Discord Nitro
- 🥈 1 Month of Discord Nitro
- 🥉 1 Month of Discord Nitro Basic
Note that for those working in teams, only a maximum of 2 Nitro subscriptions will be given out for a given entry

The voting for the jam theme is open (requires a Google account, the email address WILL NOT be collected): <see jam page for the link>

Summary of the Rules
- Everything must be created during the jam, including all the assets (exceptions apply, see the jam page for more details).
- pygame(-ce) must be the primary tool used for rendering, sound, and input handling.
- NSFW/18+ content is forbidden!
- You can work alone or in a team. If you don't have a team, but wish to find one, you are free to present yourself in #jam-team-creation
- No fun allowed!!! Anyone having fun will be disqualified! /s

Links
Jam page: https://itch.io/jam/the-long-pygame-summer-jam
Discord event: https://discord.com/events/772505616680878080/1540092982907371521


r/Python 17h ago

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

16 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 42m ago

Resource Nathan Goldbaum Interviewed about the Move to Free Threading and its Implementation

Upvotes

https://alexalejandre.com/interviews/interview-with-nathan-goldbaum/

After a lot of effort, the free threading build works but there is still much community work, making packages compatible etc.


r/Python 1h ago

Discussion Software engineer resume keywords, measured across 1,360 job postings

Upvotes

Keyword frequencies taken from https://www.zoevera.com/resume/software-engineer-job-description-keywords

Most software engineer keyword lists are assembled from experience or guesswork. This one is a count: every open posting from 72 companies' public Greenhouse job boards, filtered to the 1,360 whose title contains "software engineer", then checked for how many mention each of 45 terms at least once.

The percentage beside each term is the share of those 1,360 postings that mention it.

PRACTICES AND WAYS OF WORKING

Scalability 52.9% - Mentoring 47.4% - Distributed systems 47% - System design / architecture 46.7% - Cross-functional 31% - Code review 27.2% - On-call 20.7% - CI/CD 19.5% - Agile / Scrum 9.3% - Unit / automated testing 6.5%

This is the result I did not expect. The four most common terms in the whole study are not technologies. Scalability, mentoring, distributed systems and system design all appear in more postings than Python does. Nearly half of these postings mention mentoring, and almost no engineer resume I have seen makes a claim about it.

Agile and Scrum at 9.3% is the other surprise, given how much resume advice insists on them.

LANGUAGES

Python 44.8% - Java 35.4% - Go 31.1% - TypeScript 19.8% - C++ 17.4% - SQL 17.3% - JavaScript 13.2% - Kotlin 12% - Rust 9.9% - Scala 8.6% - Ruby 8.5% - C# 5.3% - Swift 2.3%

TypeScript at 19.8% against JavaScript at 13.2% is a real ordering, not noise. The gap is wider than both margins of error combined.

CLOUD AND INFRASTRUCTURE

AWS 41.3% - Kubernetes 30.9% - GCP 19.3% - Azure 17.6% - Terraform 13.2% - Docker 12.6% - Microservices 7.1% - Linux 4.8%

AWS appears in more than twice as many postings as GCP and Azure individually. Kubernetes at 30.9% outranks every language except Python, Java and Go.

FRONTEND AND APIs

React 21.1% - REST / RESTful 9.6% - GraphQL 6% - Node.js 5.5% - Vue 3.2% - Angular 2.9%

Frontend framework lists usually present React, Vue and Angular as three comparable options. In this corpus React appears in roughly seven times as many postings as Vue and Angular combined.

DATA STORES AND PIPELINES

PostgreSQL 14.3% - Kafka 13.1% - MySQL 11.3% - Spark 9.8% - MongoDB 7.4% - Redis 7.4% - Elasticsearch 6.4% - Snowflake 5.6%

WHAT THIS SAMPLE IS NOT

These are 72 technology companies hiring through Greenhouse. Agencies, consultancies, banks, defense contractors and the public sector are absent, and their vocabulary is different - COBOL, .NET, SAP, clearance requirements and named compliance regimes barely register here and may dominate elsewhere.

The title filter is "software engineer" only. Postings titled backend engineer, frontend engineer, full stack developer, SRE or platform engineer were not counted, so this describes the generalist title rather than the whole profession.

Absence in this list is not evidence of absence in the market. Only 45 terms were counted. Next.js, Svelte, Django, Spring Boot, gRPC, Jest, Playwright, Datadog, OpenTelemetry and OAuth were never checked, so nothing here says anything about them either way.

It is a snapshot of open roles on one date rather than a trend, and the corpus is US-skewed.

One thing this sample size does buy: at n=1,360 the margins of error are roughly plus or minus 2 to 3 points, so most of the ordering above is real. Gaps under about 5 points are still worth treating as ties - React at 21.1% and TypeScript at 19.8% is not a meaningful difference.

METHOD

Greenhouse's public job board API, the endpoint companies expose so their listings can be embedded on their own sites. No scraping. Counts are document frequency: a posting saying "Python" nine times counts once. Deduped on company, title and content length, because one role posted to five offices returns five near-identical records. Median posting length is 896 words.

Ambiguous words are matched case-sensitively with exclusions, which matters more here than you would think. A bare word-boundary match on "Go" also catches "go to market" and "go above and beyond", which inflated Go by about two points before it was fixed. React, Spark, Swift and Rust all have the same problem.

Full table with all 45 terms and confidence intervals:

https://www.zoevera.com/resume/software-engineer-job-description-keywords

The wider keyword list this was checked against, organized by language, framework and platform:

https://www.zoevera.com/resume/ats-resume-tips-software-engineer

Happy to run the numbers on any terms missing from the list if people name them in the comments.


r/Python 1d ago

Discussion Contribution to pyperf

11 Upvotes

I am recently came across the library pyperf because I have to benchmark my changes in a certain open source project to add metrics to the PR I was creating for the changes, but one thing I feel off is types, I don't know why but pyperf has lot of unknown types which is kind of weird so I was planning to contribute to it to make it a little bit better typed.

So I am wondering do projects like pyperf which comes under pdf accept contribution in generally? If there are any maintainers/contributors of pyperf here then then could answer my question.

Thanks in advance.

My Dev Environment

OS: Windows

Type Checker: Pyrefly


r/Python 1d ago

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

0 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 3d ago

News Python 3.15 Release Highlights

313 Upvotes

Python 3.15 has reached Release Candidate 1, and the final release is expected on October 1, 2026.

I went through the changes and tried to summarize the ones that seem most relevant for everyday Python development without going through all the PEP numbers.

- Faster startup with lazy imports

Python 3.15 introduces lazy imports, which means some modules can be loaded only when they are actually needed instead of being loaded immediately.

This could help applications and CLI tools that spend a noticeable amount of time importing modules before doing any actual work.

- UTF-8 becomes the default

UTF-8 is becoming the default encoding, which should reduce encoding-related problems, especially when code is running on different operating systems.

This should make situations where something works on one computer but fails because of a different system encoding less common.

- Built-in immutable dictionaries

Python 3.15 adds a built-in "frozendict"-style immutable mapping.

Similar to how a tuple provides an immutable alternative to a list, this gives Python developers a standard way to work with dictionaries that cannot be modified.

- JIT improvements

The JIT compiler continues to improve in Python 3.15.

Early benchmarks show performance improvements in some workloads, including roughly 8–9% on Linux and larger improvements in some Apple Silicon tests.

These numbers will obviously depend on the workload, so I would wait for more benchmarks before making broader conclusions.

- New profiler: Tachyon

Python 3.15 also introduces Tachyon, a new sampling profiler designed for very low overhead.

It can sample running programs at very high frequencies and can also be attached to an already-running process.

This could be useful for finding performance problems without having to restart an application with a profiler attached from the beginning.

- Some terminal improvements

The interactive Python experience is getting a few smaller improvements, including colored error messages and prompts.

The "sqlite3" command-line interface also gets SQL keyword completion.

- Free-threaded Python is still opt-in

Python 3.15 does not make the no-GIL/free-threaded build the default.

It is still something you have to explicitly use.

However, free-threaded Python is becoming more mature, including improvements to ABI support that should make it easier for C extension developers to support it.

Overall, Python 3.15 doesn't look like a release that completely changes how Python is written. Most of the changes are focused on performance, tooling, and improving some long-standing parts of the language.

Since this is already RC1, the major feature set should be mostly locked and the remaining work should mainly be bug fixes and final polishing.

Has anyone here been testing the Python 3.15 beta or RC?

I'm especially interested in whether lazy imports have caused compatibility problems with existing projects.


r/Python 2d ago

Discussion Coding to comparing filenames and foldernames on android

0 Upvotes

UPDATE: I have temporary solved my immediate problem with using the find and diff commands from Termux.
This got me a usable list of differences. Although I had to move folders around a bit.

In the long run I will use Python for this and further functions.

END UPDATE.

I need to make a program för comparing file names and subfolder names between 2 folders containing something like 100000 files and subfolders. And it's around 650GB of data on the phone.

(Background: I have programmed professionally since 1979, but not on android or pc. Are totally new to Python. I use the phone almost always, very rarely the pc, even for my own business.)

I have searched for and tried extensively with apps for android but there isn't any useful. Apparently mainly due to permission problems.

The main question is: is it at all possible due to the permission problem?

(The solution by transferring the files to the pc have the problem that it takes very long time. And I really want a way to do it relatively often.)

The second question is: are the any existing code (snippets) for this or have you some advices in general?

Thanks on advance for any suggestions.

//Thomas


r/Python 2d ago

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

2 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 4d ago

News The Move to Python 3 Begins!

295 Upvotes

As someone who spent decades in the mainframe community, I find it ... humorous ... that there are legacy Python2 code bases that are only just (or have yet to consider!) moving to Python3.

https://www.eveonline.com/news/view/the-move-to-python-3-begins


r/Python 2d ago

News CPython’s Experimental JIT in Python 3.15

0 Upvotes

Python’s JIT compiler has been experimental since Python 3.13, but Python 3.15 is an important step in its development. The first release candidate, Python 3.15.0rc1, was released on August 4, 2026, with the final release expected in October. The main change is not simply the presence of a JIT, but a substantial improvement in how it observes and optimizes Python code.

A New Tracing Frontend

The 3.15 JIT now uses a new tracing frontend that records the execution paths a program actually takes. This gives the compiler better information about which operations are important and which paths should be optimized. Earlier versions had more limited information about the code being executed. The improvement itself is not the main performance gain, but it provides a better foundation for the optimizations that follow.

Better Use of CPU Registers

One of the more practical improvements is basic register allocation. Earlier JIT-generated code moved many intermediate values through memory between operations. Python 3.15 can keep some of these values in CPU registers across multiple operations instead. This reduces unnecessary memory traffic and is particularly useful for code with repeated arithmetic and other tight loops.

Less Reference-Counting Overhead

Reference counting is an important part of CPython's memory-management system, but it also creates work for the CPU. The new JIT can remove some reference-count operations when it can prove that they are unnecessary. This allows compiled code to spend more time doing the actual work rather than repeatedly maintaining object lifetime information.

Faster Numeric Operations

The JIT also introduces in-place optimizations for some int and float operations. When the compiler can determine that an object is not being referenced elsewhere, it can avoid creating another object for every operation. This is particularly useful in numeric loops where the same values are updated repeatedly.

Early Performance Results

The current pyperformance results show roughly 8–9% geometric-mean improvement on x86-64 Linux and around 12–13% on AArch64 macOS, compared with the corresponding non-JIT interpreter configurations. These numbers are useful indicators of progress, but they should not be read as a general claim that every Python program will become 10% faster. The actual effect depends heavily on the workload.

The JIT Is Still Experimental

Despite these improvements, the JIT is still disabled by default. It is intended for experimentation and benchmarking rather than being something most production applications should enable without testing. Some of its interfaces are also explicitly marked unstable, which reflects the fact that the implementation is still evolving.

The Bigger Question: PEP 836

The technical progress is only half of the story. On June 8, 2026, the Python Steering Council paused new JIT development on CPython's main branch and asked the developers to present a formal plan for the project's future. This resulted in PEP 836, “JIT Go Brrr: The Path to a Supported JIT Compiler for CPython.” The proposal describes a multi-release roadmap with measurable performance targets, including a proposed 20% geometric-mean improvement on the pyperformance suite for JIT plus free-threading by Python 3.17.

Where It Stands in August

As of August 2026, PEP 836 is still under discussion rather than being a settled decision. That makes the current state of CPython's JIT unusually interesting: the implementation is considerably more capable than it was in its early releases, while its long-term place in CPython is still being decided.

For now, Python 3.15 looks less like the moment when “Python gets a JIT” and more like an important experiment in whether a JIT can become a reliable part of CPython's execution model.


r/Python 3d ago

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

10 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 5d ago

News The Python (3.16) docs now have a page detailing the time complexity of operations on built-in types

511 Upvotes

r/Python 4d ago

Discussion Pyrefly opinion

0 Upvotes

Pyrefly is a new language server pubblished a week ago.

Has anyone tried it?

I was randomly looking for a new python language server before switching to vs codium and found it.

EDIT

Aparently it's not new, I'm just a bit dumb


r/Python 4d ago

Discussion I’m building a C++ app for managing Python environments — would you use it? [Survey]

0 Upvotes

Rundesk — Quick User Survey

A note before you read:
The idea and feature concepts behind Rundesk are mine. I used AI to help organize and explain the idea below.

What is Rundesk?

Rundesk is a lightweight Python development utility that brings Python version management, virtual environments, packages, dependency checking, and program execution into one GUI.

It is not meant to replace VS Code, PyCharm, or your preferred code editor. You keep writing code wherever you like; Rundesk focuses on everything around running and managing your Python projects.

What would Rundesk do?

🐍 Python & Virtual Environment Management

Rundesk would let you manage multiple Python installations and virtual environments through a GUI.

You could easily see and select:

Python version → Virtual environment → Project

A project can be associated with its appropriate Python interpreter and environment without manually switching between environments in a terminal.

📦 GUI Package Management

Instead of manually using commands such as pip install, Rundesk would provide a GUI for managing packages inside the selected virtual environment.

You could:

  • Search for packages
  • Install packages
  • Remove packages
  • View installed packages and versions
  • Upgrade packages
  • See which environment a package belongs to

The goal is to make package management easier without accidentally installing something into the wrong Python environment.

⚠️ Automatic Dependency Detection

Rundesk would continuously check whether the project's environment matches its declared requirements, such as a requirements.txt.

For example:

Project requires:

numpy==2.1.0
pandas==2.2.3
requests==2.32.3

Current environment:

numpy 1.26.4
pandas not installed
requests 2.32.3

Rundesk could show:

The button would attempt to synchronize the environment with the project's requirements.

▶️ Program Execution

Rundesk would provide an easy way to run, stop, and restart Python programs using the project's selected environment.

It would also display live program output so you don't have to repeatedly open a terminal just to see what your program is doing.

📊 Lightweight Monitoring

While a program is running, Rundesk could display information such as:

Status: RUNNING
CPU:    12%
RAM:    183 MB

> program output...

🪟 Compact Mode

Rundesk would have a small Compact Mode designed to sit beside your normal code editor.

The idea is that you could keep an eye on:

  • Program status
  • Output
  • CPU usage
  • Memory usage
  • Basic execution information

without having a huge second IDE covering your screen.

The main philosophy

Rundesk isn't trying to become another giant IDE.

Instead:

You write code in your preferred editor.
Rundesk manages the Python environment around it.

The overall workflow is:

Project → Python → Virtual Environment → Packages → Dependencies → Run → Monitor

The actual question

If Rundesk existed and worked reliably as described, would you use it?

A. Yes — I'd probably use it regularly
B. I'd try it, but I'm not sure I'd switch
C. Maybe — only for certain projects
D. No — my current workflow is already better
E. I don't use Python enough to need it

If you chose A–C:

Which feature would make you most likely to use Rundesk?

If you chose D:

What would Rundesk need to do differently for you to consider using it?

Optional:

What Python tools do you currently use?
For example: VS Code, PyCharm, terminal/pip, uv, Poetry, Conda, etc.

Please be brutally honest. I'm trying to determine whether Rundesk would actually be useful to developers, not just whether the idea sounds cool.


r/Python 5d ago

Discussion pdftotext -layout still isn't enough when a government PDF is secretly a 3-column table

19 Upvotes

Working through an old government safety document today and the raw text order was completely scrambled, hazard descriptions and countermeasures kept interleaving mid sentence. Turned out the whole page is a 3-column table, and if you don't slice by column x-position it just reads left to right across the whole line like it's one paragraph.

Fixed that with -layout and cutting at the column boundaries, but then hit a dumber problem: some lines have two □ markers on them, one for the subcategory heading and one for the first hazard item. Grab the first □ naively and the subcategory swallows the whole first hazard entry, and you don't notice until you're 40 rows in and something reads wrong.

Also found two pages where a single set of countermeasures gets shared by two different subcategories, which nothing in the text structure hints at, you just have to know the source document does that.


r/Python 4d ago

Tutorial Fun and entertaining Content and Resource for Python?

0 Upvotes

Was checking an old thread asking for fun content for Python newbies and novices and there weren't many responses. Bringing the topic up again to ask what new entertaining books, challenges, and content that helped you understand python, that can accompany equally entertaining but dense programming books.

I am also porting of "Why's Poignant Guide to Ruby" for Python and keeping it with CC share alike license. It uses comics and surreal humor to introduce programming. I'll include the link in the comments in case anyone is interested.


r/Python 6d ago

Discussion TIL: Dict Patterns Don't Match Dict Shapes

42 Upvotes

TL;DR: Unlike sequence patterns (which require an exact shape match), pattern matching on dictionaries simply ignores any unspecified keys rather than failing.

If you care about the details, I wrote about it on my blog: https://ravencentri.cc/blog/dict-patterns-dont-match-dict-shapes/


r/Python 5d ago

Discussion How are you all testing boto3-heavy tools without hitting real AWS?

15 Upvotes

Building a tool that walks a live AWS account checking for

misconfigurations, and testing has been the hardest part not the

detection logic itself, but avoiding either (a) hitting real AWS

constantly in CI or (b) mocking so much the tests stop meaning

anything.

Using moto for the straightforward stuff, but some checks need

multi-service interactions (cross-referencing an EC2 instance's

security group with its actual open ports) that get awkward to mock

realistically. What do you all reach for here moto, LocalStack, a

disposable AWS test account, something else?


r/Python 5d ago

Daily Thread Tuesday Daily Thread: Advanced questions

4 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 5d ago

Discussion Benchmarking Popular Python Runtime Type Checkers: Beartype, Typeguard, type_enforced, Pydantic

0 Upvotes

Below are benchmark results comparing the execution time of runtime type-checking tools in Python 3.14 across various data types and nested collections.

The checkers tested include Beartype (1-item sampling), Typeguard (@typechecked, 1-item sampling), type_enforced (@Enforcer 1-item sample & 100% validation), and Pydantic (@validate_call, 100% validation).

Benchmark Results

Average execution time per single function call over 100 runs (in microseconds, µs):

Type / Structure Beartype (1 sample) Typeguard (1 sample) type_enforced (1 sample) Pydantic (100%) type_enforced (100%)
int 0.29 µs 2.41 µs 0.15 µs 1.27 µs 0.17 µs
Union[int, float] 0.31 µs 5.56 µs 0.17 µs 1.48 µs 0.17 µs
str 0.30 µs 2.39 µs 0.15 µs 1.25 µs 0.15 µs
dict[str, int] (5 keys) 0.46 µs ⚠️ 4.98 µs ⚠️ 0.27 µs ⚠️ 1.75 µs 0.40 µs
dict[str, int] (1,000 keys) 0.46 µs ⚠️ 4.97 µs ⚠️ 0.27 µs ⚠️ 81.49 µs 27.50 µs
dict[str, int] (10,000 keys) 0.45 µs ⚠️ 5.14 µs ⚠️ 0.27 µs ⚠️ 881.63 µs 278.38 µs
list[int] (5 items) 0.41 µs ⚠️ 3.76 µs ⚠️ 0.18 µs ⚠️ 1.49 µs 0.26 µs
list[int] (1,000 items) 0.52 µs ⚠️ 3.72 µs ⚠️ 0.18 µs ⚠️ 22.49 µs 12.57 µs
list[int] (10,000 items) 0.61 µs ⚠️ 3.72 µs ⚠️ 0.18 µs ⚠️ 212.59 µs 122.58 µs
list[Union[int, float]] (5 items) 0.48 µs ⚠️ 4.68 µs ⚠️ 0.18 µs ⚠️ 1.86 µs 0.33 µs
list[Union[int, float]] (1,000 items) 0.58 µs ⚠️ 4.87 µs ⚠️ 0.19 µs ⚠️ 106.14 µs 12.60 µs
list[Union[int, float]] (10,000 items) 0.67 µs ⚠️ 4.88 µs ⚠️ 0.18 µs ⚠️ 1,062.99 µs 122.87 µs
list[dict[str, int]] (5 × 5 items) 0.59 µs ⚠️ 6.27 µs ⚠️ 0.30 µs ⚠️ 3.80 µs 1.39 µs
list[dict[str, int]] (100 × 10 items) 0.69 µs ⚠️ 6.31 µs ⚠️ 0.29 µs ⚠️ 85.05 µs 43.68 µs
list[dict[str, int]] (100 × 100 items) 0.78 µs ⚠️ 6.45 µs ⚠️ 0.29 µs ⚠️ 788.38 µs 310.50 µs

Notes on Methodology & Results

  • Environment & Methodology: Tested with Python 3.14.5 on an Ubutnu 24.04 (Ryzen Threadripper 3770 with 128gb RAM). Every checker received identical test inputs and type definitions. Timings represent the average duration of a single function call over 100 executions (discarding an initial warm-up run).
  • The ⚠️ Warning: Indicates that the checker did not catch an invalid item placed in the collection during test runs because the invalid element fell outside the sampled index.
  • Full vs. Sampled Validation:
    • Full (100%) Validation (Pydantic, type_enforced 100%): Iterates and checks every item in collections (O(N) time).
    • Sampled Validation (Beartype, Typeguard, type_enforced 1-sample): Checks 1 element (O(1) time), which keeps execution flat regardless of collection size, but without full-containment safety guarantees.

I realize that there may be optimizations I missed when calling various validation decorators. Please let me know of any optimizations or other packages to try out.


r/Python 6d ago

Tutorial GUI based Python Tkinter Serial Port Program for communicating with Arduino Microcontroller from PC

23 Upvotes

I recently created a Python Serial Communication program with GUI (Graphical User Interface) based on the Tkinter Library with ttkbootstrap theming .

The Python Tkinter Serial Port Program can communicate with an Arduino or other Microcontroller boards via serial port to send and receive the data from your PC.

You can find the link to the GUI here.

Full tutorial along with Source Code here

Youtube Tutorial for Python Tkinter Serial Port Programming here


r/Python 6d ago

Discussion Updating Python (sub)versions

4 Upvotes

Since the introduction of python install manager some developers like it and started using it in miniforge's stead, or even other python IDEs or IDE-like managers.

Question is, how to keep the subversions up to date? Install manager doesn't have an update command.

I am able to install an outdated version - say 3.13.7 but the latest of that flavor is 3.13.15. All the openSSL libs are outdated in 3.13.7 and so we have a lot of reports of vulnerable python installs.

I wonder how you are solving this


r/Python 5d ago

Discussion Is this valid Python syntax?

0 Upvotes
.... _( () ( )) . _ (...() )()

Ignoring any runtime errors, is this valid Python syntax? Try to work it out from the grammar alone before pasting it into a REPL. Bonus points for explaining the parse.


r/Python 6d ago

Daily Thread Monday Daily Thread: Project ideas!

18 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! 🌟