PYTHONPATH not properly honored when using pkg_resources
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Originally reported by: Anonymous
Here's a sample run: https://gist.github.com/nailor/7f4ddb3a76c325b5bab5
In a nutshell it involves creating two packages named package and a module (in this case called herp) in them both. In addition a package/__init__.py will have the pkg_resources namespace declaration in it.
What I did?
PYTHONPATH=path_to_package1:path_to_package2 python -c 'from package import herp; print herp.__file__'
What I expected?
path_to_package1/package/herp.py would be the file printed because it has precedence in the PYTHONPATH
What happened instead?
path_to_package2/package/herp.py was printed.
In addition this behaviour differs between Python 2.6 with setuptools 0.6c12 and the Python2.7 with setuptools 3.3.
Going through different versions of setuptools looks like this breakage happened in setuptools 2.2 and is present in the latest released version 17.x
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the two packages and the PYTHONPATH command shown in the report, then compare the behavior across the cited setuptools versions. Done means importing package.herp selects the module from path_to_package1, matching PYTHONPATH precedence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100