This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients jaraco, kkirsche, kkirsche-github
Date 2022-03-13.18:40:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647196808.96.0.601370473349.issue46774@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-03-13 18:40:08jaracosetrecipients: + jaraco, kkirsche, kkirsche-github
2022-03-13 18:40:08jaracosetmessageid: <1647196808.96.0.601370473349.issue46774@roundup.psfhosted.org>
2022-03-13 18:40:08jaracolinkissue46774 messages
2022-03-13 18:40:08jaracocreate