22Building and uploading netcdf4-python wheels
33############################################
44
5- *******
6- For OSX
7- *******
5+ We automate wheel building using this custom github repository that builds on
6+ the travis-ci OSX machines and the travis-ci Linux machines.
87
9- We automate OSX wheel building using this custom github repository that builds
10- on the travis-ci OSX machines.
11-
12- The travis-ci interface for the builds is :
8+ The travis-ci interface for the builds is
139https://travis-ci.org/MacPython/netcdf4-python-wheels
1410
15- The driving github repository is :
11+ The driving github repository is
1612https://github.com/MacPython/netcdf4-python-wheels
1713
1814How it works
1915============
2016
2117The wheel-building repository:
2218
23- * does a fresh build of the required C / C++ libraries;
19+ * does a fresh build of any required C / C++ libraries;
2420* builds a netcdf4-python wheel, linking against these fresh builds;
25- * processes the wheel using ` delocate
26- <https://pypi.python.org/pypi/ delocate> `_. ` delocate ` copies the required
27- dynamic libraries into the wheel and relinks the extension modules against
28- the copied libraries;
29- * uploads the built wheel to http://wheels.scipy.org (a Rackspace container
21+ * processes the wheel using delocate _ (OSX) or auditwheel _ `` repair ``
22+ ( Manylinux1 _). `` delocate `` and `` auditwheel `` copy the required dynamic
23+ libraries into the wheel and relinks the extension modules against the
24+ copied libraries;
25+ * uploads the built wheels to http://wheels.scipy.org (a Rackspace container
3026 kindly donated by Rackspace to scikit-learn).
3127
32- The resulting wheel is therefore self-contained and does not need any external
33- dynamic libraries apart from those provided as standard by OSX.
28+ The resulting wheels are therefore self-contained and do not need any external
29+ dynamic libraries apart from those provided as standard by OSX / Linux as
30+ defined by the manylinux1 standard.
3431
3532The ``.travis.yml `` file in this repository has a line containing the API key
3633for the Rackspace container encrypted with an RSA key that is unique to the
@@ -41,13 +38,16 @@ directory pointed to by http://wheels.scipy.org.
4138Triggering a build
4239==================
4340
41+ You will likely want to edit the ``.travis.yml `` file to specify the
42+ ``BUILD_COMMIT `` before triggering a build - see below.
43+
4444You will need write permission to the github repository to trigger new builds
4545on the travis-ci interface. Contact us on the mailing list if you need this.
4646
4747You can trigger a build by:
4848
49- * making a commit to the `netcdf4-python-wheels ` repository (e.g. with `git
50- commit --allow-empty `); or
49+ * making a commit to the `` netcdf4-python-wheels `` repository (e.g. with ` `git
50+ commit --allow-empty `` ); or
5151* clicking on the circular arrow icon towards the top right of the travis-ci
5252 page, to rerun the previous build.
5353
@@ -57,23 +57,11 @@ Keeping the old build logs helps us keep track of previous problems and
5757successful builds.
5858
5959Which netcdf4-python commit does the repository build?
60- ======================================================
61-
62- By default, the `netcdf4-python-wheels ` repository is usually set up to build
63- the latest git tag. By "latest" we mean the tag on the branch most recently
64- branched from master - see http://stackoverflow.com/a/24557377/1939576. To
65- check whether you are building the latest tag have a look around line 5 of
66- `.travis.yml ` in the `netcdf4-python-wheels ` repository. You should see something
67- like::
68-
69- - BUILD_COMMIT='latest-tag'
60+ ============================================
7061
71- If this is commented out, then the repository is set up to build the current
72- commit in the `netcdf4-python ` submodule of the repository. If it is set to
73- another value then it will be specifying a commit to build.
74-
75- You can therefore build any arbitrary commit by specifying the commit hash or
76- branch name or tag name in this line of the `.travis.yml ` file.
62+ The ``netcdf4-python-wheels `` repository will build the commit specified in the
63+ ``BUILD_COMMIT `` at the top of the ``.travis.yml `` file. This can be any
64+ naming of a commit, including branch name, tag name or commit hash.
7765
7866Uploading the built wheels to pypi
7967==================================
@@ -82,42 +70,66 @@ Be careful, http://wheels.scipy.org points to a container on a distributed
8270content delivery network. It can take up to 15 minutes for the new wheel file
8371to get updated into the container at http://wheels.scipy.org.
8472
85- When the wheels are updated, you can of course just download them to your
86- machine manually, and then upload them manually to pypi, or by using
87- twine _. You can also use a script for doing this, housed at :
73+ The same contents appear at
74+ https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com;
75+ you might prefer this address because it is https.
76+
77+ When the wheels are updated, you can download them to your machine manually,
78+ and then upload them manually to pypi, or by using twine _. You can also use a
79+ script for doing this, housed at :
8880https://github.com/MacPython/terryfy/blob/master/wheel-uploader
8981
90- You'll need twine and `beautiful soup 4 <bs4 >`_.
82+ For the ``wheel-uploader `` script, you'll need twine and `beautiful soup 4
83+ <bs4> `_.
9184
9285You will typically have a directory on your machine where you store wheels,
9386called a `wheelhouse `. The typical call for `wheel-uploader ` would then
9487be something like::
9588
96- wheel-uploader -v -s -w ~/wheelhouse netcdf4-python 1.0.3
89+ VERSION=1.2.4
90+ CDN_URL=https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com
91+ wheel-uploader -r warehouse -u $CDN_URL -s -v -w ~/wheelhouse -t macosx netCDF4 $VERSION
92+ wheel-uploader -r warehouse -u $CDN_URL -s -v -w ~/wheelhouse -t manylinux1 netCDF4 $VERSION
9793
9894where:
9995
100- * `-v ` means give verbose messages;
101- * `-s ` asks to use your GPG key to sign the wheels before upload;
102- * `-w ~/wheelhouse ` means download the wheels from https://wheels.scipy.org to
103- the directory `~/wheelhouse `;
104- * `netcdf4-python ` is the root name of the wheel(s) to download / upload;
105- * `1.0.3 ` is the version to download / upload.
96+ * ``-r warehouse `` uses the upcoming Warehouse PyPI server (it is more
97+ reliable than the current PyPI service for uploads);
98+ * ``-u `` gives the URL from which to fetch the wheels, here the https address,
99+ for some extra security;
100+ * ``-s `` causes twine to sign the wheels with your GPG key;
101+ * ``-v `` means give verbose messages;
102+ * ``-w ~/wheelhouse `` means download the wheels from to the local directory
103+ ``~/wheelhouse ``.
104+
105+ ``netCDF4 `` is the root name of the wheel(s) to download / upload, and ``1.2.4 ``
106+ is the version to download / upload.
107+
108+ In order to use the Warehouse PyPI server, you will need something like this
109+ in your ``~/.pypirc `` file::
106110
107- So, in this case, `wheel-uploader ` will download all wheels starting with
108- `netcdf4-python-1.0.3- ` from http://wheels.scipy.org to `~/wheelhouse `, then upload
109- them to pypi.
111+ [distutils]
112+ index-servers =
113+ pypi
114+ warehouse
110115
111- Of course, you will need permissions to upload to pypi, for this to work.
116+ [pypi]
117+ username:your_user_name
118+ password:your_password
112119
113- Maintaining the build repo
114- ==========================
120+ [warehouse]
121+ repository: https://upload.pypi.io/legacy/
122+ username: your_user_name
123+ password: your_password
115124
116- * Check minimum numpy versions to build against in ``.travis.yml `` file. You
117- need to build against the earliest numpy that netcdf4-python is compatible with; see
118- `forward, backward numpy compatibility
119- <http://stackoverflow.com/questions/17709641/valueerror-numpy-dtype-has-the-wrong-size-try-recompiling/18369312#18369312> `_
125+ So, in this case, ``wheel-uploader `` will download all wheels starting with
126+ ``netCDF4-1.2.4- `` from http://wheels.scipy.org to ``~/wheelhouse ``, then
127+ upload them to PyPI.
120128
129+ Of course, you will need permissions to upload to PyPI, for this to work.
121130
131+ .. _manylinux1 : https://www.python.org/dev/peps/pep-0513
122132.. _twine : https://pypi.python.org/pypi/twine
123133.. _bs4 : https://pypi.python.org/pypi/beautifulsoup4
134+ .. _delocate : https://pypi.python.org/pypi/delocate
135+ .. _auditwheel : https://pypi.python.org/pypi/auditwheel
0 commit comments