Skip to content

Commit f224742

Browse files
committed
DOC: Update ITK remote module Python package GitHub Actions docs
1 parent 1b41327 commit f224742

File tree

5 files changed

+73
-62
lines changed

5 files changed

+73
-62
lines changed

docs/Build_ITK_Module_Python_packages.rst

Lines changed: 73 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Build ITK Module Python packages
33
======================================
44

55
ITK is organized into *modules*. Modules for ITK can be developed outside the
6-
ITK source tree as *external modules*. The *external module* can be made
6+
ITK source tree as *remote modules*. The *remote module* can be made
77
available in ITK's `CMake <https://www.cmake.org>`_ configuration by
88
`contributing it
99
<https://github.com/InsightSoftwareConsortium/ITKModuleTemplate#remote-module>`_
10-
as a *remote module*. Python packages can also be generated for external
10+
as a *remote module*. Python packages can also be generated for remote
1111
modules and uploaded to the `Python Package Index (PyPI) <https://pypi.org>`_
1212

13-
This section describes how to create, build, and upload ITK external
13+
This section describes how to create, build, and upload ITK remote
1414
module Python packages to PyPI.
1515

1616

@@ -36,33 +36,84 @@ can be found in the `ITK Software Guide
3636
GitHub automated CI package builds
3737
==================================
3838

39-
Freely available continous integration (CI) testing services for open source
40-
repositories on `GitHub <https://github.com/>`_ can be used to generate Linux,
39+
Freely available GitHub Action continous integration (CI) build and test services for open source
40+
repositories are provided by `GitHub <https://github.com/>`_. These services will build and test the C++ code for your module and also generate Linux,
4141
macOS, and Windows Python packages for your module.
4242

43-
After enabling builds for the GitHub repository with a `CircleCI
44-
<https://circleci.com/>`_, `TravisCI <https://travis-ci.org/>`_,
45-
and `AppVeyor <https://www.appveyor.com/>`_ account, Python wheel
46-
packages will be available with the continuous integration builds.
47-
These services use the configurations generated by the `ITKModuleTemplate <https://github.com/InsightSoftwareConsortium/ITKModuleTemplate>`_.
43+
For every pull request and push to the GitHub repository, a GitHub Action will
44+
run that builds and runs the repository's C++ tests and reports the results to
45+
the [ITK CDash Dashboard](https://open.cdash.org/index.php?project=Insight).
46+
Python packages are also generated for every commit. Packages for a commit's
47+
build can be downloaded from the GitHub Action result page in the *Artifacts*
48+
Section.
4849

49-
.. figure:: https://i.imgur.com/OEujGsl.png
50-
:alt: CircleCI Python wheels
50+
.. figure:: images/GitHubActionArtifacts.png
51+
:alt: GitHub Action Artifacts
5152

52-
Linux Python package wheel links can be found in the CircleCI *Artifacts*
53-
tab after expanding the available folders.
53+
Upload the packages to PyPI
54+
----------------------------
55+
56+
First, `register for an account on PyPI <https://pypi.org>`_.
57+
58+
Next, create a `~/.pypirc` file with your login credentials::
59+
60+
[distutils]
61+
index-servers =
62+
pypi
63+
pypitest
64+
65+
[pypi]
66+
username=<your-username>
67+
password=<your-password>
68+
69+
[pypitest]
70+
repository=https://test.pypi.org/legacy/
71+
username=<your-username>
72+
password=<your-password>
73+
74+
where `<your-username>` and `<your-password>` correspond to your PyPI account.
75+
76+
Then, upload wheels to the testing server::
77+
78+
python -m pip install twine
79+
python -m twine upload -r pypitest dist/*
80+
81+
Check out the packages on `<https://test.pypi.org/>`_ the testing server.
82+
83+
Finally, upload the wheel packages to the production PyPI server::
84+
85+
python -m twine upload dist/*
86+
87+
Congratulations! Your packages can be installed with the commands::
88+
89+
python -m pip install --upgrade pip
90+
python -m pip install itk-<yourmodulename>
91+
92+
Automate PyPI Package Uploads
93+
-----------------------------
94+
95+
Automated uploads of Python packages to the Python package index,
96+
[PyPI](https://pypi.org) will occur after adding a PyPI upload token to GitHub
97+
and creating a Git tag.
98+
99+
.. figure:: images/PyPIToken.png
100+
:alt: PyPI Token
54101

55-
.. figure:: https://imgur.com/tHMhTII.png
56-
:alt: TravisCI Python wheels
102+
Then, add the API token to the GitHub repository's *Settings -> Secrets* page
103+
in a key called *pypi_password*. Note that this will be a *token* instead of a
104+
password. Limit the scope of the token to the individual package as a best
105+
practice.
57106

58-
macOS Python package wheels can be downloaded by visiting to the `file.io`
59-
link found in the build output. Note: this link may only be valid for the
60-
initial download.
107+
.. figure:: images/GitHubPyPISecret.png
108+
:alt: GitHub PyPI token secret
61109

62-
.. figure:: http://imgur.com/Cj5vs3S.png
63-
:alt: AppVeyor Python wheels
110+
To push packages to PyPI, first, make sure to update the `version` for your
111+
package in the *setup.py* file. Then create a Git tag corresponding to the
112+
version. A Git tag can be created in the GitHub user interface via
113+
*Releases -> Draft a new release*.
64114

65-
Windows Python package wheel links can be found in the AppVeyor *Artifacts* tab.
115+
.. figure:: images/GitHubReleaseTag.png
116+
:alt: GitHub Release Tag
66117

67118

68119
Automated platform scripts
@@ -123,43 +174,3 @@ In a PowerShell prompt, run the `windows-build-wheels.ps1` script::
123174
PS C:\Windows> cd C:\ITKMyModule
124175
PS C:\ITKMyModule> git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git IPP
125176
PS C:\ITKMyModule> .\ITKPythonPackage\scripts\windows-download-cache-and-build-module-wheels.ps1
126-
127-
128-
Upload the packages to PyPI
129-
===========================
130-
131-
First, `register for an account on PyPI <https://pypi.org>`_.
132-
133-
Next, create a `~/.pypirc` file with your login credentials::
134-
135-
[distutils]
136-
index-servers =
137-
pypi
138-
pypitest
139-
140-
[pypi]
141-
username=<your-username>
142-
password=<your-password>
143-
144-
[pypitest]
145-
repository=https://test.pypi.org/legacy/
146-
username=<your-username>
147-
password=<your-password>
148-
149-
where `<your-username>` and `<your-password>` correspond to your PyPI account.
150-
151-
Then, upload wheels to the testing server::
152-
153-
python -m pip install twine
154-
python -m twine upload -r pypitest dist/*
155-
156-
Check out the packages on `<https://test.pypi.org/>`_ the testing server.
157-
158-
Finally, upload the wheel packages to the production PyPI server::
159-
160-
python -m twine upload dist/*
161-
162-
Congratulations! Your packages can be installed with the commands::
163-
164-
python -m pip install --upgrade pip
165-
python -m pip install itk-<yourmodulename>
91.7 KB
Loading

docs/images/GitHubPyPISecret.png

49.9 KB
Loading

docs/images/GitHubReleaseTag.png

71.1 KB
Loading

docs/images/PyPIToken.png

30.4 KB
Loading

0 commit comments

Comments
 (0)