Install & Compatibility
Where this runs
tested against v30.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.074s · 17.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.068s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
get_metadata
✓ from pkginfo2 import get_metadata
✗ from pkginfo import get_metadata
Old library is pkginfo, not pkginfo2
UnpackedSDist
✓ from pkginfo2 import UnpackedSDist
No common wrong import known
Demonstrates reading metadata from a file and installed package.
from pkginfo2 import get_metadata
# Get metadata from a source distribution
metadata = get_metadata('pkginfo2-30.1.0.tar.gz')
print(metadata.name, metadata.version)
# Get metadata from an installed package
from pkginfo2.installed import Installed
inst = Installed('pkginfo2')
print(inst.name, inst.version)
# Use environment variable for a file path
import os
path = os.environ.get('PKGINFO2_FILE', 'pkginfo2-30.1.0.tar.gz')
metadata = get_metadata(path)
print(metadata.name, metadata.version)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pkginfo'
Attempting to use old pkginfo package under the name pkginfo2.
fixInstall pkginfo2: pip install pkginfo2
AttributeError: 'NoneType' object has no attribute 'name'
get_metadata() returned None for a .whl file without METADATA.
fixCheck return value: metadata = get_metadata('file.whl'); if metadata is None: handle error ImportError: cannot import name 'get_metadata' from 'pkginfo2'
Old version of pkginfo2 (<30.0.0) may not include get_metadata.
fixUpgrade to latest: pip install --upgrade pkginfo2
Upgrade
Version history
30.1.0latest on PyPI · released Oct 27, 2025
Audit
Dependencies
No dependency data recorded yet.