python.mk
python-format
Synopsis: make python-format
Hooks: python-pre-format, python-post-format
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
PYTHON_LINT_TARGET |
<file or directory path to Python code> - default ‘src/ tests/’ |
PYTHON_LINE_LENGTH |
<line length> - defaults to 79, set it once and all linters will use this value |
PYTHON_SWITCHES_FOR_ISORT |
<additional switches to pass to isort> |
PYTHON_SWITCHES_FOR_BLACK |
<additional switch to pass to black> |
Reformat project Python code in the given directories/files using black and isort.
python-lint
Synopsis: make python-lint
Hooks: python-pre-lint, python-post-lint
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
PYTHON_LINT_TARGET |
<file or directory path to Python code> - default ‘src/ tests/’ |
PYTHON_LINE_LENGTH |
<line length> - defaults to 79, set it once and all linters will use this value |
PYTHON_SWITCHES_FOR_ISORT |
<additional switches to pass to isort> |
PYTHON_SWITCHES_FOR_BLACK |
<additional switch to pass to black> |
PYTHON_SWITCHES_FOR_FLAKE8 |
<additional switch to pass to flake8> |
PYTHON_SWITCHES_FOR_PYLINT |
<additional switch to pass to pylint> |
Lint check project Python code in the given directories/files using black, isort, flake8 and pylint.
python-build
Synopsis: make python-build
Hooks: python-pre-build, python-post-build
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
PYTHON_BUILD_TYPE |
[tag_setup|non_tag_setup|non_tag_pyproject|tag_pyproject] |
PYTHON_SWITCHES_FOR_BUILD |
<options for -m build> - defaults to: –sdist –wheel |
Build the nominated package type for project Python code, and decorate the package with the SKAO metadata required for publishing to the Central Artefact Repository. Types:. tag_setup: python3 setup.py sdist bdist_wheel non_tag_setup: python3 setup.py egg_info -b+dev[.c``${CI_COMMIT_SHORT_SHA}``] sdist bdist_wheel non_tag_pyproject: pyproject-build (or python3 -m build) (pyproject.toml package version set to +dev[.c``${CI_COMMIT_SHORT_SHA}``]) tag_pyproject: pyproject-build (or python3 -m build)
python-test
Synopsis: make python-test
Hooks: python-pre-test, python-post-test
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
PYTHON_TEST_FILE |
<paths and/or files for testing> - defaults to tests/unit/ |
PYTHON_VARS_BEFORE_PYTEST |
<environment variables defined before pytest in run> - default empty |
PYTHON_VARS_AFTER_PYTEST |
<additional switches passed to pytest> - default empty |
Run pytest against the tests defined in ./tests. By default, this will pickup any pytest specific configuration set in pytest.ini, setup.cfg etc. located in ./tests
python-publish
Synopsis: make python-publish
Hooks: python-pre-publish, python-post-publish
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
PYTHON_PUBLISH_USERNAME |
<twine user> - default empty |
PYTHON_PUBLISH_PASSWORD |
<twine user password> - default empty |
PYTHON_PUBLISH_URL |
<repository URL> - default empty |
Run twine to publish artefacts built in the project dist/ directory.
python-exportlock
Synopsis: make python-exportlock
Hooks: none
Run poetry export to generate requirements.txt and requirements-dev.txt based on pyproject.toml.
python-scan
Synopsis: make python-scan
Hooks: python-pre-scan, python-post-scan
Variables:
Variable |
Description |
|---|---|
PYTHON_BUILD_TYPE |
[tag_setup|non_tag_setup|non_tag_pyproject|tag_pyproject] |
Scan python packages using Gemnasium.
notebook-format
Synopsis: make notebook-format
Hooks: notebook-pre-format, notebook-post-format
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
NOTEBOOK_LINT_TARGET |
<file or directory path to Python code> - defaults to . (all notebooks in the repo) |
PYTHON_LINE_LENGTH |
<line length> - defaults to 79, set it once and all linters will use this value |
PYTHON_SWITCHES_FOR_ISORT |
<additional switches to pass to isort> |
PYTHON_SWITCHES_FOR_BLACK |
<additional switch to pass to black> |
NOTEBOOK_SWITCHES_FOR_ISORT |
<additional switch to pass to isort for notebooks> |
NOTEBOOK_SWITCHES_FOR_BLACK |
<additional switch to pass to black for notebooks> |
Reformat Jupyter notebooks in the given directories/files using nbQa, black and isort.
notebook-lint
Synopsis: make notebook-lint
Hooks: notebook-pre-lint, notebook-post-lint
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
NOTEBOOK_LINT_TARGET |
<file or directory path to notebooks> - defaults to . (all notebooks in the repo) |
PYTHON_LINE_LENGTH |
<line length> - defaults to 79, set it once and all linters will use this value |
PYTHON_SWITCHES_FOR_ISORT |
<additional switches to pass to isort> |
PYTHON_SWITCHES_FOR_BLACK |
<additional switch to pass to black> |
PYTHON_SWITCHES_FOR_FLAKE8 |
<additional switch to pass to flake8 for all python code> |
PYTHON_SWITCHES_FOR_PYLINT |
<additional switch to pass to pylint for all python code> |
NOTEBOOK_SWITCHES_FOR_ISORT |
<additional switch to pass to isort for notebooks> |
NOTEBOOK_SWITCHES_FOR_BLACK |
<additional switch to pass to black for notebooks> |
NOTEBOOK_SWITCHES_FOR_FLAKE8 |
<additional switch to pass to flake8 for notebooks> |
NOTEBOOK_SWITCHES_FOR_PYLINT |
<additional switch to pass to pylint for notebooks> |
Lint check Jupyter notebooks in the given directories/files using nbQa, black, isort, flake8 and pylint.
notebook-test
Synopsis: make notebook-test
Hooks: notebook-pre-test, notebook-post-test
Variables:
Variable |
Description |
|---|---|
PYTHON_RUNNER |
<python executor> - defaults to empty, but could pass something like python -m |
PYTHON_VARS_BEFORE_PYTEST |
<environment variables defined before pytest in run> - default empty |
Run pytest –nbmake against the notebooks defined in PYTHON_TEST_FOLDER_NBMAKE. By default, this will pickup any jupyter notebooks