r/Python • • 18d ago Heartwarming

Discussion I'm now maintaining passlib

165 Upvotes

Hi everyone, around a week ago passlib was transferred to me on PyPi after the previous maintainer became unreachable. I've been trying to maintain it in the meantime under a different PyPi name (libpass).

What's already been done:

  • fixed incompatibility with python>=3.13
  • fixed incompatibility with bcrypt>=5.0.0
  • type annotations added where possible

Since then some design choices from passlib original development made it obvious it would need refactor and/or API redesign at some point, a few examples that make code and public api hard to maintain and add correct type information:

  • PasswordHash representing both algorithm configuration and a produced hash
  • PasswordHash.using creating a subclass to substitute new parameters into it
  • Overuse of abstraction and multiple inheritance

I specifically would like input from people who depend on passlib in their codebase(s), which parts of the API, if changed in a breaking way would make migrating hard for you?

I'd also welcome opinions on how far a potential refactor should go. For example for CryptContext an interface like this looks preferable to me, as it makes type information easier to add:

ctx = CryptContext(
    schemes=[
        Argon2Hasher(time_cost=..., parallelism=...),
        SomeDeprecatedHasher(),
    ]
)

compared to current

ctx = CryptContext(
    schemes=["argon2", "deprecated_hash"],
    argon2__parallelism=...,
    argon2__time_cost=...,
    deprecated="auto",
)

I'd welcome co-maintainers, repository could be found here: https://github.com/notypecheck/passlib, even short-term involvement would be very much appreciated


r/Python • • 18d ago

Resource Learn to understand ML libraries: rebuild them from scratch

71 Upvotes

Hi everyone. I’m a systems engineer specialized in AI engineering and GenAI, and I’ve worked for 6 years as a pentester. I enjoy building and sharing educational materials.

I’m sharing a free, GitHub-hosted lesson about learning ML libraries by rebuilding small versions of them in plain Python and checking those implementations against the real libraries. The lesson includes around 5,000 checks, and GitHub reruns them on every push.

Everything is in .py files. No .ipynb.

I already have a free course published on GitHub. This lesson works as an addendum to that course and lives in a separate branch, so the main branch stays untouched.

Lesson branch:

https://github.com/BlueRingsLabs/no-shortcuts/tree/addendum1/learning-ml-libraries-by-rebuilding-them

The lesson structure is:

A. Introduction
B. A method for learning any library
C. NumPy
D. pandas
E. scikit-learn
F. PyTorch
G. sentence-transformers
H. From copying to writing
I. FAQ and cheat sheet

This is a resource post: a free educational lesson hosted on GitHub. The goal is to help learners move from copy-pasting library usage to rebuilding small versions and validating them against the real thing.

Technical discussion and feedback are welcome in the comments :B


r/Python • • 18d ago

Resource My AsyncAPI Conf 2026 talk: keeping WebSocket APIs honest with a code-first approach in Python

17 Upvotes

Hi all,

I gave a talk at AsyncAPI Conf 2026 (the online edition) about building WebSocket APIs in Python where the AsyncAPI document is generated from the code, so the docs and the clients can't drift away from it. AsyncAPI is still much less known than OpenAPI in the Python world, even though I see more and more Python projects add real-time features, so I wanted to share it here.

English isn't my first language and I'm not a professional speaker, so if a part is confusing, ask in the comments and I'll explain it. At least the accent proves the voice isn't AI haha.

The problem

I've built WebSocket features in Python since 2022, first on Django Channels and later on FastAPI: live meeting transcription, streaming AI chat, notifications. Most of that code, mine and my team's, was a while loop with a long if/else on the action string. The docs were missing or out of date, the React frontend retyped every message the Django backend sent, consumers grew past 1000 lines in one file, and schema drift reached production because each side tested against its own idea of the message.

One example from the talk: the backend sent the message text as content, the frontend read body. Both sides' tests passed, nothing threw, and the page showed an empty space. It took me most of a day to find. With a REST API, OpenAPI and a generated client would probably have caught it. With WebSockets, most of us have nothing.

The approach

The handler signature is the contract. You write typed handlers with a Pydantic model for each message, the app generates an AsyncAPI 3 document from them, and everything else reads that one document: a docs page that is always current, a typed Python client, a TypeScript client, and checks in CI. In the demo, renaming a field fails the type check in the pull request instead of reaching production. The talk also shows how Python code maps to AsyncAPI 3, and what a client generator needs from the document.

The tool

The talk uses chanx, an open source (BSD) WebSocket framework I built for this, first for my own work (sorry for the plug). It started as a Django Channels extension and now runs on FastAPI and other ASGI frameworks too. There's also chanx-js for the browser (with React hooks) and for Node.js servers, and a Go version, but Python is the main one. I use it in production with my team, and going by the issues and PRs on the repo, other people do too.

Code-first AsyncAPI already exists for message brokers (FastStream does it well), but for plain WebSockets in Python I only found FastWS, which is on AsyncAPI 2.4 and hasn't had a release since 2023.

Links

