According to the documentation, importlib.metadata.version should work on dist-info folders in ZIP files. However, if you run pip install -t foo jedi-language-server (though you can use any package), zip -r foo.zip foo, PYTHONPATH=foo.zip/foo python -c "from importlib.metadata import version; version('jedi-language-server')", I get importlib.metadata.PackageNotFoundError: No package metadata was found for jedi-language-server
Apparently, it only works if the metadata is in the top-level directory; that is, you have to do (cd foo; zip -r foo.zip .). It does not support nested directories.
Why doesn't `importlib.metadata.version` work on zip files?