8. Development

This section only needs to be read by developers of the zhmcclient package. People that want to make a fix or develop some extension, and people that want to test the project are also considered developers for the purpose of this section.

8.1. Code of Conduct

Help us keep zhmcclient open and inclusive. Please read and follow our Code of Conduct.

8.2. Repository

The repository for zhmcclient is on GitHub:

https://github.com/zhmcclient/python-zhmcclient

8.3. Setting up the development environment

The development environment is pretty easy to set up.

Besides having a supported operating system with a supported Python version (see Supported environments), it is recommended that you set up a virtual Python environment.

Then, with a virtual Python environment active, clone the Git repo of this project and prepare the development environment with make develop:

$ git clone git@github.com:zhmcclient/python-zhmcclient.git
$ cd python-zhmcclient
$ make develop

This will install all prerequisites the package needs to run, as well as all prerequisites that you need for development.

Generally, this project uses Make to do things in the currently active Python environment. The command make help (or just make) displays a list of valid Make targets and a short description of what each target does.

8.4. Building the documentation

The ReadTheDocs (RTD) site is used to publish the documentation for the zhmcclient package at http://python-zhmcclient.readthedocs.io/

This page automatically gets updated whenever the master branch of the Git repo for this package changes.

In order to build the documentation locally from the Git work directory, issue:

$ make builddoc

The top-level document to open with a web browser will be build_doc/html/docs/index.html.

8.5. Testing

The zhmcclient project supports the following kinds of tests:

  • unit tests against a mocked HMC, using pytest

  • end2end tests against a real or mocked HMC, using pytest

  • install tests (Linux and MacOS only)

8.5.1. Running unit tests

To run the unit tests in the currently active Python environment, issue:

$ make test

By default, all unit tests are run. The TESTCASES environment variable can be used to limit the testcases that are run. Its value is passed to the -k option of the pytest command. For example:

$ TESTCASES=test_resource.py make test       # Run only this test source file
$ TESTCASES=test_func1  make test            # Run only this test function or test class
$ TESTCASES="test_func1 or test_func2" make test  # Run both of these test functions or classes

Additional options for the pytest command can be specified with the TESTOPTS environment variable. For example:

$ TESTOPTS='-x' make test                    # Stop after first test case failure
$ TESTOPTS='--pdb' make test                 # Invoke debugger on each test case failure

Invoke pytest --help for details on its options including the syntax of the -k option, or see pytest options.

To run the unit tests and some more commands that verify the project is in good shape in all supported Python environments, use Tox. The positional arguments of the tox command are passed to pytest using its -k option. For example:

$ tox                              # Run all tests on all supported Python versions
$ tox -e py27                      # Run all tests on Python 2.7
$ tox -e py27 test_resource.py     # Run only this test source file on Python 2.7
$ tox -e py27 TestInit             # Run only this test class on Python 2.7
$ tox -e py27 TestInit or TestSet  # pytest -k expressions are possible

8.5.2. Running end2end tests

Prepare an HMC inventory file that defines real and/or mocked HMCs the tests should be run against, and an HMC vault file with credentials for the real HMCs.

There are examples for these files, that describe their format in the comment header:

To run the end2end tests in the currently active Python environment, issue:

$ make end2end

By default, the HMC inventory file named .zhmc_inventory.yaml in the home directory of the current user is used. A different path name can be specified with the TESTINVENTORY environment variable.

By default, the HMC vault file named .zhmc_vault.yaml in the home directory of the current user is used. A different path name can be specified with the TESTVAULT environment variable.

By default, the tests are run against the group name or HMC nickname default defined in the HMC inventory file. A different group name or HMC nickname can be specified with the TESTHMC environment variable.

Examples:

  • Run against group or HMC nickname ‘default’ using the specified HMC inventory and vault files:

    $ TESTINVENTORY=`./hmc_inventory.yaml` TESTVAULT=`./hmc_vault.yaml` make end2end
    
  • Run against group or HMC nickname ‘HMC1’ using the default HMC inventory and vault files:

    $ TESTHMC=`HMC1` make end2end
    

8.5.3. Enabling logging during end2end tests

TODO: At this point, the `setup_logging()` function that enables the logging described in this section is not used in the end2end tests

The end2end tests have the ability to log the API calls to the zhmcclient library and the interactions with the (real or mocked) HMC.

By default, logging is set up such that the zhmcclient library logs messages with a log level of “warning” or higher, to stderr.

