[BUG] pyproject.toml is packaged and later installed in site-packages root
kribesk opened this issue · comments
Steps to reproduce:
$ pip install pycln
...
$ cat .../lib/python3.11/site-packages/pyproject.toml | grep name
name = "pycln"
Expected behavior:
pyproject.toml
should not be packaged at all! Python packages (wheels) already contain metadata.
I see you want to use package metadata in your code. Please use builtin tools designed for this task instead of hacking python and messing up users' site-packages:
from importlib.metadata import metadata
package = 'pycln' # or pycln.__name__ to be explicit
meta = metadata(package)
name, version = meta.get('Name', package), meta.get('Version', '0.0.0')
print(f'{name} v{version}')