Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test that PyPi install will work before pushing to PyPi? (Python)

I have been having some issues figuring out how to get my Python package processed up to PyPi so I can install it easily with other dependencies for other projects (ie. with a requirements entry or a simple 'pip install xyz') - one such is listed here Creating PyPi package - Could not find a version that satisfies the requirement iso8601. This led me down another rabbit hole which led to another question:

How can I test to make sure the my pip install command will work prior to pushing my package with a release to PyPi?

like image 329
Ben Nelson Avatar asked Dec 12 '16 03:12

Ben Nelson


1 Answers

If you just need to test whether pip install works from the built package, you can create it and then use pip to install it from local filesystem.

python setup.py sdist
pip install dist/mypackage-1.0.tar.gz

If you have been running python setup.py install already, ensure you run:

pip uninstall mypackage

to uninstall existing package first. You can encounter strange situations where mixing python setup.py install and pip locally, so run pip uninstall multiple times until says no more package to remove to be safe.

like image 117
Graham Dumpleton Avatar answered Oct 22 '22 16:10

Graham Dumpleton