setuptools: editable install breaks custom package_dir spec
I have a project with this directory structure:
- project_folder_name
- lib
- __init__.py
- module.py
- ...
So in my setup.py I followed the instructions in the docs and set the package_dir:
from setuptools import setup
setup(name='project-name',
packages=['project'],
package_dir={'project' : 'lib'},
)
If I install normally python setup.py install everything is fine and I can get the module like: import project. (Possibly another issue but pip install . seems to have issues though.)
However, in development mode python setup.py develop or pip install -e . I can’t import via the package name. Strangely, I can import from the folder name import lib.
Just as a reference and sanity check I also tried other organizations that work i.e. “lib/project” with package_dir={'' : 'lib'}. Would like for this directory structure though if possible.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 2
- Comments: 15 (7 by maintainers)
thanks @abravalheri for offering to troubleshoot my pyproject.toml! I was copying the error here when I finally read it in eough detail to realize that
package_diris renamedpackage-dirfor use inpyproject.toml. So this is my now working and equivalentpyproject.tomlAfter adding a
pyproject.tomlwithto @lorienhu test project, I had success with
pip install -e .but not withpython setup.py develop. I believe that is expected.The following
setup.cfgreplacement forsetup.pyalso worked (for those struggling with .cfg syntax … quoting strings seemed to cause me trouble)I still have not gotten it to work with just a
pyproject.tomlcontainingtool.setuptoolstable …Versions: