Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression. Learn more →
Top 23 Python Typing Projects
-
I'll try to address both of your replies, sorry for the wait. You should be comfortable with The Python Tutorial -- everything through Chapter 9 is really useful. Python is a good language to know for rapidly getting your ideas into the computer, for programming interviews and festive things like Advent of Code. I really recommend getting comfortable with Python's type annotations and a type checker like mypy. It will save you a lot of headache.
-
Check out https://github.com/google/pytype
-
InfluxDB
Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.
-
https://github.com/python/typeshed is Python's equivalent of DefinitelyTyped. I'm not 100% sure why it's not more of a popular thing the way DefinitelyTyped is; I think there might, to some extent, be different attitudes around the appropriateness of having third-party typings for packages, when the actual maintainer of the package isn't interested in providing first-party ones.
-
pytermgui
Python TUI framework with mouse support, modular widget system, customizable and rapid terminal markup language and more!
Project mention: Any Good Recommendations for a Tutorial on PyTermGUI? | reddit.com/r/commandline | 2022-09-24Talking about resources, their docs are pretty good and contains some examples too. Documentation: https://ptg.bczsalba.com/pytermgui.html
-
Project mention: Library for single dispatch on Generic subscript | reddit.com/r/learnpython | 2023-02-09
-
Project mention: [D] Have their been any attempts to create a programming language specifically for machine learning? | reddit.com/r/MachineLearning | 2023-02-11
Not really an answer to your question, but there are Python packages that try to solve the problem of tensor shapes that you mentioned, e.g. https://github.com/patrick-kidger/torchtyping or https://github.com/deepmind/tensor_annotations
-
prisma-client-py
Prisma Client Python is an auto-generated and fully type-safe database client designed for ease of use
Anyway, prisma is a relatively new project, and it is very pleasant to use. I encourage you to give it a try and support the python client (at least a star on GitHub). For me who doesn't like SQL, being able to retrieve models from the database and make queries with prisma is a breath of fresh air. 🤣
-
Sonar
Write Clean Python Code. Always.. Sonar helps you commit clean code every time. With over 225 unique rules to find Python bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.
-
Project mention: how to fix settings button missing from top bar drop-down | reddit.com/r/pop_os | 2022-08-03
-
Project mention: Python’s “Type Hints” are a bit of a disappointment to me | news.ycombinator.com | 2022-04-21
Every point in this blog post strikes me as either (1) unaware of the tooling around python typing other than mypy, or (2) a criticism of static-typing-bolted-on-to-a-dynamically-typed-language, rather than Python's hints. Regarding (1), my advise to OP is to try out Pyright, Pydantic, and Typeguard. Pyright, especailly, is amazing and makes the process of working with type hints 2 or 3 times smoother IMO. And, I don't think points that fall under (2) are fair criticisms of type *hints*. They are called hints for a reason.
Otherwise, here's a point-by-point response, either recommending OP checks out tooling, or showing that the point being made is not specific to Python.
> type hints are not binding.
There are projects [0][1] that allow you to enforce type hints at runtime if you so choose.
It's worth mentioning that this is very analogous to how Typescript does it, in that type info is erased completely at runtime.
> Type checking is your job after all, ...[and that] requires maintenance.
There are LSPs like Pyright[2] (pyright specifically is the absolute best, IMO) that report type errors as you code. Again, this is very very similar to typescript.
> There is an Any type and it renders everything useless
I have never seen a static-typing tool that was bolted on to a dynamically typed language, without an `Any` type, including typescript.
> Duck type compatibility of int and float
The author admits that they cannot state why this behavior is problematic, except for saying that it's "ambiguous".
> Most projects need third-party type hints
Again, this is a criticism of all cases where static types are bolted on dynamically typed languages, not Python's implementation specifically.
> Sadly, dataclasses ignore type hints as well
Pydantic[3] is an amazing data parsing library that takes advantage of type hints, and it's interface is a superset of that of dataclasses. What's more, it underpins FastAPI[4], an amazing API-backend framework (with 44K Github stars).
> Type inference and lazy programmers
The argument of this section boils down to using `Any` as a generic argument not being an error by default. This is configurable to be an error both in Pyright[5], and mypy[6].
> Exceptions are not covered [like Java]
I can't find the interview/presentation, but Guido Van Rossum specifically calls out Java's implementation of "exception annotations" as a demonstration of why that is a bad idea, and that it would never happen in Python. I'm not saying Guido's opinion is the absolute truth, but just letting you know that this is an explicit decision, not an unwanted shortcoming.
[0] https://github.com/RussBaz/enforce
[1] https://github.com/agronholm/typeguard
[2] https://github.com/microsoft/pyright
[3] https://pydantic-docs.helpmanual.io
[4] https://github.com/tiangolo/fastapi
[5] https://github.com/microsoft/pyright/blob/main/docs/configur...
[6] https://mypy.readthedocs.io/en/stable/config_file.html#confv...
-
SQL Alchemy: https://github.com/dropbox/sqlalchemy-stubs
-
Deal
Design by contract for Python. Write bug-free code. Add a few decorators, get static analysis and tests for free.
Project mention: What features would you want in a new programming language? | reddit.com/r/ProgrammingLanguages | 2023-01-03I started using a design by contract library for a Python project this year and it made my code safer and easier to use.
-
Project mention: [D] Have their been any attempts to create a programming language specifically for machine learning? | reddit.com/r/MachineLearning | 2023-02-11
Heads-up that my newer jaxtyping project now exists.
-
https://github.com/jankrepl/mltype is something like this. It is tuned for programmers though. And the quality of generated text might vary a lot. But it gives reasonable char sequences.
-
Project mention: I am sick of writing argparse boilerplate code, so I made "duckargs" to do it for me | reddit.com/r/Python | 2023-03-03
Hmm… did you try such approaches, as [click](https://github.com/pallets/click) or[tap](https://github.com/swansonk14/typed-argument-parser)?
-
-
Project mention: Show HN: Up to 100x Faster FastAPI with simdjson and io_uring on Linux 5.19 | news.ycombinator.com | 2023-03-06
Author of typedload here!
FastAPI relies on (not so fast) pydantic, which is one of the slowest libraries in that category.
Don't expect to find such benchmarks on the pydantic documentation itself, but the competing libraries will have them.
-
-
Project mention: Sunday Daily Thread: What's everyone working on this week? | reddit.com/r/Python | 2022-10-09
I've written and published about a static type checking technique and a library of mine that implements it: phantom-types.
-
-
-
infer-types
A CLI tool to automatically add type annotations into Python code. Must have tool for annotating existing code.
Project mention: infer-types: A CLI tool to automatically add type annotations into Python code. Must have tool for annotating existing code. | reddit.com/r/coding | 2023-02-07 -
-
Should be pretty straightforward to implement. https://github.com/MaT1g3R/option
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
Python Typing related posts
- [D] Have their been any attempts to create a programming language specifically for machine learning?
- Why Type Hinting Sucks!
- Library for single dispatch on Generic subscript
- Informatica serve a qualcosa?
- Python interfaces with Protocols: time to ditch ABC?
- Welche Programmiersprachen, bzw. -umgebung?
- Is it bad practice from me or mypy is wrong (typing and @property)?
-
A note from our sponsor - InfluxDB
www.influxdata.com | 24 Mar 2023
Index
What are some of the best open-source Typing projects in Python? This list will help you:
Project | Stars | |
---|---|---|
1 | mypy | 15,051 |
2 | pytype | 4,159 |
3 | typeshed | 3,490 |
4 | pytermgui | 1,545 |
5 | typing | 1,379 |
6 | torchtyping | 1,212 |
7 | prisma-client-py | 1,038 |
8 | termtyper | 872 |
9 | enforce | 542 |
10 | sqlalchemy-stubs | 534 |
11 | Deal | 512 |
12 | jaxtyping | 441 |
13 | mltype | 402 |
14 | typed-argument-parser | 319 |
15 | typing_inspect | 292 |
16 | typedload | 180 |
17 | runtype | 141 |
18 | phantom-types | 137 |
19 | streamlit-pydantic | 113 |
20 | flake8-type-checking | 87 |
21 | infer-types | 56 |
22 | flake8-typing-imports | 50 |
23 | option | 50 |