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 |
|
input |
${gitVersionStamp} file |
output |
|
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
version |
py.project – Python project file generation
This task generates the ${pythonProjectFile} project file.
Property |
Value/description |
|---|---|
builder |
|
input |
|
output |
${pythonProjectFile} file |
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
fragment_files |
|
items |
|
plugin_name |
“nmk-python” |
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 |
|
input |
|
output |
|
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
src_folders |
|
command |
format |
py.analysis – Python code analysis
This task calls ruff check command to analyze python code of this project.
Property |
Value/description |
|---|---|
builder |
|
input |
|
output |
|
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
src_folders |
|
command |
check |
py.editable – Python project install in editable mode
This task installs the project in editable mode in the venv.
Property |
Value/description |
|---|---|
builder |
|
input |
${pythonProjectFile} file |
output |
|
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
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 |
|
if |
${pythonTestSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
pytest_args |
Package tasks
All tasks in this chapter are dependencies of the base package task.
py.build – Build Python wheel
This task use the python build module to handle the wheel build.
Property |
Value/description |
|---|---|
builder |
|
input |
|
output |
${pythonWheel} file |
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
project_file |
|
version_file |
|
source_dirs |
|
artifacts_dir |
|
build_dir |
|
extra_resources |
Install tasks
All tasks in this chapter are dependencies of the base install task.
py.install – Install Python wheel
This task installs the built python wheel in the project venv.
Property |
Value/description |
|---|---|
builder |
|
input |
${pythonWheel} file |
output |
|
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
name |
|
pip_args |
“–force-reinstall –no-deps ${venvPipArgs}” |
to_remove |
The builder also removes the ${pythonEditableStamp} stamp file, to force installing the project in editable mode again on the next build.
Clean tasks
All tasks in this chapter are dependencies of the base clean task.
py.uninstall – Uninstall Python wheel
This task uninstalls the built python wheel from the project venv.
Property |
Value/description |
|---|---|
builder |
|
if |
${pythonSrcFiles} are found |
The builder is called with the following parameters mapping:
Name |
Value |
|---|---|
name |