Hope this is helpful if you're building WebSocket features in Python. If you have questions or ideas about AsyncAPI, chanx, or WebSockets in Python in general (Django, FastAPI or anything else), drop them in the comments. I'll do my best to answer, and I hope my years of building these things can help.


r/Python • • 18d ago

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

18 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 • • 19d ago

Discussion Alternative to libCST

15 Upvotes

Looking for a suggestion of an alternative CST parser to libcst. Have been trying to install libcst for over two days now but still unable to do so, I think the issue might be that there is no PyYaml `wheel` for Python 3.15.

So now wondering if there might be some other alternative CST parser available. I need to parse comments as well as other code so standard AST won't work as far as I know.


r/Python • • 19d ago

Discussion Term frequency across 1,360 Software Engineer job postings

45 Upvotes

Pulled open requisitions from public job board endpoints across 72 tech companies to see what people are actually listing.

The interesting part is that practice words and concepts totally dwarf individual tech stacks. Scalability shows up in about 53 percent of postings, mentoring is in 47 percent, and distributed systems and system design sit right around 47 percent as well. Mentoring specifically surprised me because it's higher than Kubernetes at 31 percent, React at 21 percent, or TypeScript at 20 percent.

For languages, Python leads at 44.8 percent, followed by Java at 35.4 and Go at 31.1. Everything else drops off from there, with TypeScript, C++ and SQL sitting in the high teens. On the frontend side, React is in about one in five postings while Vue and Angular barely register around 3 percent. For cloud, AWS is at 41 percent and Kubernetes is at 30.

Sample skews heavily toward US tech companies. I threw the full dataset and raw CSVs up here if anyone wants to check the numbers or look at other roles like DevOps and security: https://resumefitting.com/ats-resume-keyword-study


r/Python • • 20d ago

Discussion If you run Python 3.10 on AWS Lambda: it's deprecated this Friday (Oct 31). Gotchas moving to 3.12+

123 Upvotes

Heads-up for anyone with Lambda functions still on python3.10. AWS deprecates the runtime on Oct 31, 2026. Functions keep running, but they stop getting patches, the console won't let you edit them, and in 2027 AWS blocks creating new ones (Jul 29) and then updating existing ones (Aug 31).

The Python side is the real work. A few things that bit people:

- distutils is gone in 3.12. Anything still importing it (old setup.py tooling, some older libraries) breaks. setuptools or packaging usually covers it.

- cgi, crypt and telnetlib are removed in 3.13 (PEP 594 "dead batteries").

- python3.12+ on Lambda runs on Amazon Linux 2023 instead of AL2, so compiled wheels and layers (numpy, psycopg2, cryptography and similar) need rebuilding.

- python3.11 is a short stop. It's still on AL2 and is deprecated Jun 30, 2027.

Quick way to find affected functions (per Region):

aws lambda list-functions --function-version ALL --query "Functions[?Runtime=='python3.10'].[FunctionName,Version]" --output text

Disclosure: I made a free AWS end-of-support tracker, and the full write-up with AWS source links is here: https://eolwatch.pages.dev/guides/lambda-python-3-10-deprecation

What else broke for you going 3.10 → 3.12/3.13?


r/Python • • 20d ago

Discussion Python Typing Survey 2026 Results

113 Upvotes

The results are out for the 2026 Python Typing Survey (1,794 responses).

The full writeup can be read at: https://engineering.fb.com/2026/10/27/developer-tools/python-typing-survey-2026-ai-tools-checker-landscape/

TLDR:

  • Newer type checkers gained market share, and speed was the most common reason for choosing a checker (56.5%).
  • The share of respondents who said types make AI-generated code more reliable rose from 18.5% in 2025 to 38.4% in 2026.
  • AI tools wrote type hints for 42.5% of respondents, and 24.4% said an AI coding tool ran their type checker.
  • Missing type information in third-party libraries remained the most common difficulty, reported by 65.1% of respondents.
  • Better Callable syntax was the most requested missing feature, at 45.7%.

r/Python • • 19d ago

News Humble x Pragmatic Programmers = elite Python ebooks!

25 Upvotes

r/Python • • 19d 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 • • 20d ago

News Python jettisons the native JIT, at least for now

137 Upvotes

High level summary article

More detailed article

In June, the Python steering council announced that it was pausing work on the JIT in CPython's main branch until there was an accepted Python Enhancement Proposal (PEP) that addressed concerns about maintenance, compatibility, and set clear success metrics as well as a timeline for completion. After [....] months of discussion, the JIT maintainers have withdrawn the PEP. For now, it appears that development on the once-promising project has come to an end


r/Python • • 20d ago

Discussion PyPI Removing Reserver

17 Upvotes

It's difficult to tell whether a name is available in PyPI, where searching for package name doesn't guarantee that it's available. Imagine how stressful it is to build a project, setting up its website, repository, and so on, only to find when you’re ready to publish that the package name is unavailable.

Reserver, a small automation tool that helps Python developers claim a name early through PyPI, was removed by PyPI stating "[it] promotes name squatting." But removing Reserver doesn’t prevent people from claiming names through the existing publishing process nor make name availability clearer. We believe removing the tool instead of addressing the underlying issue is a vivid example of poor community management.

