Tasks

The nmk-python plugin defines the tasks described below.

Setup tasks

All tasks in this chapter are dependencies of the base setup task.

py.version – Python version stamping

This task creates/updates the ${pythonVersionStamp} stamp file, only when ${gitVersion} has changed. This allows incremental build depending on python version change (i.e. trigger rebuild if only version changed).

Property

Value/description

builder

nmk_python.version.PythonVersionRefresh

input

${gitVersionStamp} file

output

${pythonVersionStamp} file

if

${pythonSrcFiles} are found

The builder is called with the following parameters mapping:

Name

Value

version

${pythonVersion}

py.project – Python project file generation

This task generates the ${pythonProjectFile} project file.

Property

Value/description

builder

nmk_python.project.PythonProjectBuilder

input

${pythonProjectFileFragments} files

output

${pythonProjectFile} file

if

${pythonSrcFiles} are found

The builder is called with the following parameters mapping:

Name

Value

fragment_files

${pythonProjectFileFragments}

items

${pythonProjectFileItems}

Build tasks

All tasks in this chapter are dependencies of the base build task.

py.format – Python code format

This task calls ruff format command to format python code of this project.

Property

Value/description

builder

nmk_python.ruff.RuffBuilder

input

${pythonSrcFiles} + ${pythonProjectFile} files

output

${pythonRuffFormatStamp} file

if

${pythonSrcFiles} are found

The builder is called with the following parameters mapping:

Name

Value

src_folders

${pythonSrcFolders}

command

format

py.analysis – Python code analysis

This task calls ruff check command to analyze python code of this project.

Property

Value/description

builder

nmk_python.ruff.RuffBuilder

input

${pythonSrcFiles} + ${pythonProjectFile} files

output

${pythonRuffCheckStamp} file

if

${pythonSrcFiles} are found

The builder is called with the following parameters mapping:

Name

Value

src_folders

${pythonSrcFolders}

command

check

py.build – Build Python wheel

This task use the python build module to handle the wheel build.

Property

Value/description

builder

nmk_python.build.PackageBuilder

input

${pythonSrcFiles} + ${pythonProjectFile} files

output

${pythonWheel} file

if

${pythonSrcFiles} are found

The builder is called with the following parameters mapping:

Name

Value

project_file

${pythonProjectFile}

version_file

${pythonVersionStamp}

source_dirs

${pythonSrcFolders}

artifacts_dir

${pythonArtifacts}

build_dir

${pythonBuildDir}

extra_resources

${pythonExtraResources}

py.install – Install Python wheel

This task installs the built python wheel in the project venv.

Property

Value/description

builder

nmk_python.build.Installer

input

${pythonWheel} file

output

${venvState}

if

${pythonSrcFiles} are found

The builder is called with the following parameters mapping:

Name

Value

name

${pythonPackage}

pip_args

“–force-reinstall –no-deps ${venvPipArgs}”

Tests tasks

All tasks in this chapter are dependencies of the base tests task.

py.tests – Run Python tests

This task calls pytest command to execute python tests.

Property

Value/description

builder

nmk_python.tests.PytestBuilder

if

${pythonTestSrcFiles} are found

The builder is called with the following parameters mapping:

Name

Value

pytest_args

${pytestExtraArgs}