python / python/cpython

`pkgutil.get_data()` get confused by local modules for module installed with `pip install --editable`

Open
#118,383 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type-bug
Dominant language
Python
Stars
77.2k
Forks
36k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

First execute in bash:

git clone https://github.com/pyx-project/pyx
cd pyx
pip install -e .
cd pyx  # important! Now the directory is inside two layers of /pyx
python

Then execute in Python:

import pkgutil
pkgutil.get_data("pyx", "data/pyxrc")

Return value is None.

Note that the return value would not be None if either -e or the second cd is omitted --- which shows that the data file is correctly available.

CPython versions tested on:

3.11

Operating systems tested on:

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the bash and Python steps from the report, focusing on the pkgutil.get_data entry point after pip install -e . and the nested cd pyx. Trace why it returns None for data/pyxrc in that context, then verify that the same lookup returns the available data without requiring either workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.