I have a library with the following structure:
├── mylib
│ ├── lib
│ │ └── __init__.py
│ ├── tools
│ │ └── __init__.py
│ ├── py_script
│ └── __init__.py
and I would like to do an editable pip install such that I can use mylib
in other code like
from mylib.tools import useful_tool
and run py_script
from the command line.
Is there a way to add a setup.py file to mylib
that would allow for this import behavior without having to update the directory structure (e.g. moving everything into a new mylib/mylib
folder)?
The reason for the constraint is that many people have been using mylib
by manually adding the parent directory (e.g. mylib/...
) to PYTHONPATH
and PATH
to get the import behavior above and I would prefer to not break that workflow.