Jason R. Coombs <jar...@jaraco.com> added the comment:

The behavior you describe is intentional _and_ deterministic. The library 
discovers distributions in the order found based on the search path provided, 
with the search path defaulting to sys.path.

The expectation is therefore that the metadata should be discovered in its 
order of precedence.

Thanks for the repro. I attempted to follow it, but was unsuccessful:

```
FROM jaraco/multipy-tox
RUN git clone https://github.com/kkirsche/poetry-remove-untracked
RUN pip install poetry
WORKDIR poetry-remove-untracked
RUN git checkout before
RUN poetry install --remove-untracked
RUN git checkout after
RUN poetry install --remove-untracked
CMD python -c "import importlib.metadata as md; 
print(md.version('poetry-remove-untracked'))"
```

Running that Dockerfile reports that the package isn't installed.

```
draft $ docker run -it @$(docker build -q .)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 955, in 
version
    return distribution(distribution_name).version
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 928, in 
distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 518, in 
from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for 
poetry-remove-untracked
```

I think you'll have to teach me a bit about how poetry works in order to 
understand how to properly reproduce the issue so I can examine the relevant 
environment.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46774>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to