The log level and the components to be logged can be set using the ZHMC_LOG environment variable:

$ export ZHMC_LOG=COMP=LEVEL[,COMP=LEVEL[,...]]

Where:

  • COMP is one of: all, api, hmc.

  • LEVEL is one of: error, warning, info, debug.

For example, to enable logging of the zhmcclient API calls and the interactions with the HMC, use:

$ export ZHMC_LOG=api=debug,hmc=debug

or, shorter:

$ export ZHMC_LOG=all=debug

8.5.4. HMC inventory file

The HMC inventory file specifies HMCs and/or groups of HMCs to be used for any code that uses the zhmcclient.testutils module such as the end2end tests or the examples in the examples directory.

Its format is described in the comment header of the example HMC inventory file.

The format is compatible to the format of Ansible inventory files in YAML format, with some extensions and some limitations:

Extensions:

  • The HMC inventory files define and document specific variables for the HMC hosts.

Limitations:

  • DNS host names or IP addresses with ranges (e.g. myhost[0:9].xyz.com) are not supported.

For details on the format of Ansible inventory files, see Ansible: How to build your inventory.

8.5.5. HMC vault file

The HMC vault file specifies credentials for real HMCs to be used for any code that uses the zhmcclient.testutils module such as the end2end tests or the examples in the examples directory.

It is required to have the HMC credentials in the HMC vault file; they cannot be specified in the HMC inventory file.

The format of the HMC vault file is described in the comment header of the example HMC vault file.

The data items for HMCs in the HMC vault file are looked up using the HMC names from the HMC inventory file, so they must match.

Limitations:

  • In the current release, HMC vault files cannot be encrypted. To mitigate that, set restrictive file permissions on the HMC vault files.

8.5.6. zhmcclient.testutils module

The zhmcclient.testutils module provides support for running tests against real or mocked HMCs defined in an HMC inventory file.

It defines pytest fixtures and encapsulates the access to the HMC inventory file.

zhmcclient.testutils.hmc_definition(request)[source]

Fixture representing the set of HMC definitions to use for the end2end tests.

A test function parameter using this fixture resolves to the HMCDefinition object of each HMC to test against.

zhmcclient.testutils.hmc_session(request, hmc_definition)[source]

Pytest fixture representing the set of HMC sessions to use for the end2end tests.

Because the hmc_definition parameter of this fixture is again a fixture, the zhmcclient.testutils.hmc_definition() function needs to be imported as well when this fixture is used.

A test function parameter using this fixture resolves to the zhmcclient.Session or zhmcclient_mock.FakedSession object for the HMC session to test against. The session is already logged on to the HMC.

Upon fixture teardown, the session is automatically logged off from the HMC.

zhmcclient.testutils.all_cpcs(request, hmc_session)[source]

Pytest fixture representing the set of all CPCs that are defined in the HMC definition file for the selected HMC or HMC group.

A test function parameter using this fixture resolves to a list of zhmcclient.Cpc objects representing that set of CPCs. These objects have the “short” set of properties from zhmcclient.Cpc.list().

Because the hmc_session parameter of this fixture is again a fixture, the zhmcclient.testutils.hmc_session() function needs to be imported as well when this fixture is used.

zhmcclient.testutils.dpm_mode_cpcs(request, hmc_session)[source]

Pytest fixture representing the set of CPCs in DPM mode that are defined in the HMC definition file for the selected HMC or HMC group.

A test function parameter using this fixture resolves to a list of zhmcclient.Cpc objects representing that set of CPCs. These objects have the “short” set of properties from zhmcclient.Cpc.list().

Because the hmc_session parameter of this fixture is again a fixture, the zhmcclient.testutils.hmc_session() function needs to be imported as well when this fixture is used.

zhmcclient.testutils.classic_mode_cpcs(request, hmc_session)[source]

Pytest fixture representing the set of CPCs in classic mode that are defined in the HMC definition file for the selected HMC or HMC group.

A test function parameter using this fixture resolves to a list of zhmcclient.Cpc objects representing that set of CPCs. These objects have the “short” set of properties from zhmcclient.Cpc.list().

Because the hmc_session parameter of this fixture is again a fixture, the zhmcclient.testutils.hmc_session() function needs to be imported as well when this fixture is used.

zhmcclient.testutils.hmc_definitions(load=True)[source]

Return the list of HMC definitions to be used for testing.

Parameters

