|
| 1 | +.. Copyright (C) 2019 David Miguel Susano Pinto <david.pinto@bioch.ox.ac.uk> |
| 2 | +
|
| 3 | + Permission is granted to copy, distribute and/or modify this |
| 4 | + document under the terms of the GNU Free Documentation License, |
| 5 | + Version 1.3 or any later version published by the Free Software |
| 6 | + Foundation; with no Invariant Sections, no Front-Cover Texts, and |
| 7 | + no Back-Cover Texts. A copy of the license is included in the |
| 8 | + section entitled "GNU Free Documentation License". |
| 9 | +
|
| 10 | +Maintaining |
| 11 | +*********** |
| 12 | + |
| 13 | +This document includes information for those deeper in the project. |
| 14 | + |
| 15 | + |
| 16 | +The NEWS file |
| 17 | +============= |
| 18 | + |
| 19 | +The file should only include user visible changes worth mentioning. |
| 20 | +For example, adding support for a new device should be listed but |
| 21 | +removing multiple lines to address code duplication should not. |
| 22 | + |
| 23 | +It's easier to keep the NEWS file up to date as changes are made. |
| 24 | +This prevents having to check all the changes since the last release |
| 25 | +for such relevant changes. Ideally, the same commit that makes the |
| 26 | +relevant change should also add the entry to the NEWS file. |
| 27 | + |
| 28 | + |
| 29 | +Steps to make a release |
| 30 | +======================= |
| 31 | + |
| 32 | +Because the NEWS file is supposed to always be kept up to date, there |
| 33 | +should be no need to check it. |
| 34 | + |
| 35 | +#. Change version number on `setup.py` and date on `NEWS`. Commit |
| 36 | + these changes only. Note that we use `release-N` for tag and not |
| 37 | + `v.N`. This will enable us to one day perform snapshot releases |
| 38 | + with tags such as `snapshot-N`:: |
| 39 | + |
| 40 | + VERSION=$(python setup.py --version) |
| 41 | + COMMIT=$(git rev-parse HEAD | cut -c1-12) |
| 42 | + sed -i "s,yyyy/mm/dd,$(date +%Y/%m/%d)," NEWS |
| 43 | + git commit -m "maint: release $VERSION" setup.py NEWS |
| 44 | + git tag -s -u $GPGKEY \ |
| 45 | + -m "Added tag release-$VERSION for commit $COMMIT" release-$VERSION |
| 46 | + |
| 47 | +#. Build a source distribution from a git archive export. Performing |
| 48 | + a release from a git archive will ensure that the release will not |
| 49 | + accidentally include modified or untracked files:: |
| 50 | + |
| 51 | + rm -rf target/ |
| 52 | + git archive --format=tar --prefix="target/" HEAD | tar -x |
| 53 | + cd target/ |
| 54 | + python setup.py sdist --formats=gztar |
| 55 | + |
| 56 | + We should probably do this from a git clone and not an archive to |
| 57 | + ensure that we are not using a commit that has not been pushed yet. |
| 58 | + |
| 59 | +#. Upload and sign distribution:: |
| 60 | + |
| 61 | + twine upload -r pypi -s -i $GPGKEY target/dist/microscope-X.tar.gz |
| 62 | + |
| 63 | +#. Add `+dev` to version string and a new entry on the NEWS file:: |
| 64 | + |
| 65 | + sed -i "s,\(^project_version = '[^+]*\)',\1+dev'," setup.py |
| 66 | + # manually add new version line on NEWS file |
| 67 | + git commit setup.py NEWS \ |
| 68 | + -m "maint: set version to $VERSION+dev after $VERSION release." |
| 69 | + git push upstream master |
| 70 | + git push upstream release-$VERSION |
| 71 | + |
| 72 | + |
| 73 | +Documentation |
| 74 | +============= |
| 75 | + |
| 76 | +The documentation is generated automatically with `sphinx |
| 77 | +<https://www.sphinx-doc.org/en/master/>`_. The API section is |
| 78 | +generated from the inline docstrings and makes use of `Sphinx's |
| 79 | +Napoleon extension |
| 80 | +<http://www.sphinx-doc.org/en/stable/ext/napoleon.html>`_. It is |
| 81 | +generated with:: |
| 82 | + |
| 83 | + python setup.py build_sphinx |
| 84 | + |
| 85 | +Versioning |
| 86 | +========== |
| 87 | + |
| 88 | +We use the style `major.minor.patch` for releases and haven't yet had |
| 89 | +to deal with rc. |
| 90 | + |
| 91 | +In between releases and snapshots, we use the `dev` as a local version |
| 92 | +identifiers as per `PEP 440 |
| 93 | +<https://www.python.org/dev/peps/pep-0440/>`_ so a version string |
| 94 | +`0.0.1+dev` is the release `0.0.1` plus development changes on top of |
| 95 | +it (and not development release for an upcoming `0.0.1`). With |
| 96 | +examples: |
| 97 | + |
| 98 | +* `0.0.1` - major version 0, minor version 0, patch version 1 |
| 99 | + |
| 100 | +* `0.0.1+dev` - not a public release. A development build, probably |
| 101 | + from VCS sources, sometime *after* release `0.0.1`. Note the use of |
| 102 | + `+` which marks `dev` as a local version identifier. |
| 103 | + |
| 104 | +* `0.0.1.dev1` - we do not do this. PEP 440 states this would be the |
| 105 | + first development public release *before* `0.0.1`. We use `+dev` |
| 106 | + which are local version and not public releases. This is only |
| 107 | + mentioned here to avoid confusion for people used to that style. |
0 commit comments