Collection of library stubs for Python, with static types (by python)

Typeshed Alternatives

Similar projects and alternatives to typeshed

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better typeshed alternative or higher similarity.

typeshed reviews and mentions

Posts with mentions or reviews of typeshed. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-11-09.
  • GitHub stars won't pay your rent
    5 projects | news.ycombinator.com | 9 Nov 2022
    >Ultimately if you care enough about Fody to spend over a hundred dollars worth of your time contributing to it, you probably care enough about Fody to drop them three dollars.

    No, I really don't.

    https://github.com/keepassxreboot/keepassxc/pull/8500 - I was randomly reading keepassxc's manpage and spotted a curious option, spent some time spelunking through the code and history to discover that it was an outdated option, sent a PR.

    https://github.com/python/typeshed/pull/8617 - I converted one of the scripts I use in my DE from shell to Python, saw that VSCode has this new fancy typing support for Python, quickly found a basic bug in the type definitions for the os module, tested a fix locally, sent a PR.

    https://gitlab.gnome.org/GNOME/gtk/-/issues/5250 - I found an issue with copy-paste on my phone, investigated it all the way through to the GTK stack, found the commits that introduced the issue, created a distro patch for it while discussing it with GTK upstream.

    https://gitlab.alpinelinux.org/alpine/aports/-/merge_request... - I noticed that gnome-passwordsafe crashes some times, debugged it to discover that it was missing a dependency, sent a PR to the distro package to update the dependencies.

    etc etc. I've made lots of fixes like these. I have no interest in paying for each and every one of them. The projects are all better off for fixes like mine and gatekeeping them on payment would've been nothing but their loss.

  • Using Mypy in Production
    11 projects | news.ycombinator.com | 22 Aug 2022
    You have to do handling like that in other languages like TypeScript anyway.

    Painpoint with type annotations:

    - not being able to reuse "shapes" of data: TypedDict, NamedTuple, dataclasses.dataclass, and soon kwargs (PEP 692 [1]) all have named, typed fields now. You have to

    - Since there's no generic "shape" structure that works across data types, there isn't a way to load up a JSON / YAML / TOML into a dictionary, upcast it via a `TypedGuard`, and pass it into a TypedDict / NamedTuple / Dataclass. dataclasses.asdict() or dataclasses.astuple() return naive / untyped tuples and dicts. Also the factory functions will not work with TypedDict or NamedTuple, respectively, even if you duplicate the fields by hand. See my post here: https://github.com/python/typeshed/issues/8580

    - Standard library doesn't have runtime validation (e.g. pydantic / https://github.com/pydantic/pydantic).

    - pytest fixtures are hard.

    - Django is hard. PEP 681 may not be a saving grace either. [3]

    [1] https://peps.python.org/pep-0692/

  • Welcome to hassle free coding
    4 projects | reddit.com/r/ProgrammerHumor | 28 May 2022
    The whole Python Standard Library: https://github.com/python/typeshed/tree/master/stdlib
  • Python’s “Type Hints” are a bit of a disappointment to me
    15 projects | news.ycombinator.com | 21 Apr 2022
    https://github.com/python/typeshed also provides community maintained stub packages for packages that are lacking upstream type hints
  • Java vs python is debatable 🤔
    3 projects | reddit.com/r/ProgrammerHumor | 3 Apr 2022
    Using any linter + type checker solves many of your problems. Just annotate your types (possibly using the typing module below Python 3.10), run flake8 and mypy and you're fine. Also c.f. PEP-484 for how and why it was done like this. And use typeshed stubs for untyped libs, most major libraries have typings in there ;)
  • Why Static Languages Suffer From Complexity
    8 projects | reddit.com/r/rust | 19 Jan 2022
    Do you mean declaration files (*.d.ts) and DefinitelyTyped? Python has equivalents of those in type stubs (*.pyi) and typeshed.
  • Comparison of Python TOML parser libraries
    19 projects | dev.to | 14 Dec 2021
  • Tests aren’t enough: Case study after adding type hints to urllib3
    4 projects | news.ycombinator.com | 18 Oct 2021
    I agree with all the benefits of mypy cited in this article. For me, most important thing for the long-term health of a codebase is its readability/maintainability, and mypy static typing makes such a huge difference for that in large Python codebases. I'm really excited to see large libraries doing this migration.

    I'll add for folks thinking about this transition that we took a pretty different strategy for converting Zulip to be type-checked: https://blog.zulip.com/2016/10/13/static-types-in-python-oh-...

    The post is from 2016 and thus a bit stale in terms of the names of mypy options and the like, but the incremental approach we took involved only using mypy's native exclude tooling, and might be useful for some projects thinking about doing this transition.

    One particular convention that I think many other projects may find useful is how we do `type: ignore` in comments in the Zulip codebase, which is to have a second comment on the line explaining why we needed a `type: ignore`, like so:

    * # type: ignore[type-var] # https://github.com/python/typeshed/issues/4234

    * # type: ignore[attr-defined] # private member missing from stubs

    * # type: ignore[assignment] # Apparent mypy bug with Optional[int] setter.

    * # type: ignore[misc] # This is an undocumented internal API

    We've find this to be a lot more readable than using the commit message to record why we needed a `type: ignore`, and in particular it makes the work of removing these with time feel a lot more manageable to have the information organized this way.

    (And we can have a linter enforce that `type: ignore` always comes with such a comment).

  • Mypy 0.900 Released
    3 projects | reddit.com/r/Python | 9 Jun 2021
    I have a feeling this is an edge case in how the numbers tower works (unlikely) or I don’t understand how the type hints work for int: https://github.com/python/typeshed/blob/c601d5cf3d8968f3dc1fe792bc1da5b43c6a9ed9/stdlib/builtins.pyi#L169
  • Python 3 Types in the Wild: A Tale of Two Type Systems [pdf]
    6 projects | news.ycombinator.com | 14 Apr 2021
    I wonder if that's a mypy issue or more that the typeshed types are bugged, since type shed versions also get shipped (used to?) with new type checker versions.


  • A note from our sponsor - InfluxDB
    www.influxdata.com | 28 Nov 2022
    InfluxDB is the Time Series Data Platform where developers build real-time applications for analytics, IoT and cloud-native services in less time with less code. Learn more →


Basic typeshed repo stats
6 days ago
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.