summaryrefslogtreecommitdiff
path: root/doc/HOWTO_RELEASE.rst.txt
blob: 3ed15e99cc512a827554e120449e6601ddc1f6e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
This file gives an overview of what is necessary to build binary releases for
NumPy.

Current build and release info
==============================

The current info on building and releasing NumPy and SciPy is scattered in
several places. It should be summarized in one place, updated and where
necessary described in more detail. The sections below list all places where
useful info can be found.

Source tree
-----------
* INSTALL.txt
* release.sh
* pavement.py

NumPy Docs
----------
* https://github.com/numpy/numpy/blob/master/doc/HOWTO_RELEASE.rst.txt
* http://projects.scipy.org/numpy/wiki/MicrosoftToolchainSupport

SciPy.org wiki
--------------
* http://www.scipy.org/Installing_SciPy and links on that page.
* http://new.scipy.org/building/windows.html

Doc wiki
--------
* http://docs.scipy.org/numpy/docs/numpy-docs/user/install.rst/

Release Scripts
---------------
* https://github.com/numpy/numpy-vendor

Supported platforms and versions
================================

Python 2.7 and >=3.4 are the currently supported versions when building from
source.  We test numpy against all these versions every time we merge code to
trunk.  Binary installers may be available for a subset of these versions (see
below).

OS X
----

Python 2.7 and >=3.4 are the versions for which we provide binary installers.
OS X versions >= 10.6 are supported.  We build binary wheels for OSX that are
compatible with Python.org Python, system Python, homebrew and macports - see
this `OSX wheel building summary
<https://github.com/MacPython/wiki/wiki/Spinning-wheels>`_ for details.

Windows
-------

We build 32- and 64-bit wheels for Python 2.7, 3.4, 3.5 on Windows. Windows
XP, Vista, 7, 8 and 10 are supported.  We build numpy using the MSVC compilers
on Appveyor, but we are hoping to update to a `mingw-w64 toolchain
<http://mingwpy.github.io>`_.  The Windows wheels use ATLAS for BLAS / LAPACK.

Linux
-----

We build and ship `manylinux1 <https://www.python.org/dev/peps/pep-0513>`_
wheels for numpy.  Many Linux distributions include their own binary builds
of NumPy.

BSD / Solaris
-------------

No binaries are provided, but successful builds on Solaris and BSD have been
reported.

Tool chain
==========

We build all our wheels on cloud infrastructure - so this list of compilers is
for information and debugging builds locally.  See the ``.travis.yml`` and
``appveyor.yml`` scripts in the `numpy wheels`_ repo for the definitive source
of the build recipes. Packages that are available using pip are noted.

Compilers
---------

The same gcc version is used as the one with which Python itself is built on
each platform. At the moment this means:

* OS X builds on travis currently use `clang`.  It appears that binary wheels
  for OSX >= 10.6 can be safely built from the travis-ci OSX 10.9 VMs
  when building against the Python from the Python.org installers;
* Windows builds use the MSVC version corresponding to the Python being built
  against;
* Manylinux1 wheels use the gcc provided on the Manylinux docker images.

You will need Cython for building the binaries.  Cython compiles the ``.pyx``
files in the numpy distribution to ``.c`` files.

Building source archives and wheels
-----------------------------------

You will need write permission for numpy-wheels in order to trigger wheel
builds.

* Python(s) from `python.org <http://python.org>`_ or linux distro.
* cython
* virtualenv (pip)
* Paver (pip)
* numpy-wheels `<https://github.com/MacPython/numpy-wheels>`_ (clone)

Building docs
-------------

Building the documents requires a number of latex ``.sty`` files. Install them
all to avoid aggravation.

* Sphinx (pip)
* numpydoc (pip)
* Matplotlib
* Texlive (or MikTeX on Windows)

Uploading to PyPI
-----------------

* terryfy `<https://github.com/MacPython/terryfy>`_ (clone).
* beautifulsoup4 (pip)
* delocate (pip)
* auditwheel (pip)
* twine (pip)

Generating author/pr lists
--------------------------

You will need an personal access token
`<https://help.github.com/articles/creating-an-access-token-for-command-line-use/>`_
so that scripts can access the github numpy repository

* gitpython (pip)
* pygithub (pip)

Virtualenv
----------

Virtualenv is a very useful tool to keep several versions of packages around.
It is also used in the Paver script to build the docs.


What is released
================

Wheels
------

* Windows wheels for Python 2.7, 3.4, 3.5, for 32- and 64-bit, built using
  Appveyor;
* Dual architecture OSX wheels built via travis-ci;
* 32- and 64-bit Manylinux1 wheels built via travis-ci.

See the `numpy wheels`_ building repository for more detail.

.. _numpy wheels : https://github.com/MacPython/numpy-wheels

Other
-----

* Release Notes
* Changelog

Source distribution
-------------------

We build source releases in both .zip and .tar.gz formats.

Release process
===============

Agree on a release schedule
---------------------------
A typical release schedule is one beta, two release candidates and a final
release.  It's best to discuss the timing on the mailing list first, in order
for people to get their commits in on time, get doc wiki edits merged, etc.
After a date is set, create a new maintenance/x.y.z branch, add new empty
release notes for the next version in the master branch and update the Trac
Milestones.

Make sure current trunk builds a package correctly
--------------------------------------------------
::

    git clean -fxd
    python setup.py bdist
    python setup.py sdist

To actually build the binaries after everything is set up correctly, the
release.sh script can be used. For details of the build process itself it is
best to read the pavement.py script.

.. note:: The following steps are repeated for the beta(s), release
   candidates(s) and the final release.

Check that docs can be built
----------------------------
Do::

    cd doc/
    make dist

to check that the documentation is in a buildable state.  See
doc/HOWTO_BUILD_DOCS.rst.txt for more details and for how to update
http://docs.scipy.org.

Check deprecations
------------------
Before the release branch is made, it should be checked that all deprecated
code that should be removed is actually removed, and all new deprecations say
in the docstring or deprecation warning at what version the code will be
removed.

Check the C API version number
------------------------------
The C API version needs to be tracked in three places

- numpy/core/setup_common.py
- numpy/core/code_generators/cversions.txt
- numpy/core/include/numpy/numpyconfig.h

There are three steps to the process.

1. If the API has changed, increment the C_API_VERSION in setup_common.py. The
   API is unchanged only if any code compiled against the current API will be
   backward compatible with the last released NumPy version. Any changes to
   C structures or additions to the public interface will make the new API
   not backward compatible.

2. If the C_API_VERSION in the first step has changed, or if the hash of
   the API has changed, the cversions.txt file needs to be updated. To check
   the hash, run the script numpy/core/cversions.py and note the api hash that
   is printed. If that hash does not match the last hash in
   numpy/core/code_generators/cversions.txt the hash has changed. Using both
   the appropriate C_API_VERSION and hash, add a new entry to cversions.txt.
   If the API version was not changed, but the hash differs, you will need to
   comment out the previous entry for that API version. For instance, in NumPy
   1.9 annotations were added, which changed the hash, but the API was the
   same as in 1.8. The hash serves as a check for API changes, but it is not
   definitive.

   If steps 1 and 2 are done correctly, compiling the release should not give
   a warning "API mismatch detect at the beginning of the build.

3. The numpy/core/include/numpy/numpyconfig.h will need a new
   NPY_X_Y_API_VERSION macro, where X and Y are the major and minor version
   numbers of the release. The value given to that macro only needs to be
   increased from the previous version if some of the functions or macros in
   the include files were deprecated.

The C ABI version number in numpy/core/setup_common.py should only be
updated for a major release.

Check the release notes
-----------------------
Check that the release notes are up-to-date.

Write or update the release notes in a file named for the release, such as
``doc/release/1.11.0-notes.rst``.

Mention at least the following:

  - major new features
  - deprecated and removed features
  - supported Python versions
  - for SciPy, supported NumPy version(s)
  - outlook for the near future

Also make sure that as soon as the branch is made, there is a new release
notes file in trunk for the next release.

Update the release status and create a release "tag"
----------------------------------------------------
Identify the commit hash of the release, e.g. 1b2e1d63ff.

