-
Install twine and make sure tools are up to date by running
pip install -U pip setuptools twine
-
Create an account at https://pypi.org/ and also https://test.pypi.org/, the latter for testing.
-
Follow the instructions at Packaging and distributing project for informationa about
setup.cfg
andsetup.py
usage -
From the package directory run the following (assuming you want to distribute a source distribution and a wheel for the particular python you are using. A wheel distribution is essentially a packaged version that is operating system agnostic but is either python2 or python3 specific):
python setup.py sdist bdist_wheel
-
Add the example
sample.pypirc
file to~/.pypirc
directory and change the usernames and passwords for the testpypi and pypi servers. -
Upload to the testing pypi server, but running the following from your package directory:
twine upload --repository testpypi dist/*
-
Test that upload by installing:
pip install --index-url https://test.pypi.org/simple/ your_package_name
-
Actually install to pypi:
twine upload dist/*
-
You can test by running
pip install your_package_name
Last active
April 22, 2018 15:36
Star
You must be signed in to star a gist
Creating a pip installable python module from source using pypi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index-servers= | |
pypi | |
testpypi | |
[pypi] | |
repository: https://upload.pypi.org/legacy/ | |
username: PUT_NAME_HERE | |
password: PUT_PASSWD_HERE | |
[testpypi] | |
repository: https://test.pypi.org/legacy/ | |
username: PUT_NAME_HERE | |
password: PUT_PASSWD_HERE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment