{"library":"pkginfo2","title":"pkginfo2","description":"Query metadata from sdists, bdists, and installed packages. A safer fork of pkginfo that avoids arbitrary imports and eval. Current version 30.1.0, released 2025-04. Maintained by AboutCode.org.","language":"python","status":"active","last_verified":"Fri May 01","install":{"commands":["pip install pkginfo2"],"cli":null},"imports":["from pkginfo2 import get_metadata","from pkginfo2 import UnpackedSDist"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pkginfo2 import get_metadata\n\n# Get metadata from a source distribution\nmetadata = get_metadata('pkginfo2-30.1.0.tar.gz')\nprint(metadata.name, metadata.version)\n\n# Get metadata from an installed package\nfrom pkginfo2.installed import Installed\ninst = Installed('pkginfo2')\nprint(inst.name, inst.version)\n\n# Use environment variable for a file path\nimport os\npath = os.environ.get('PKGINFO2_FILE', 'pkginfo2-30.1.0.tar.gz')\nmetadata = get_metadata(path)\nprint(metadata.name, metadata.version)","lang":"python","description":"Demonstrates reading metadata from a file and installed package.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}