I have a Git repository cloned into myproject
, with an __init__.py
at the root of the repository, making the whole thing an importable Python package.
I'm trying to write a setuptools setup.py
for the package, which will also sit in the root of the repository, next to the __init__.py
file. I want setup.py
to install the directory it resides in as a package. It's fine if setup.py itself comes along as part of the installation, but it would be better if it didn't. Ideally this should work also in editable mode (pip install -e .
)
Is this configuration at all supported? I can kind of make it work by having a package_dir= {"": ".."},
argument to setup()
, telling it to look for myproject
in the directory above the current one. However, this requires the package to always be installed from a directory named myproject
, which does not appear to be the case if, say, it's being installed through pip
, or if someone is working out of a Git clone named myproject-dev
, or in any number of other cases.
Another hack I'm contemplating is a symlink to .
named mypackage
inside of the repository. That ought to work, but I wanted to check if there was a better way first.