Skip to content

Latest commit

 

History

History
134 lines (106 loc) · 4.54 KB

dev-README.md

File metadata and controls

134 lines (106 loc) · 4.54 KB

Package Development

pyenv helps to manage different Python installations side by side.

Note: Currently, not in use.

Example:

$ pyenv install 3.11.0
$ pyenv install 3.10.0
$ pyenv install 3.9.0
$ pyenv install 3.8.0
$ pyenv local 3.11.0 3.10.0 3.9.0 3.8.0
$ python --version
Python 3.8.0

Editable distribution

For development it is preferable to install manifest-tool package in "editable mode" (a.k.a "developer mode") by:

$ pip install -editable .

dev_init.sh

A helper script for bootstrapping development environment.

Usage:

$ source dev_init.sh
$ manifest-dev-tool --version
Manifest-Tool version 2.0

dev_init.bat

Same as dev_init.sh but for Windows

pytest

  • execute pytest command to verify no regression was introduced. pytest will also generate htmlcov/index.html that can be opened in a browser for showing test coverage statistics.

  • Example of running only one test:

    pytest tests/dev_tool/test_dev_update.py -o log_cli=true -k test_cli_update_happy_day[fw_file-True-action0]
    

tox

tox is an automation tool. Details can be found here: https://tox.readthedocs.io/en/latest/
tox helps to automate testing on different python versions.

Execute: tox command to test all supported Python environments.
Execute tox -e py38 to test only the python3.8 environment.

wheel creation

$ pyenv local 3.9.0
$ python setup.py bdist_wheel
$ pyenv local 3.8.9
$ python setup.py bdist_wheel

do the same on each platform (Windows, Linux, macOS) per Python interpreter.

The resulting wheel packages will be found under dist directory.

Note: all the packages are created automatically by running tox command.

sdist

Source distribution - can be done once as it is platform and Python version agnostic.

python setup.py sdist

the resulting archive (tar.gz) will be found under dist directory

Note: all the packages are created automatically by running tox command.

manylinux wheels

PyPi does not allow uploading platform-specific wheels. More details can be found here: PEP-0513.

To create manylinux wheel files execute the following script: ./build_manylinux_wheels.sh.

Note: this will require the docker command. Make sure you have installed docker.

Dependent packages versions

Dependent package versions should be tested with both lower and higher bounds. Tox tests with new virtual env where all the latest versions will be installed.
When issuing a new release:

  • test lower bound versions - if they are still applicable to latest changes.
  • bump the higher bound versions and test against them.

We must freeze upper-bound versions to the version which were tested at the release creation time.

Publish release

  1. In the manifest-tool-internal repository:
    1. Update requirements.txt to dependencies latest version.
    2. Bump the package version and tar name in tox.ini.
    3. Create a PR with the above changes and merge it to the master branch.
    4. Check that the PR-checker workflow passes on the master branch. It runs all the tox tests on all the OSes.
    5. Check that the create-Linux-wheels workflow passes on the master branch. It builds the Linux wheels.
  2. Compare manually between the manifest-tool-internal repo and the manifest-tool repo. Copy the required changes to the manifest-tool repo.
  3. In the manifest-tool repository:
    1. Create a PR with the changes to master. Merge it after successful PR checks and approval.
    2. Check that the PR-checker workflow passes on the master branch. It runs all the tox tests on all the OSes.
    3. Check that the create-Linux-wheels workflow passes on the master branch. It builds the Linux wheels and uploads them as an artifact.
    4. Download the wheels-manylinux.zip and wheels-tar-gz.zip artifacts to your local machine from the create-Linux-wheels workflow.
    5. Extract both zip files to a <dist-folder> folder.
    6. Install twine: pip install twine.
    7. Publish to https://test.pypi.org and check:
      twine upload -r testpypi <dist-folder>/*
      
    8. Publish to https://pypi.org:
      twine upload <dist-folder>/*
      
  4. Yank older pre-releases in https://pypi.org/manage/project/manifest-tool/releases/
  5. Close fixed issues
  6. Create a tag and a release in manifest-tool-internal and manifest-tool repos.