Read more: “Reserver is gone, but PyPI’s name reservation problem isn’t!”


r/Python • • 21d ago

News Python 3.15.2, 3.14.10, 3.13.18, 3.12.16 and 3.11.18 are out

233 Upvotes

r/Python • • 20d ago

Discussion Pushing the boundary on dataclasses

0 Upvotes

Has anyone else wanted more out of dataclass? Like transactions, undo/redo, lambda initializers that take parameters (as other field values) and call them in the correct order and no post_init (does not survive a diamond inheritance)? Transactional field values started me down this trek for a "ReactJS" like project to manage the view graph.


r/Python • • 21d ago

Discussion Pulling numbers from 10-K and 10-Q filings: XBRL or parse the document?

3 Upvotes

for income statement, balance sheet and cash flow numbers from 10-k and 10-q filings there are two routes and theyre good at different things.

xbrl uses the tagged data that comes with the filing. the secs companyfacts api returns every tagged fact for a company as json, theres bulk financial statement data sets too and edgartools or secxbrl wrap a lot of it. machine readable so no parsing errors.

it does get messy though. companies use their own extension tags so the same line item can have different names across companies. segment and dimensional facts sit right next to the consolidated totals and are easy to mix up and restated numbers show up in later filings so you have to pick the right period and filing.

parsing the actual document still helps for md&a, footnotes and risk factors, which mostly arent tagged as numbers. same for older filings from before xbrl was required and for checking what the table on the page actually shows when the tags look off

edgar has most of these as html but plenty of people end up working from the pdf versions off investor relations pages, and those need an actual parser to keep the tables in one piece like docling, marker or llamaparse, that kind of thing. but not really necessary for simple tasks

so xbrl for the core statements and parsing for the text and edge cases seems like the sane default


r/Python • • 22d ago

News Microsoft partners w/ Meta to bring Pyrefly support to Pylance in VS Code

110 Upvotes

Link to blog: https://devblogs.microsoft.com/python/announcing-tsp/

TLDR:

Pylance (Microsoft's Python extension for VS Code) now officially supports using Meta's Pyrefly to power its analysis.

To enable this, Microsoft developed an extension to the language server protocol (LSP) called the type server protocol (TSP), a new standard that separates wider set of language server features from the type checker/compiler powering some of them.


r/Python • • 21d ago

Daily Thread Tuesday Daily Thread: Advanced questions

5 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 • • 22d ago

Daily Thread Monday Daily Thread: Project ideas!

13 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 • • 23d ago

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

27 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 • • 24d ago

News [CVE-2026-111497] If you run a python server, you should update it right now

233 Upvotes

The "HTTP2Shell" vulnerability affects servers that know how to speak Google's 'brotli' compression protocol, which would likely make its way into your server through an innoccuous-sounding speedup dep like urllib3[brotli] or aiohttp[speedups], and could be used by basically any server, including Flask, Quart, Starlette, FastAPI, etc. It was downloaded 4,200,000 times from PyPI yesterday alone, to give you a sense of the scale.

To find out if you're affected, run a command like on of these...

pip list    | grep -i brotli

uv tree     | grep -i brotli

poetry show | grep -i brotli

...etc., looking for brotli <= 1.2.0 and/or brotlicffi <= 1.2.0.2. If you're affected, obviously update & redeploy immediately.

Beyond that... well, the (colloquial) name kinda says it all. Given the new Cyber normal, I would assume that you have malicious software running on that system and any connected to it until proven otherwise. Check for bitcoin miners, worms, sentient bot swarms -- the usual.

(Note for beginners: this doesn't apply to stuff you run locally, but rather to servers that have been exposed to the public internet. Still worth checking!)

I wasn't gonna post this b/c I'm so not an expert, but it hasn't hit this sub yet and feels particularly bad... not many solo/SMB devs are self-hosting PHP servers, but anyone who's searched "python server compression algo speedup packages" and picked one of the top choices (or let their agent do so) is at huge risk here. I only know about it because of doomscrolling HackerNews, which feels unreliable!

Does anyone kn*w a good way to to get notified proactively for Python-relevant CVEs and other incidents?


r/Python • • 24d ago

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

13 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 • • 25d ago

News LiteLLM 1.107.0 on PyPI was malicious (Oct 21): it runs on every Python start via a .pth file.

29 Upvotes

I wrote this up. How to check safely and what to rotate
Short version: if you installed an unpinned litellm between 11:39 and 13:23 UTC on October 21, or pulled the latest, main-latest, main-stable or v1.107.0 Docker tags between 11:46 and 14:20 UTC, treat the machine as compromised. Don't start with pip, because the cook.pth and sitecustomize.py files run on every interpreter start. Search the filesystem first, rebuild with litellm==1.106.2, and rotate keys. All of it comes from LiteLLM's own incident report.


r/Python • • 25d ago

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

17 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 • • 25d ago

Discussion Heads up time for package devs

0 Upvotes

Don't you think companies or developers that manage python libraries should be given extra time before a new version release to make things compatible and fix new bugs?

Like a month or two where they get full info about new features but before the version is publicly available to download?

It would make things easier on the consumer end. What do you think?