load (bool) – Load the HMC inventory and vault files. If None, the ‘TESTEND2END_LOAD’ environment variable is used.

Returns

list of zhmcclient.testutils.HMCDefinition

zhmcclient.testutils.print_hmc_definitions()[source]

Print all available HMC definitions in the HMC inventory and vault files.

class zhmcclient.testutils.HMCDefinitions(inventory_file=None, vault_file=None, testhmc=None, load=None)[source]

The HMC definitions in the HMC inventory and vault files.

Parameters
  • inventory_file (string) – Path name of HMC inventory file. If None, the file specified in the ‘TESTINVENTORY’ environment variable, or the default file in the user’s home directory is used.

  • vault_file (string) – Path name of HMC vault file. If None, the file specified in the ‘TESTVAULT’ environment variable, or the default file in the user’s home directory is used.

  • testhmc (string) – Group name or HMC nickname in HMC inventory file to test against. If None, the file specified in the ‘TESTHMC’ environment variable, or the default name is used.

  • load (bool) – Load the HMC inventory and vault files. If None, the ‘TESTEND2END_LOAD’ environment variable is used.

Raises

Methods:

__repr__()

Return repr(self).

list_hmcs([name])

Return a list of HMCDefinition objects in the HMC inventory file, for the specified HMC group or single HMC nickname.

list_all_hmcs()

List all HMCs in the HMC inventory file.

list_all_group_names()

List all group names in the HMC inventory file.

Attributes:

inventory_file

Path name of HMC inventory file.

vault_file

Path name of HMC vault file.

testhmc

HMC group or single HMC nickname to be tested.

group_names

The names of the HMC groups in the HMC inventory file.

__repr__()[source]

Return repr(self).

property inventory_file

Path name of HMC inventory file.

Type

string

property vault_file

Path name of HMC vault file.

Type

string

property testhmc

HMC group or single HMC nickname to be tested.

Type

string

property group_names

The names of the HMC groups in the HMC inventory file.

Type

list of string

list_hmcs(name=None)[source]

Return a list of HMCDefinition objects in the HMC inventory file, for the specified HMC group or single HMC nickname.

The path names in the HMCDefinition.mock_file property are absolute path names, whereby any relative path names in the HMC inventory file have been interpreted relative to the directory of the HMC inventory file.

Parameters

name (string) – Name of an HMC group or nickname of a single HMC in the HMC inventory file. If None, the default group or nickname defined in HMCDefinitions.testhmc is used.

Returns

The specified HMCs in the HMC

inventory file.

Return type

list of HMCDefinition

Raises

zhmcclient.testutils.HMCNotFound – HMC group or nickname not found.

list_all_hmcs()[source]

List all HMCs in the HMC inventory file.

Returns

All HMCs in the HMC inventory file.

Return type

list of HMCDefinition

list_all_group_names()[source]

List all group names in the HMC inventory file.

Returns

All group names in the HMC inventory file.

Return type

list of string

class zhmcclient.testutils.HMCDefinition(nickname, description='', contact='', access_via='', mock_file=None, host=None, userid=None, password=None, verify=True, ca_certs=None, cpcs=None, add_vars=None)[source]

A single HMC definition.

An HMC definition contains information needed to use the WS API of a real HMC or to setup and use a mocked HMC, some organizational information about the HMC, and some information about the CPCs managed by the HMC that are to be tested. It can also contain arbitrary additional variables.

Parameters
  • nickname (string) – Nickname of the HMC (DNS name, IP address, or host alias).

  • description (string) – Short description of the HMC.

  • contact (string) – Name of the technical contact of the HMC.

  • access_via (string) – Networking preconditions for reaching the HMC.

  • mock_file (string) – Path name of HMC mock file, or None. This argument is used to detect whether the HMC is a real or mocked HMC: If None, it is a real HMC. Otherwise, it is a mocked HMC and the path name is stored as provided.

  • host (string) – IP address or DNS hostname of the real HMC. Required for real HMCs, must not be None. Optional for mocked HMCs.

  • userid (string) – Userid (username) for authenticating with the HMC. Required, must not be None.

  • password (string) – Password for authenticating with the HMC. Required, must not be None.

  • verify (bool) – Verify the HMC certificate as specified in ca_certs. Optional, defaults to True.

  • ca_certs (string) – Path name of certificate file or certificate directory to be used for verifying the HMC certificate, or None. If None, the path name in the ‘REQUESTS_CA_BUNDLE’ environment variable, or the path name in the ‘CURL_CA_BUNDLE’ environment variable, or the certificates in the Mozilla CA Certificate List provided by the ‘certifi’ Python package are used. Optional, defaults to None.

  • cpcs (dict) –

    CPCs managed by the HMC that are to be tested. If None, no CPCs are tested.

    • key: CPC name.

    • value: dict of expected CPC properties, using underscored property names. Used for basic classification of the CPC, e.g. ‘dpm-mode’, ‘machine-type’, ‘machine-model’.

  • add_vars (dict) – Additional variables. The variable values can have arbitrary types.

