{"id":15472089,"url":"https://github.com/jellezijlstra/typeshed_client","last_synced_at":"2025-04-06T05:15:56.695Z","repository":{"id":20547016,"uuid":"89016131","full_name":"JelleZijlstra/typeshed_client","owner":"JelleZijlstra","description":"Retrieve information from typeshed and other typing stubs","archived":false,"fork":false,"pushed_at":"2025-01-07T00:59:30.000Z","size":2119,"stargazers_count":22,"open_issues_count":9,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-30T04:08:46.394Z","etag":null,"topics":["pep484","python","typeshed","typing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JelleZijlstra.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-21T19:16:18.000Z","updated_at":"2025-02-01T18:55:05.000Z","dependencies_parsed_at":"2023-02-13T22:15:29.298Z","dependency_job_id":"864341f8-0c2d-4c15-afd0-ce6555e06d62","html_url":"https://github.com/JelleZijlstra/typeshed_client","commit_stats":{"total_commits":137,"total_committers":4,"mean_commits":34.25,"dds":"0.18248175182481752","last_synced_commit":"8baa750a75329d5171c7c42d9da59a11ff38bf39"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelleZijlstra%2Ftypeshed_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelleZijlstra%2Ftypeshed_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelleZijlstra%2Ftypeshed_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JelleZijlstra%2Ftypeshed_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JelleZijlstra","download_url":"https://codeload.github.com/JelleZijlstra/typeshed_client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247436286,"owners_count":20938533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pep484","python","typeshed","typing"],"created_at":"2024-10-02T02:26:33.209Z","updated_at":"2025-04-06T05:15:56.417Z","avatar_url":"https://github.com/JelleZijlstra.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This project provides a way to retrieve information from\n`typeshed \u003chttps://www.github.com/python/typeshed\u003e`_ and from\n`PEP 561 \u003chttps://www.python.org/dev/peps/pep-0561/\u003e`_ stub packages.\n\nExample use cases:\n\n- Find the path to the stub file for a particular module.\n- Find the names defined in a stub.\n- Find the AST node that defines a particular name in a stub.\n\nProjects for which ``typeshed_client`` could be useful include:\n\n- Static analyzers that want to access typeshed annotations.\n- Tools that check stubs for correctness.\n- Tools that use typeshed for runtime introspection.\n\nInstallation\n------------\n\n``typeshed_client`` works on all supported versions of Python. To install it, run\n``python3 -m pip install typeshed_client``.\n\nFinding stubs\n-------------\n\nThe `typeshed_client.finder` module provides functions for finding stub files\ngiven a module name.\n\nFunctions provided:\n\n- ``get_search_context(*, typeshed: Optional[Path] = None,\n  search_path: Optional[Sequence[Path]] = None, python_executable: Optional[str] = None,\n  version: Optional[PythonVersion] = None, platform: str = sys.platform) -\u003e SearchContext``:\n  Returns a ``SearchContext``\n- ``typeshed_client.get_stub_file(module_name: str, *,\n  search_context: Optional[SearchContext] = None) -\u003e Optional[Path]``: Returns\n  the path to a module's stub in typeshed. For example,\n  ``get_stub_file('typing', search_context=get_search_context(version=(2, 7)))`` may return\n  ``Path('/path/to/typeshed/stdlib/@python2/typing.pyi')``. If there is no stub for the\n  module, returns None.\n- ``typeshed_client.get_stub_ast`` has the same interface, but returns an AST\n  object (parsed using the standard library ``ast`` module).\n\nCollecting names from stubs\n---------------------------\n\n``typeshed_client.parser`` collects the names defined in a stub. It provides:\n\n- ``typeshed_client.get_stub_names(module_name: str, *,\n  search_context: Optional[SearchContext] = None) -\u003e Optional[NameDict]`` collects the names\n  defined in a module, using the given Python version and platform. It\n  returns a ``NameDict``, a dictionary mapping object names defined in the module\n  to ``NameInfo`` records.\n- ``typeshed_client.NameInfo`` is a namedtuple defined as:\n\n  .. code-block:: python\n\n      class NameInfo(NamedTuple):\n        name: str\n        is_exported: bool\n        ast: Union[ast3.AST, ImportedName, OverloadedName]\n        child_nodes: Optional[NameDict] = None\n\n  ``name`` is the object's name. ``is_exported`` indicates whether the name is a\n  part of the stub's public interface. ``ast`` is the AST node defining the name,\n  or a different structure if the name is imported from another module or is\n  overloaded. For classes, ``child_nodes`` is a dictionary containing the names\n  defined within the class.\n\nResolving names to their definitions\n------------------------------------\n\nThe third component of this package, ``typeshed_client.resolver``, maps names to\ntheir definitions, even if those names are defined in other stubs.\n\nTo use the resolver, you need to instantiate the ``typeshed_client.Resolver``\nclass. For example, given a ``resolver = typeshed_client.Resolver()``, you can\ncall ``resolver.get_fully_qualified_name('collections.Set')`` to retrieve the\n``NameInfo`` containing the AST node defining ``collections.Set`` in typeshed.\n\nChangelog\n---------\n\nVersion 2.7.0 (July 16, 2024)\n\n- Update bundled typeshed\n\nVersion 2.6.0 (July 12, 2024)\n\n- Update bundled typeshed\n- Support ``try`` blocks in stubs\n- Declare support for Python 3.13\n- Handle situations where an entry on the module search path is not\n  accessible or does not exist\n- Fix warnings due to use of deprecated AST classes\n\nVersion 2.5.1 (February 25, 2024)\n\n- Fix packaging metadata that still incorrectly declared support for Python 3.7\n\nVersion 2.5.0 (February 25, 2024)\n\n- Update bundled typeshed\n- Drop support for Python 3.7\n- ``typeshed_client.finder.get_search_path()`` is now deprecated, as it is no longer useful\n\nVersion 2.4.0 (September 29, 2023)\n\n- Update bundled typeshed\n- Declare support for Python 3.12\n\nVersion 2.3.0 (April 30, 2023)\n\n- Update bundled typeshed\n- Support ``__all__.append`` and ``__all__.extend``\n\nVersion 2.2.0 (January 24, 2023)\n\n- Update bundled typeshed\n- Fix crash on stubs that use ``if MYPY``\n- Fix incorrect handling of ``import *`` in stubs\n- Drop support for Python 3.6 (thanks to Alex Waygood)\n\nVersion 2.1.0 (November 5, 2022)\n\n- Update bundled typeshed\n- Declare support for Python 3.11\n- Add ``typeshed_client.resolver.Module.get_dunder_all`` to get the contents of ``__all__``\n- Add support for ``__all__ +=`` syntax\n- Type check the code using mypy (thanks to Nicolas)\n\nVersion 2.0.5 (April 17, 2022)\n\n- Update bundled typeshed\n\nVersion 2.0.4 (March 10, 2022)\n\n- Update bundled typeshed\n\nVersion 2.0.3 (February 2, 2022)\n\n- Update bundled typeshed\n\nVersion 2.0.2 (January 28, 2022)\n\n- Update bundled typeshed\n\nVersion 2.0.1 (January 14, 2022)\n\n- Update bundled typeshed\n\nVersion 2.0.0 (December 22, 2021)\n\n- Breaking change: Use `ast` instead of `typed_ast` for parsing\n\nVersion 1.2.3 (December 12, 2021)\n\n- Update bundled typeshed\n- Remove noisy warning if a name is imported multiple times\n- Fix `get_all_stub_files()` in Python 3 for modules that also exist in Python 2\n\nVersion 1.2.2 (December 9, 2021)\n\n- Further fix relative import resolution\n\nVersion 1.2.1 (December 9, 2021)\n\n- Fix bug with resolution of relative imports\n- Update bundled typeshed\n\nVersion 1.2.0 (December 6, 2021)\n\n- Support overloaded methods\n- Update bundled typeshed\n\nVersion 1.1.4 (December 6, 2021)\n\n- Updated bundled typeshed\n\nVersion 1.1.3 (November 14, 2021)\n\n- Update bundled typeshed\n- Declare support for Python 3.10\n- Fix undeclared dependency on ``mypy_extensions``\n\nVersion 1.1.2 (November 5, 2021)\n\n- Update bundled typeshed\n\nVersion 1.1.1 (July 31, 2021)\n\n- Update bundled typeshed\n- Improve error message when encountering a duplicate name\n\nVersion 1.1.0 (June 24, 2021)\n\n- Update bundled typeshed\n- Handle missing `@python2` directory\n- Allow comments in VERSIONS file\n\nVersion 1.0.2 (May 5, 2021)\n\n- Handle version ranges in typeshed VERSIONS file\n- Update bundled typeshed\n\nVersion 1.0.1 (April 24, 2021)\n\n- Update bundled typeshed\n\nVersion 1.0.0 (April 11, 2021)\n\n- Improve docstrings\n\nVersion 1.0.0rc1 (April 11, 2021)\n\n- Support new typeshed layout\n- Support PEP 561 packages\n- Bundle typeshed directly instead of relying on mypy\n\nVersion 0.4 (December 2, 2019)\n\n- Performance improvement\n- Code quality improvements\n\nVersion 0.3 (November 23, 2019)\n\n- Update location of typeshed for newer mypy versions\n\nVersion 0.2 (May 25, 2017)\n\n- Support using a custom typeshed directory\n- Add ``get_all_stub_files()``\n- Handle ``from module import *``\n- Bug fixes\n\nVersion 0.1 (May 4, 2017)\n\n- Initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellezijlstra%2Ftypeshed_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjellezijlstra%2Ftypeshed_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjellezijlstra%2Ftypeshed_client/lists"}