Skip to content

Commit 8c89d56

Browse files
committed
Update instructions for publishing releases of the Python runtime
* Added instructions on how to install the tools needed to build and publish the Python runtime. * Fixed formatting of __version__ variable name (the double underscores were previously recognized as Asciidoc italics syntax). * Added step for deleting old built distributions before building new ones, so that files left over from previous builds can't be uploaded by accident. * Added build of wheel in addition to source distribution to the build step (see kaitai-io/kaitai_struct_python_runtime#25). * Added `twine check` step to perform basic checks on the distributions before uploading. * Changed upload instructions from the deprecated `setup.py upload` command to the now recommended `twine upload`. * Updated instructions for providing credentials when uploading. They now no longer need to be stored in an insecure plain text file. * Updated PyPI URLs. * Changed `git push` command so that only the just created tag is pushed, and not any other tags that might exist locally.
1 parent 88dbd58 commit 8c89d56

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

developers.adoc

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -225,25 +225,37 @@ to `X.Y.Z` format (e.g. `0.9.0` for 0.9 release)
225225

226226
=== Python
227227

228-
* Create a `~/.pypirc` file with this (https://github.com/pypa/setuptools/issues/941#issuecomment-279123202[source]):
228+
* Make sure that the needed Python packaging tools are installed and up-to-date:
229+
** Debian/Ubuntu/etc.: `sudo apt install python3-setuptools python3-wheel twine`
230+
** Other Linuxes: see https://packaging.python.org/guides/installing-using-linux-tools/[Python Packaging User Guide]
231+
** Everywhere else: use your system package manager, or `python3 -m pip install --upgrade setuptools twine wheel`
232+
* Pump version in `kaitaistruct.py`, seek `\\__version__ =`
233+
* Build distributions and upload them to PyPI:
229234
+
230-
[source,ini]
235+
[source,bash]
231236
----
232-
[distutils]
233-
index-servers =
234-
pypi
235-
236-
[pypi]
237-
repository: https://pypi.python.org/pypi
238-
username: <login>
239-
password: <pass>
237+
# Delete any old previously built distributions.
238+
$ rm -r dist/
239+
# Build source and wheel distributions.
240+
$ python3 setup.py sdist bdist_wheel
241+
# Run basic correctness checks on the built distributions.
242+
$ twine check dist/*
243+
# Upload the built distributions.
244+
# You may want to upload to TestPyPI first as a test before uploading to the real PyPI.
245+
# `twine upload` will prompt for credentials,
246+
# or you can provide them via the environment variables TWINE_USERNAME and TWINE_PASSWORD
247+
# (see https://twine.readthedocs.io/en/latest/#environment-variables).
248+
$ twine upload --repository=testpypi dist/* # Upload to TestPyPI (https://test.pypi.org/)
249+
$ twine upload dist/* # Upload to live PyPI (https://pypi.org/)
250+
----
251+
* Check that new version appears under https://pypi.org/project/kaitaistruct/#history
252+
* Create and push a Git tag for the new version:
253+
+
254+
[source,bash]
255+
----
256+
$ git tag $VERSION
257+
$ git push origin $VERSION
240258
----
241-
* Pump version in `kaitaistruct.py`, seek `__version__ =`
242-
* `python3 setup.py sdist upload`
243-
** (use `python3 setup.py sdist upload -r pypitest` to publish to testing server)
244-
* Check that new version appears at https://pypi.python.org/pypi/kaitaistruct[https://pypi.python.org/pypi/kaitaistruct]`/$VERSION`
245-
* `git tag $VERSION`
246-
* `git push --tags`
247259

248260
=== Ruby
249261

0 commit comments

Comments
 (0)