::
    git co 1b2e1d63ff # gives warning about detached head

First, change/check the following variables in ``pavement.py`` depending on the
release version::

    RELEASE_NOTES = 'doc/release/1.7.0-notes.rst'
    LOG_START = 'v1.6.0'
    LOG_END = 'maintenance/1.7.x'

Do any other changes. When you are ready to release, do the following
changes::

    diff --git a/setup.py b/setup.py
    index b1f53e3..8b36dbe 100755
    --- a/setup.py
    +++ b/setup.py
    @@ -57,7 +57,7 @@ PLATFORMS           = ["Windows", "Linux", "Solaris", "Mac OS-
     MAJOR               = 1
     MINOR               = 7
     MICRO               = 0
    -ISRELEASED          = False
    +ISRELEASED          = True
     VERSION             = '%d.%d.%drc1' % (MAJOR, MINOR, MICRO)

     # Return the git revision as a string

And make sure the ``VERSION`` variable is set properly.

Now you can make the release commit and tag.  We recommend you don't push
the commit or tag immediately, just in case you need to do more cleanup.  We
prefer to defer the push of the tag until we're confident this is the exact
form of the released code (see: :ref:`push-tag-and-commit`):

    git commit -s -m "REL: Release." setup.py
    git tag -s <version>

The ``-s`` flag makes a PGP (usually GPG) signed tag.  Please do sign the
release tags.

The release tag should have the release number in the annotation (tag
message).  Unfortunately the name of a tag can be changed without breaking the
signature, the contents of the message cannot.

See : https://github.com/scipy/scipy/issues/4919 for a discussion of signing
release tags, and http://keyring.debian.org/creating-key.html for instructions
on creating a GPG key if you do not have one.

To make your key more readily identifiable as you, consider sending your key
to public keyservers, with a command such as::

    gpg --send-keys <yourkeyid>

Apply patch to fix bogus strides
--------------------------------
NPY_RELAXED_STRIDE_CHECKING was made the default in NumPy 1.10.0 and bogus
strides are used in the development branch to smoke out problems. The
`patch <https://github.com/numpy/numpy/pull/5996>`_ should be updated if
necessary and applied to the release branch to rationalize the strides.

Update the version of the master branch
---------------------------------------
Increment the release number in setup.py. Release candidates should have "rc1"
(or "rc2", "rcN") appended to the X.Y.Z format.

Also create a new version hash in cversions.txt and a corresponding version
define NPY_x_y_API_VERSION in numpyconfig.h

Trigger the wheel builds on travis-ci and Appveyor
--------------------------------------------------

See the `numpy wheels` repository.

In that repository edit the files:

* ``.travis.yml``;
* ``appveyor.yml``.

In both cases, set the ``BUILD_COMMIT`` variable to the current release tag -
e.g. ``v1.11.1``.

Make sure that the release tag has been pushed.

Trigger a build by doing a commit of your edits to ``.travis.yml`` and
``appveyor.yml`` to the repository::

    cd /path/to/numpy-wheels
    # Edit .travis.yml, appveyor.yml
    git commit
    git push

The wheels, once built, appear at a Rackspace container pointed at by:

* http://wheels.scipy.org
* https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com

The HTTP address may update first, and you should wait 15 minutes after the
build finishes before fetching the binaries.

Make the release
----------------

Build the changelog and notes for upload with::

    paver write_release_and_log

The tar-files and binary releases for distribution should be uploaded to SourceForge,
together with the Release Notes and the Changelog. Uploading can be done
through a web interface or, more efficiently, through scp/sftp/rsync as
described in the SourceForge
`upload guide <https://sourceforge.net/apps/trac/sourceforge/wiki/Release%20files%20for%20download>`_.
For example::

  scp <filename> <username>,numpy@frs.sourceforge.net:/home/frs/project/n/nu/numpy/NumPy/<releasedir>/

Update PyPI
-----------

The wheels and source should be uploaded to PyPI.

You should upload the wheels first, and the source formats last, to make sure
that pip users don't accidentally get a source install when they were
expecting a binary wheel.

You can do this automatically using the ``wheel-uploader`` script from
https://github.com/MacPython/terryfy.  Here is the recommended incantation for
downloading all the Windows, Manylinux, OSX wheels and uploading to PyPI.

::

    cd ~/wheelhouse   # local directory to cache wheel downloads
    CDN_URL=https://3f23b170c54c2533c070-1c8a9b3114517dc5fe17b7c3f8c63a43.ssl.cf2.rackcdn.com
    wheel-uploader -u $CDN_URL -w warehouse -v -s -t win numpy 1.11.1rc1
    wheel-uploader -u $CDN_URL -w warehouse -v -s -t macosx numpy 1.11.1rc1
    wheel-uploader -u $CDN_URL -w warehouse -v -s -t manylinux1 numpy 1.11.1rc1

The ``-v`` flag gives verbose feedback, ``-s`` causes the script to sign the
wheels with your GPG key before upload.  ``-r warehouse`` causes the upload to
use the Warehouse PyPI server.  This is a good idea because the Warehouse
server seems to be a lot more reliable in receiving automated wheel uploads.
For this flag to work, you will need a ``warehouse`` section in your
``~/.pypirc`` file, of form:

    [distutils]
    index-servers =
        pypi
        warehouse

    [pypi]
    username:your_user_name
    password:your_password

    [warehouse]
    repository: https://upload.pypi.io/legacy/
    username: your_user_name
    password: your_password

    [server-login]
    username:your_user_name
    password:your_password

Don't forget to upload the wheels before the source tarball, so there is no
period for which people switch from an expected binary install to a source
install from PyPI.

There are two ways to update the source release on PyPI, the first one is::

    $ git clean -fxd  # to be safe
    $ python setup.py sdist --formats=gztar,zip  # to check
    # python setup.py sdist --formats=gztar,zip upload --sign

This will ask for your key PGP passphrase, in order to sign the built source
packages.

The second way is to upload the PKG_INFO file inside the sdist dir in the
web interface of PyPI. The source tarball can also be uploaded through this
interface.

.. _push-tag-and-commit:

Push the release tag and commit
-------------------------------

Finally, now you are confident this tag correctly defines the source code that
you released you can push the tag and release commit up to github::

    git push  # Push release commit
    git push upstream <version>  # Push tag named <version>

where ``upstream`` points to the main https://github.com/numpy/numpy.git
repository.

Update docs.scipy.org
---------------------

All documentation for a release can be updated on http://docs.scipy.org/ with:

    make dist
    make upload USERNAME=<yourname> RELEASE=1.11.0

Note that ``<username>`` must have SSH credentials on the server.  If you don't
have those, ask someone who does (the list currently includes @rgommers,
@juliantaylor and @pv).

Also rebuild and upload ``docs.scipy.org`` front page, if the release
series is a new one. The front page sources have their own repo:
https://github.com/scipy/docs.scipy.org.  Do the following:

- Update ``index.rst`` for the new version.
- ``make dist``
- Check that the built documentation is OK.
- ``touch output-is-fine``
- ``make upload USERNAME=<username> RELEASE=1.x.y``

Update scipy.org
----------------

A release announcement with a link to the download site should be placed in the
sidebar of the front page of scipy.org.

The scipy.org should be a PR at https://github.com/scipy/scipy.org. The file
that needs modification is ``www/index.rst``. Search for ``News``.

Announce to the lists
---------------------

The release should be announced on the mailing lists of
NumPy and SciPy, to python-announce, and possibly also those of
Matplotlib,IPython and/or Pygame.

During the beta/RC phase an explicit request for testing the binaries with
several other libraries (SciPy/Matplotlib/Pygame) should be posted on the
mailing list.

Announce to Linux Weekly News
-----------------------------

Email the editor of LWN to let them know of the release.  Directions at:
https://lwn.net/op/FAQ.lwn#contact

After the final release
-----------------------
After the final release is announced, a few administrative tasks are left to be
done:

  - Forward port changes in the release branch to release notes and release
    scripts, if any, to trunk.
  - Update the Milestones in Trac.