Skip to content

Extract metadata, including full dependencies, from Python source distributions

License

Notifications You must be signed in to change notification settings

0compute/distinfo

Repository files navigation

Distinfo

Coverage

distinfo is a library for extracting metadata from Python distributions.

It includes standard metadata per Python Metadata 2.1 plus an extra attribute, "ext", for extended metadata. Metadata is collected from:

  • parsing of pyproject.toml, if dynamic also by calling PEP517 hook "prepare_metadata_for_build_wheel"
  • execution of the setup.py script
  • dist and egg info directories

Usage

Print requirements and metadata:

>>> import distinfo
>>>
>>> dist = await distinfo.from_path("/path/to/package/source")
>>> distinfo.dump(dist)
author_email:
- A N Other <ano@example.org>
classifier:
- 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)'
- 'Operating System :: POSIX'
- 'Programming Language :: Python :: 3'
ext:
  build_backend: flit_core.buildapi
  collectors:
    PathMetadata: false
    PyProjectMetadata: true
  format: pyproject
  packages:
  - example
  path: /path/to/package/source
  scripts:
    example: example.cli:main
  tests:
  - tests
home_page: https://example.org
license: GPL-3.0-or-later
metadata_version: '2.1'
name: example
requires:
  build_system_requires:
  - flit-core<4,>=3.2
  dev:
  - pycmd
  run:
  - click
  - requests
  test:
  - pytest
requires_python: '>=3.10'
summary: Example project
version: 1.0.0

Cli output (yaml):

$ distinfo /path/to/package/source

Cli specify format:

$ distinfo -f [json|msgpack] /path/to/package/source

Specifications

https://packaging.python.org/specifications/

Metadata

Dependencies

About

Extract metadata, including full dependencies, from Python source distributions

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published