editable install breaks custom package_dir spec
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Standardising editable mode installs (runtime layout - Packaging
bar" correctly throws an ImportError , but after pip install -e . , I am able to successfully import foo.bar . That came...
Read more >When would the -e, --editable option be useful with pip install?
As the man page says it: -e,--editable <path/url> Install a project in editable mode (i.e. setuptools "develop mode") from a local project ...
Read more >Making a Python Package
There are a bunch of nifty tools that help you build, install and distribute packages. ... It is python code, so you can...
Read more >build backend is missing the 'build_editable' hook. - You.com
Note: To be able to do an editable installation to your user site ( pip install -e --user ) ... My project uses...
Read more >My How and Why: pyproject.toml & the 'src' Project Structure
Both the pip install -e . and python setup.py develop approaches should now ... setuptools -independent specification of editable installs.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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_dir
is renamedpackage-dir
for use inpyproject.toml
. So this is my now working and equivalentpyproject.toml
Thank you for confirming @itcarroll !