Methods:

__repr__()

Return repr(self).

Attributes:

nickname

Nickname of the HMC (exists only in this encapsulation class, not known by the HMC itself).

description

Short description of the HMC.

contact

Name of the technical contact of the HMC.

access_via

Networking preconditions for reaching the HMC.

mock_file

Path name of HMC mock file, or None.

host

IP address or DNS hostname of the HMC.

userid

Userid (username) for authenticating with the HMC.

password

Password for authenticating with the HMC.

verify

Verify the HMC certificate as specified in ca_certs.

ca_certs

Path name of certificate file or certificate directory to be used for verifying the HMC certificate, or None.

verify_cert

A combination of verify and ca_certs for direct use as the verify_cert parameter of zhmcclient.Session.

cpcs

CPCs managed by the HMC that are to be tested.

add_vars

Additional variables for the HMC definition.

__repr__()[source]

Return repr(self).

property nickname

Nickname of the HMC (exists only in this encapsulation class, not known by the HMC itself).

Type

string

property description

Short description of the HMC.

Type

string

property contact

Name of the technical contact of the HMC.

Type

string

property access_via

Networking preconditions for reaching the HMC.

For example, Boundary firewall or VPN connection.

Type

string

property mock_file

Path name of HMC mock file, or None.

An HMC mock file defines a mocked HMC based on the zhmcclient_mock support.

This property indicates whether the HMC is a real or mocked HMC: If None, it is a real HMC, otherwise it is a mocked HMC.

Type

string

property host

IP address or DNS hostname of the HMC.

This is a settable property.

Type

string

property userid

Userid (username) for authenticating with the HMC.

Type

string

property password

Password for authenticating with the HMC.

Type

string

property verify

Verify the HMC certificate as specified in ca_certs.

Type

bool

property ca_certs

Path name of certificate file or certificate directory to be used for verifying the HMC certificate, or None.

If None, the path name in the ‘REQUESTS_CA_BUNDLE’ environment variable, or the path name in the ‘CURL_CA_BUNDLE’ environment variable, or the certificates in the Mozilla CA Certificate List provided by the ‘certifi’ Python package are used.

Type

string

property verify_cert

A combination of verify and ca_certs for direct use as the verify_cert parameter of zhmcclient.Session.

Type

bool or string

property cpcs

CPCs managed by the HMC that are to be tested.

Each dict item represents one CPC:

  • key (string): CPC name.

  • value (dict): Dict with expected CPC properties (with underscores).

Type

dict

property add_vars

Additional variables for the HMC definition.

Each dict item represents one variable:

  • key (string): Variable name.

  • value (object): Variable value.

Type

dict

class zhmcclient.testutils.HMCInventoryFile(filepath)[source]

Encapsulation of an HMC inventory file in YAML format.

Attributes:

filepath

Path name of the HMC inventory file.

data

Content of the HMC inventory file, as nested OrderedDict and list objects.

property filepath

Path name of the HMC inventory file.

Type

string

property data

Content of the HMC inventory file, as nested OrderedDict and list objects.

Type

OrderedDict

class zhmcclient.testutils.HMCVaultFile(filepath)[source]

Encapsulation of an HMC vault file in YAML format.

Attributes:

filepath

Path name of the HMC vault file.

data

Content of the HMC vault file, as nested OrderedDict and list objects.

property filepath

Path name of the HMC vault file.

Type

string

property data

Content of the HMC vault file, as nested OrderedDict and list objects.

Type

OrderedDict

class zhmcclient.testutils.HMCInventoryFileError[source]

An error in the HMC inventory file.

class zhmcclient.testutils.HMCVaultFileError[source]

An error in the HMC vault file.

class zhmcclient.testutils.HMCNoVaultError[source]

The HMC vault file does not have a corresponding entry for the HMC.

class zhmcclient.testutils.HMCNotFound[source]

