Reputation: 7653
My project has file structures like the following:
MyParserPkg/
setup.py
requirements.txt
readme.txt
MANIFEST.in
doc/
logs/
ParserPKG/
// many python files here
parser.py
config.a.ini
config.b.ini
The content of MANIFEST is:
include README.txt requirements.txt
include ParserPkg/config.a.ini
include ParserPkg/config.b.ini
My setup.py:
setup(name='ParserPkg',
version='0.1',
description='A parser for testing',
packages=['ParserPkg'],
zip_safe=False)
Then I do:
pip install -r requirements.txt
pip install -e .
After the installation, I then check the site-packages of my virtual environment in which the project was installed, and found that it only contains one file:
my-envs/dialog-as-api/lib/python3.7/site-packages/ParserPkg.egg-link
And the content of this file, which is the path of my project:
/Users/lvisa/MyParserPkg
Why does it only contain an egg-link file?
Upvotes: 0
Views: 81
Reputation: 1429
You're using the -e
flag, which makes the package editable. As per the documentation,
“Editable” installs are fundamentally “setuptools develop mode” installs.
Following that link provides:
To do this, use the setup.py develop command. It works very similarly to setup.py install or the EasyInstall tool, except that it doesn’t actually install anything. Instead, it creates a special .egg-link file in the deployment directory, that links to your project’s source code. And, if your deployment directory is Python’s site-packages directory, it will also update the easy-install.pth file to include your project’s source code, thereby making it available on sys.path for all programs using that Python installation.
So it "installs" it in the sense that it's available for any other module to use, but it doesn't actually copy over the files, so that you can edit the code and test it out right away.
Upvotes: 1
Reputation: 94492
pip install -e .
installs packages in "editable" mode. It creates the link and allows you to edit your sources without constantly reinstalling.
So your package is installed correctly. It's how "editable" mode works.
Try python -c 'import MyParserPkg'
Upvotes: 1