Build and Container

The simplest way to get pymzqc is through PyPi

If you need to build it your self or do not want to use pip (or can), there are alternatives:

Container

One alternative is to use a container.

Container use

This folder contains various container build instruction files.

  • The DevDockerfile builds a container from github sources and installs some helpful modules and libraries before that.

  • The Dockerfile builds a container from a wheel build. This is used for the official container built.

Note: there are other Dockerfiles for specific purposes. For an onlinevalidator container at accessories/onlinevalidator/Dockerfile and a vscode remote container at .devcontainer/Dockerfile.

Repository

Our main container registry is at quay.io. Its builds are made by github actions (for releases) and pushed to quay.io mwalzer/pymzqc reporitory. Another container repository for the mzqc-validator is at mwalzer/mzqc-validator; see more the accessories documentation for the onlinevalidator.

Container Engine Flavours

Thanks to the intercompatibility of many container systems, we can use different container engines to run pymzqc. This section is meant as a cheat-sheet for quick switching.

Podman

Note: if you don’t specify a name for a container, it will be assigned an autogenerated name (e.g. friendly_cannon). It also means you will create a different container every time you use podman run and keep it if you don’t also specify the --rm option.

Get an image: podman pull quay.io/pypa/manylinux2010_x86_64:latest

Create, run and enter a container named test based an image podman run -ti --name test docker.io/library/python:3.6.9-slim-buster bash Will give you an interactive shell. Issue exit to exit and stop the container. Using podman ps you can check that there is not a running container named manytest. With podman ps -a you can see that the container is here.

To start again and enter inside the container podman start -ia manytest Note that start has many other arguments like --name, --hostname, --network, --mount that might be of interest. See podman docs.

To delete the container podman rm manytest

Build

Another alternative is to build a wheel yourself. This is the release documentation for the project.

How to build and release

(aka pre-filght tests for a release)

Manual build and release instruction

First, for a given release (candidate), install a local version via pip git+ and get the sources for test and build, too:

    cd /tmp
    python3 -m venv pipgit && source pipgit/bin/activate
    pip install pip --upgrade
    pip install pytest build
    pip install -U git+https://github.com/MS-Quality-hub/pymzqc.git@v1.0.0rc1#egg=pymzqc
    git clone --single-branch --branch=v1.0.0rc1 --depth=1 https://github.com/MS-Quality-hub/pymzqc.git

Re-activate your venv to let pytest reset to current venv and test installation:

    deactivate && source pipgit/bin/activate
    cd /tmp/pymzqc
    pytest

Then, provide container-based builds an existing dist folder setup like so, and build:

    cd /tmp/pymzqc
    mkdir -p dist/mzqc
    python3 -m build --sdist
    python3 -m build --wheel

The build results will be at /tmp/pymzqc/dist. We’ll need both as release artifacts. Now install the wheel in a new venv and test the wheel:

    cd /tmp/pymzqc
    deactivate
    python3 -m venv pipwhl && source pipwhl/bin/activate
    pip install pip --upgrade
    pip install pytest wheel dist/pymzqc-1.0.0rc1-py3-none-any.whl
    deactivate && source pipwhl/bin/activate
    cd /tmp/pymzqc
    pytest

Also test wheel installation in legacy mode (w/o wheel module installed):

    cd /tmp/pymzqc
    deactivate
    python3 -m venv pipwhl && source pipwhl/bin/activate
    pip install pip --upgrade
    pip install pytest dist/pymzqc-1.0.0rc1-py3-none-any.whl
    deactivate && source pipwhl/bin/activate
    cd /tmp/pymzqc
    pytest

If all tests were successful, upload to test.pypi.org with twine:

    twine upload --repository-url https://test.pypi.org/legacy/ dist/*

And finally test pypi installation:

    cd /tmp/pymzqc
    deactivate
    python3 -m venv pippypi && source pippypi/bin/activate
    pip install pip --upgrade
    pip install pytest
    python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pymzqc==1.0.0rc1
    deactivate && source pippypi/bin/activate
    cd /tmp/pymzqc
    pytest

Since the index-url probably won’t have all dependency packages, install will fail unless you set extra-index-url.

Check the release label isn’t already in use in pypi.org/pymzqc (otherwise correct,repeat build & test). Now upload to pypi.org, fingers crossed.