Skip to content

Instantly share code, notes, and snippets.

@yogeek
Last active August 8, 2017 15:51
Show Gist options
  • Save yogeek/50ee56528015475f5c2143d69933e4f3 to your computer and use it in GitHub Desktop.
Save yogeek/50ee56528015475f5c2143d69933e4f3 to your computer and use it in GitHub Desktop.
Python module management
# Pypi configuration file : ~/.pypirc
```
[distutils]
index-servers =
nexus
[nexus]
repository = http://<NEXUS_URL>/repository/<PYTHON_REPOSITORY_NAME>/
username = *******
password = *******
```
pip install --user <MODULE_NAME>
# https://packaging.python.org/tutorials/distributing-packages/#packaging-your-project
# Go to the module directory (setup.py file must be there)
cd <MODULE_SETUP_DIR>
# sdist : create a source distribution
python setup.py sdist
# bdist_wheel : create a binary distribution
# Prerequisite : pip install wheel
python setup.py bdist_wheel --universal
# The resulting files are in ./dist directory
# pip configuration file : ~/.pip/pip.conf
[global]
extra-index-url = http://<USERNAME>:<PASSWORD>@<NEXUS_URL>/repository/<PYTHON_REPOSITORY_NAME>/simple
# https://packaging.python.org/tutorials/distributing-packages/#uploading-your-project-to-pypi
# Go to the module directory (setup.py file must be there)
cd $MODULE_SETUP_DIR
# twine
# Prerequisite : pip install --user twine
twine upload -r nexus dist/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment