lxml-stubs VS typeshed

Compare lxml-stubs vs typeshed and see what are their differences.

lxml-stubs

Type stubs for the lxml package (by lxml)

typeshed

Collection of library stubs for Python, with static types (by python)
Our great sponsors
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • Scout APM - Truly a developer’s best friend
  • Zigi - The context switching struggle is real
  • Sonar - Write Clean Python Code. Always.
lxml-stubs typeshed
1 17
25 3,284
- 2.2%
6.0 9.9
3 months ago about 6 hours ago
Python Python
GNU General Public License v3.0 or later GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

lxml-stubs

Posts with mentions or reviews of lxml-stubs. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-05-28.

typeshed

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
    typeshed
  • 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.

    https://github.com/python/typeshed

What are some alternatives?

When comparing lxml-stubs and typeshed you can also consider the following projects:

pyre-check - Performant type-checking for python.

mypy - Optional static typing for Python

flask-parameter-validation - Get and validate all Flask input parameters with ease.

NumPy - The fundamental package for scientific computing with Python.

Nuitka - Nuitka is a Python compiler written in Python. It's fully compatible with Python 2.6, 2.7, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, and 3.10. You feed it your Python app, it does a lot of clever things, and spits out an executable or extension module.

dactyl-keyboard - Web generator for dactyl keyboards.

pydantic - Data parsing and validation using Python type hints

PyCall.jl - Package to call Python functions from the Julia language

DefinitelyTyped - The repository for high quality TypeScript type definitions.

doctest - The fastest feature-rich C++11/14/17/20 single-header testing framework

typeguard - Run-time type checker for Python

quarchive - Traditional "Web 2.0" social bookmarking, with small improvements