-
-
Notifications
You must be signed in to change notification settings - Fork 294
Upload to pypi
rachmadani haryono edited this page Jul 1, 2022
·
3 revisions
- register to pypi and test.pypi
- upgrade setuptools.
setuptools>=38.6.0
is required to produce a distribution with the new metadata - make a source distribution. command:
python setup.py sdist
. in this example it will producedist/buku-3.8.tar.gz
- try install it with pipx
pipx install dist/buku-3.8.tar.gz
and runbuku --version
to check the installed buku version - install
twine>=1.11.0
. - upload first to test.pypi. command:
twine upload --repository-url https://test.pypi.org/legacy/ dist/buku-3.8.tar.gz
- if upload success but result is not as intended, change the version with
postn
-suffix format. fix the program and go to number 5. - if upload sucsess and result is as intended:
- check the program version. maybe rolled it back to original if possible
- upload it to pypi. command:
twine upload --repository-url https://upload.pypi.org/legacy/ dist/buku-3.8.tar.gz
this guideline is based on this guide https://dustingram.com/articles/2018/03/16/markdown-descriptions-on-pypi
file tree example from buku 4.7 / 4.7.1
$ tar -tf buku-4.7.1.tar.gz | tree --fromfile .
.
└── buku-4.7.1
├── auto-completion
│ ├── bash
│ │ └── buku-completion.bash
│ ├── fish
│ │ └── buku.fish
│ └── zsh
│ └── _buku
├── buku.1
├── buku.egg-info
│ ├── dependency_links.txt
│ ├── entry_points.txt
│ ├── PKG-INFO
│ ├── requires.txt
│ ├── SOURCES.txt
│ └── top_level.txt
├── buku.py
├── bukuserver
│ ├── filters.py
│ ├── forms.py
│ ├── __init__.py
│ ├── __main__.py
│ ├── response.py
│ ├── server.py
│ ├── static
│ │ └── bukuserver
│ │ └── js
│ │ ├── bookmark.js
│ │ └── Chart.js
│ ├── templates
│ │ └── bukuserver
│ │ ├── base.html
│ │ ├── bookmark_create.html
│ │ ├── bookmark_create_modal.html
│ │ ├── bookmark_edit.html
│ │ ├── bookmark_edit_modal.html
│ │ ├── bookmarks.html
│ │ ├── home.html
│ │ ├── index.html
│ │ ├── statistic.html
│ │ └── tags.html
│ └── views.py
├── CHANGELOG
├── LICENSE
├── MANIFEST.in
├── PKG-INFO
├── README.md
├── requirements.txt
├── setup.cfg
├── setup.py
└── tests
├── __init__.py
├── test_BukuCrypt.py
├── test_bukuDb
│ ├── 25491522_res_nopt.yaml
│ ├── 25491522_res.yaml
│ ├── Bookmarks
│ ├── firefox_res_nopt.yaml
│ └── firefox_res.yaml
├── test_bukuDb.py
├── test_buku.py
├── test_ExtendedArgumentParser.py
├── test_import_firefox_json.py
├── test_server.py
├── test_setup.py
└── test_views.py
14 directories, 52 files
- register to pypi and test.pypi
- create ~/.pypirc and fill it with your config (example below)
- remove readme.rst if exist
- generate readme.rst
- applied following fix:
- check any text that maybe recognized as enumerated list
- newline between example section
- upload first to test.pypi. command: python3 setup.py sdist upload -r pypitest
- if upload success but result is not as intended, change the version with
postn
-suffix format. fix the program and go to number 6. - if upload sucsess and result is as intended:
- check the program version. maybe rolled it back to original if possible
- upload it to pypi. command: python3 setup.py sdist upload -r pypi
code to generate readme.rst, require pypandoc from pip and pandoc e.g. from ubuntu repo (note that everytime setup.py executed it will generate readme.rst if not exist)
import pypandoc
long_description = pypandoc.convert_file('README.md', 'rst')
with open("README.rst", "w") as f:
f.write(long_description)
[distutils]
index-servers =
pypi
pypitest
[pypi]
repository=https://pypi.python.org/pypi
username=RachmadaniHaryono
password=<password>
[pypitest]
repository=https://test.pypi.org/legacy/
username=rachmadaniHaryono
password=<password>