Skip to main content

Simple extractor for python artifact metadata

Project description

metadata_please

There are a couple of pretty decent ways to read metadata (importlib-metadata, and pkginfo) but they tend to be pretty heavyweight. This lib aims to do two things, with as minimal dependencies as possible:

  1. Support just enough metadata to be able to look up deps.
  2. Do "the thing that pip does" when deciding what dist-info dir to look at.

Usage

Example snippet to show how to get the metadata from a wheel.

from zipfile import ZipFile
from metadata_please import basic_metadata_from_wheel

zf = ZipFile('somepkg.whl')
print(basic_metadata_from_wheel(zf, "somepkg"))

Output

BasicMetadata(
    reqs=[
        'cli-helpers[styles] >=2.2.1',
        'click >=4.1',
        'configobj >=5.0.5',
        'prompt-toolkit <4.0.0,>=3.0.3',
        'pygments >=1.6',
        'sqlparse >=0.4.4',
        "behave >=1.2.6 ; extra == 'dev'",
        "coverage >=7.2.7 ; extra == 'dev'",
        "pexpect >=4.9.0 ; extra == 'dev'",
        "pytest >=7.4.4 ; extra == 'dev'",
        "pytest-cov >=4.1.0 ; extra == 'dev'",
        "tox >=4.8.0 ; extra == 'dev'",
        "pdbpp >=0.10.3 ; extra == 'dev'"
    ],
    provides_extra=frozenset({'dev'}),
    name='litecli',
    version='1.12.4',
    requires_python='>=3.7',
    url=None,
    project_urls={'homepage, https://github.com/dbcli/litecli': ''},
    author=None,
    author_email='dbcli <litecli-users@googlegroups.com>',
    summary='CLI for SQLite Databases with auto-completion and syntax highlighting.',
    description='# litecli\n\n[![GitHub
Actions](https://github.com/dbcli/litecli/actions/workflows/ci.yml/badge.svg)](https://github.com/dbcli/litecli/actions/workflows/ci.yml "GitHub
Actions")\n\n[Docs](https://litecli.com)\n\nA command-line client for SQLite databases that has auto-completion and syntax
highlighting.\n\n![Completion](screenshots/litecli.png)\n![CompletionGif](screenshots/litecli.gif)\n\n## Installation\n\nIf you already know how to install python
packages, then you can install it via pip:\n\nYou might need sudo on linux.\n\n```\n$ pip install -U litecli\n```\n\nThe package is also available on Arch Linux through
AUR in two versions: [litecli](https://aur.archlinux.org/packages/litecli/) is based the latest release (git tag) and
[litecli-git](https://aur.archlinux.org/packages/litecli-git/) is based on the master branch of the git repo. You can install them manually or with an AUR helper such as
`yay`:\n\n```\n$ yay -S litecli\n```\n\nor\n\n```\n$ yay -S litecli-git\n```\n\nFor MacOS users, you can also use Homebrew to install it:\n\n```\n$ brew install
litecli\n```\n\n## Usage\n\n```\n$ litecli --help\n\nUsage: litecli [OPTIONS] [DATABASE]\n\nExamples:\n  - litecli sqlite_db_name\n```\n\nA config file is automatically
created at `~/.config/litecli/config` at first launch. For Windows machines a config file is created at `~\\AppData\\Local\\dbcli\\litecli\\config` at first launch. See
the file itself for a description of all available options.\n\n## Docs\n\nVisit: [litecli.com/features](https://litecli.com/features)\n',
    keywords=None,
    long_description_content_type='text/markdown'
)

The metadata can be extracted from a wheel, sdist (zip or tarball) or a source checkout (best effort). Check __init__.py file for all available functions.

Version Compat

Usage of this library should work back to 3.7, but development (and mypy compatibility) only on 3.10-3.12. Linting requires 3.12 for full fidelity.

License

metadata_please is copyright Tim Hatch, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metadata_please-0.2.1rc1.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

metadata_please-0.2.1rc1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file metadata_please-0.2.1rc1.tar.gz.

File metadata

  • Download URL: metadata_please-0.2.1rc1.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for metadata_please-0.2.1rc1.tar.gz
Algorithm Hash digest
SHA256 185af6045042bc5f88da3539c34868a6142261d6021bf0d500ffdb3e2c389d0e
MD5 2de2b6d31cee70c7353226c8ab9aefc3
BLAKE2b-256 147ea8585ab052d31466ca3e8d4e22e6444cf40425596bab791279394d8d30b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for metadata_please-0.2.1rc1.tar.gz:

Publisher: build.yml on python-packaging/metadata-please

Attestations:

File details

Details for the file metadata_please-0.2.1rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for metadata_please-0.2.1rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 047cee30f13db4a09b09fc5eef05481ac175d848bde2295d0d4a417d30eaa920
MD5 cda60c3f034117637353e8a9b9c2f20a
BLAKE2b-256 3eb6cd6e8b3524ef968683bd67762ac07f0ec0986833ad5925e620813250b35f

See more details on using hashes here.

Provenance

The following attestation bundles were made for metadata_please-0.2.1rc1-py3-none-any.whl:

Publisher: build.yml on python-packaging/metadata-please

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page