The HMC group was not found in the HMC inventory file.

8.6. Contributing

Third party contributions to this project are welcome!

In order to contribute, create a Git pull request, considering this:

  • Test is required.

  • Each commit should only contain one “logical” change.

  • A “logical” change should be put into one commit, and not split over multiple commits.

  • Large new features should be split into stages.

  • The commit message should not only summarize what you have done, but explain why the change is useful.

  • The commit message must follow the format explained below.

What comprises a “logical” change is subject to sound judgement. Sometimes, it makes sense to produce a set of commits for a feature (even if not large). For example, a first commit may introduce a (presumably) compatible API change without exploitation of that feature. With only this commit applied, it should be demonstrable that everything is still working as before. The next commit may be the exploitation of the feature in other components.

For further discussion of good and bad practices regarding commits, see:

8.7. Format of commit messages

A commit message must start with a short summary line, followed by a blank line.

Optionally, the summary line may start with an identifier that helps identifying the type of change or the component that is affected, followed by a colon.

It can include a more detailed description after the summary line. This is where you explain why the change was done, and summarize what was done.

It must end with the DCO (Developer Certificate of Origin) sign-off line in the format shown in the example below, using your name and a valid email address of yours. The DCO sign-off line certifies that you followed the rules stated in DCO 1.1. In short, you certify that you wrote the patch or otherwise have the right to pass it on as an open-source patch.

We use GitCop during creation of a pull request to check whether the commit messages in the pull request comply to this format. If the commit messages do not comply, GitCop will add a comment to the pull request with a description of what was wrong.

Example commit message:

cookies: Add support for delivering cookies

Cookies are important for many people. This change adds a pluggable API for
delivering cookies to the user, and provides a default implementation.

Signed-off-by: Random J Developer <random@developer.org>

Use git commit --amend to edit the commit message, if you need to.

Use the --signoff (-s) option of git commit to append a sign-off line to the commit message with your name and email as known by Git.

If you like filling out the commit message in an editor instead of using the -m option of git commit, you can automate the presence of the sign-off line by using a commit template file:

  • Create a file outside of the repo (say, ~/.git-signoff.template) that contains, for example:

    <one-line subject>
    
    <detailed description>
    
    Signed-off-by: Random J Developer <random@developer.org>
    
  • Configure Git to use that file as a commit template for your repo:

    git config commit.template ~/.git-signoff.template
    

8.8. Releasing a version

This section shows the steps for releasing a version to PyPI.

It covers all variants of versions that can be released:

  • Releasing a new major version (Mnew.0.0) based on the master branch

  • Releasing a new minor version (M.Nnew.0) based on the master branch

  • Releasing a new update version (M.N.Unew) based on the stable branch of its minor version

This description assumes that you are authorized to push to the remote repo at https://github.com/zhmcclient/python-zhmcclient and that the remote repo has the remote name origin in your local clone.

Any commands in the following steps are executed in the main directory of your local clone of the python-zhmcclient Git repo.

  1. Set shell variables for the version that is being released and the branch it is based on:

    • MNU - Full version M.N.U that is being released

    • MN - Major and minor version M.N of that full version

    • BRANCH - Name of the branch the version that is being released is based on

    When releasing a new major version (e.g. 1.0.0) based on the master branch:

    MNU=1.0.0
    MN=1.0
    BRANCH=master
    

    When releasing a new minor version (e.g. 0.9.0) based on the master branch:

    MNU=0.9.0
    MN=0.9
    BRANCH=master
    

    When releasing a new update version (e.g. 0.8.1) based on the stable branch of its minor version:

    MNU=0.8.1
    MN=0.8
    BRANCH=stable_${MN}
    
  2. Create a topic branch for the version that is being released:

    git checkout ${BRANCH}
    git pull
    git checkout -b release_${MNU}
    
  3. Edit the version file:

    vi zhmcclient/_version.py
    

    and set the __version__ variable to the version that is being released:

    __version__ = 'M.N.U'
    
  4. Edit the change log:

    vi docs/changes.rst
    

    and make the following changes in the section of the version that is being released:

    • Finalize the version.

    • Change the release date to today’s date.

    • Make sure that all changes are described.

    • Make sure the items shown in the change log are relevant for and understandable by users.

    • In the “Known issues” list item, remove the link to the issue tracker and add text for any known issues you want users to know about.

    • Remove all empty list items.

  5. Commit your changes and push the topic branch to the remote repo:

    git commit -asm "Release ${MNU}"
    git push --set-upstream origin release_${MNU}
    
  6. On GitHub, create a Pull Request for branch release_M.N.U.

    Important: When creating Pull Requests, GitHub by default targets the master branch. When releasing based on a stable branch, you need to change the target branch of the Pull Request to stable_M.N.

    The PR creation will cause the “test” workflow to run. That workflow runs tests for all defined environments, since it discovers by the branch name that this is a PR for a release.

  7. On GitHub, once the checks for that Pull Request have succeeded, merge the Pull Request (no review is needed). This automatically deletes the branch on GitHub.

    If the PR did not succeed, fix the issues.

  8. On GitHub, close milestone M.N.U.

    Verify that the milestone has no open items anymore. If it does have open items, investigate why and fix.

  9. Publish the package

    git checkout ${BRANCH}
    git pull
    git branch -D release_${MNU}
    git branch -D -r origin/release_${MNU}
    git tag -f ${MNU}
    git push -f --tags
    

    Pushing the new tag will cause the “publish” workflow to run. That workflow builds the package, publishes it on PyPI, creates a release for it on Github, and finally creates a new stable branch on Github if the master branch was released.

  10. Verify the publishing

