Writing Python like it's Rust

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Scout Monitoring - Free Django app performance insights with Scout Monitoring
Get Scout setup in minutes, and let us sweat the small stuff. A couple lines in settings.py is all you need to start monitoring your apps. Sign up for our free tier today.
www.scoutapm.com
featured
InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
www.influxdata.com
featured
  • pyre-check

    Performant type-checking for python.

  • Scout Monitoring

    Free Django app performance insights with Scout Monitoring. Get Scout setup in minutes, and let us sweat the small stuff. A couple lines in settings.py is all you need to start monitoring your apps. Sign up for our free tier today.

    Scout Monitoring logo
  • pytype

    A static type analyzer for Python code

    What is the smart money doing for type checking in Python? I've used mypy which seems to work well but is incredibly slow (3-4s to update linting after I change code). I've tried pylance type checking in VS Code, which seems to work well + fast but is less clear and comprehensive than mypy. I've also seen projects like pytype [1] and pyre [2] used by Google/Meta, but people say those tools don't really make sense to use unless you're an engineer for those companies.

    Am just curious if mypy is really the best option right now?

    [1] https://github.com/google/pytype

  • sdk

    Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI (by dotnet)

    Another difference you might be surprised by is that the .NET tooling by default collects various data from your system and sends it to Microsoft [1]. If you want to avoid this (and still want to use .NET) you'll have to make sure that the environment variable DOTNET_CLI_TELEMETRY_OPTOUT is set in all contexts before touching anything.

    [1] https://github.com/dotnet/sdk/issues/6145

  • ruff

    An extremely fast Python linter and code formatter, written in Rust.

    Ruff [0] is the best linter around for performance but I'm not sure how well it fills the static analysis role.

    [0] https://github.com/charliermarsh/ruff

  • pylance-release

    Documentation and issues for Pylance

    Maybe they "are the same thing" in terms of behavior (I don't know), but "A uses B" doesn't mean that "A is B".

    One important difference in this case is that while "Pylance leverages Microsoft's open-source static type checking tool, Pyright" [1], Pylance itself is not open source. In fact, the license [2] restricts you to "use [...] the software only with [...] Microsoft products and services", which means that you are not allowed to use it with a non-Microsoft open source fork of VS Code, for example.

    The license terms also say that by accepting the license, you agree that "The software may collect information about you and your use of the software, and send that to Microsoft" and that "You may opt-out of many of these scenarios, but not all".

    [1] https://github.com/microsoft/pylance-release

    [2] https://marketplace.visualstudio.com/items/ms-python.vscode-...

  • Nim

    Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).

    Personally, I switched to Go and soon after to Nim. https://nim-lang.org/

  • jaxtyping

    Type annotations and runtime checking for shape and dtype of JAX/NumPy/PyTorch/etc. arrays. https://docs.kidger.site/jaxtyping/

    Try using [jaxtyping](https://github.com/google/jaxtyping).

    It also supports numpy/pytorch/etc.

  • InfluxDB

    Purpose built for real-time analytics at any scale. InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.

    InfluxDB logo
  • mypy

    Optional static typing for Python

    I'm also 100% convinced most people who use mypy don't realize the myriad ways it just silently stopps typing things or just silently crashes with a 0 exit code. Even if you configure it to warn untyped functions etc. It will still just not work properly in some of circumstances and you will literally never know until you debug a bug that just happened to trigger it. There are over 1.4k open but tickets it's such a broken piece of software: https://github.com/python/mypy/issues?q=is%3Aissue+is%3Aopen...

    The involvement of Guido in mypy is such a tragedy.

  • mypyc

    Compile type annotated Python to fast C extensions

    That would be interesting! You might already be aware. But there's mypyc[0], which is an AOT compiler for Python code with type hints (that, IIRC, mypy uses to compile itself into a native extension).

    Wanted to give you a head-start on the lit-review for your students I guess :)

    [0] https://github.com/mypyc/mypyc

  • madtypes

    Python Type that raise TypeError at runtime

    Hei !

    This comment inspired me because I was working on data-types at my company at the moment and I realized how static typing would have really benefited us.

    So I made a library that does just that !

    https://github.com/6r17/madtypes

    I hope this will help some people !

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Why Type Hinting Sucks!

    7 projects | /r/Python | 10 Feb 2023
  • Pyre: A performant type-checker for Python 3

    6 projects | news.ycombinator.com | 10 May 2021
  • Python code review checklist

    4 projects | dev.to | 30 Mar 2021
  • What does it mean to have -> after a function

    2 projects | /r/learnpython | 14 Mar 2021
  • Duck Typing Meets Type Hints: Using Protocols in Python

    1 project | dev.to | 30 Jul 2024

Did you konow that Python is
the 1st most popular programming language
based on number of metions?