-
Notifications
You must be signed in to change notification settings - Fork 0
pip3
holzkohlengrill edited this page Dec 15, 2023
·
2 revisions
-
cd
into your Python project folder pip install setuptools
-
pip install wheel
(forbdist_wheel
) python setup.py sdist bdist_wheel
pip install twine
- Generate pacakages:
python setup.py sdist bdist_wheel
- Upload
- pip's TEST database:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
(in order to upload to pip database (in this case to pip's TEST database) - pip's REAL database:
twine upload dist/*
(in order to upload to the REAL pip database)
- pip's TEST database:
Additional information:
-
sdist
("source archive") creates a.tar.gz
indist/
-
bdist_wheel
("built distribution") (you needpip install wheel
herefore) creates a.whl
indist/
-
bdist
creates a.zip
indist/
(contains a full path structure with the relevant packages) => normally not needed - Test install in venv:
pip install --index-url https://test.pypi.org/simple/ --no-deps packageName
See here for a lengthy documentation: https://packaging.python.org/tutorials/packaging-projects/
- Install the Travis CLI
-
cd
to travis install folder => e.g./home/<usr>/.gem/ruby/2.6.0/gems/travis-1.8.9/bin/
- Log-in:
travis login --pro
- Encrypt your pip password:
travis encrypt "yourPipAccountPassword" -r yourUsername/RepoName
# ^^^^^^^^^^^^^^^^^^^^^--- this is where your repo lies on GitHub
=> Add this to your travis.yml
:
deploy:
provider: pypi
user: yourUsername
password:
secure: yourReeeeeeeallyLongGeneratedHash
on:
# Deploy only on new git tags
tags: true
Important notes:
- User name and repo name change the key -> be sure to enter the correct repo name and user name otherwise it will fail
- I never managed to run the Travis CLI on Windows. If you feel like I felt just use Linux (e.g. in a VM) to do this stuff.
- Apparently you cannot state the
secure
hash as a environment variable in the Travis settings
Based on: https://stackoverflow.com/a/3452888/4773274
#!/bin/bash
pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 sudo pip3 install -U
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License *.
Code (snippets) are licensed under a MIT License *.
* Unless stated otherwise