8.9. Starting a new version

This section shows the steps for starting development of a new version.

This section covers all variants of new versions:

  • Starting a new major version (Mnew.0.0) based on the master branch

  • Starting a new minor version (M.Nnew.0) based on the master branch

  • Starting a new update version (M.N.Unew) based on the stable branch of its minor version

This description assumes that you are authorized to push to the remote repo at https://github.com/zhmcclient/python-zhmcclient and that the remote repo has the remote name origin in your local clone.

Any commands in the following steps are executed in the main directory of your local clone of the python-zhmcclient Git repo.

  1. Set shell variables for the version that is being started and the branch it is based on:

    • MNU - Full version M.N.U that is being started

    • MN - Major and minor version M.N of that full version

    • BRANCH - Name of the branch the version that is being started is based on

    When starting a new major version (e.g. 1.0.0) based on the master branch:

    MNU=1.0.0
    MN=1.0
    BRANCH=master
    

    When starting a new minor version (e.g. 0.9.0) based on the master branch:

    MNU=0.9.0
    MN=0.9
    BRANCH=master
    

    When starting a new minor version (e.g. 0.8.1) based on the stable branch of its minor version:

    MNU=0.8.1
    MN=0.8
    BRANCH=stable_${MN}
    
  2. Create a topic branch for the version that is being started:

    git checkout ${BRANCH}
    git pull
    git checkout -b start_${MNU}
    
  3. Edit the version file:

    vi zhmcclient/_version.py
    

    and update the version to a draft version of the version that is being started:

    __version__ = 'M.N.U.dev1'
    
  4. Edit the change log:

    vi docs/changes.rst
    

    and insert the following section before the top-most section:

    Version M.N.U.dev1
    ^^^^^^^^^^^^^^^^^^
    
    This version contains all fixes up to version M.N-1.x.
    
    Released: not yet
    
    **Incompatible changes:**
    
    **Deprecations:**
    
    **Bug fixes:**
    
    **Enhancements:**
    
    **Cleanup:**
    
    **Known issues:**
    
    * See `list of open issues`_.
    
    .. _`list of open issues`: https://github.com/zhmcclient/python-zhmcclient/issues
    
  5. Commit your changes and push them to the remote repo:

    git status  # Double check the changed files
    git commit -asm "Start ${MNU}"
    git push --set-upstream origin start_${MNU}
    
  6. On GitHub, create a Pull Request for branch start_M.N.U.

    Important: When creating Pull Requests, GitHub by default targets the master branch. When starting a version based on a stable branch, you need to change the target branch of the Pull Request to stable_M.N.

  7. On GitHub, create a milestone for the new version M.N.U.

    You can create a milestone in GitHub via Issues -> Milestones -> New Milestone.

  8. On GitHub, go through all open issues and pull requests that still have milestones for previous releases set, and either set them to the new milestone, or to have no milestone.

  9. On GitHub, once the checks for the Pull Request for branch start_M.N.U have succeeded, merge the Pull Request (no review is needed). This automatically deletes the branch on GitHub.

  10. Update and clean up the local repo:

    git checkout ${BRANCH}
    git pull
    git branch -D start_${MNU}
    git branch -D -r origin/start_${MNU}