nmk_python.build¶
Python package build module
Classes¶
Python package builder |
|
Python module name resolver |
|
Install built wheel in venv |
|
Uninstall current project wheel from venv |
|
Install python project in editable mode |
|
Python optional deps resolver |
|
Python development deps resolver |
|
Python archive dependencies resolver |
|
Generate python dependencies metadata file |
|
Python ignored lockfile resolver |
Module Contents¶
- class nmk_python.build.PackageBuilder(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.builder.NmkTaskBuilderPython package builder
- build(project_file: str, version_file: str, source_dirs: list[str], artifacts_dir: str, build_dir: str, extra_resources: dict[str, str])¶
Delegate to python build module, from a temporary build folder
- Parameters:
project_file – path to python project file
version_file – path to generated version file
source_dirs – list of source folders for this wheel
artifacts_dir – output folder for built wheel
build_dir – temporary build folder
extra_resources – dictionary of extra resources mapping (original path -> target path)
- class nmk_python.build.PythonModuleResolver(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.resolver.NmkStrConfigResolverPython module name resolver
- get_value(name: str) str¶
Return module name from package (i.e. wheel) name
- class nmk_python.build.Installer(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.builder.NmkTaskBuilderInstall built wheel in venv
- build(name: str, wheel: str, pip_args: list[str] | None = None, to_remove: str = '')¶
Install wheel in venv
- Parameters:
name – wheel name to be installed
wheel – wheel path to be installed
pip_args – pip command line arguments; deprecated, not used anymore
to_remove – stamp file to be removed
- class nmk_python.build.Uninstaller(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.builder.NmkTaskBuilderUninstall current project wheel from venv
- build(name: str, local_deps: list[str] | None = None)¶
Uninstall wheel from venv
Note that task won’t fail if the wheel is not installed
- Parameters:
name – wheel name to be uninstalled
local_deps – list of workspace local dependencies patterns, used to find additional wheels to uninstall
- class nmk_python.build.EditableBuilder(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.builder.NmkTaskBuilderInstall python project in editable mode
- build(pip_args: list[str] | None = None)¶
Install project in venv as editable package
- Parameters:
pip_args – pip command line arguments; deprecated, not used anymore
- class nmk_python.build.PythonOptionalDepsResolver(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.resolver.NmkListConfigResolverPython optional deps resolver
- get_value(name: str, groups: dict[str, list[str]]) list[str]¶
Turn dependency options deps dict into a merged list of dependencies
- class nmk_python.build.PythonDevDepsResolver(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.resolver.NmkListConfigResolverPython development deps resolver
- get_value(name: str, package_deps: list[str], all_deps: list[str]) list[str]¶
Return development dependencies (all deps minus package deps)
- class nmk_python.build.PythonArchiveDepsResolver(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.resolver.NmkDictConfigResolverPython archive dependencies resolver
- get_value(name: str, archives: list[str]) dict[str, str]¶
Return archive dependencies mapping (python package name -> wheel path)
- class nmk_python.build.DepsMetadataBuilder(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.builder.NmkTaskBuilderGenerate python dependencies metadata file
- build(root_name: str, local_deps: list[str])¶
Generate python dependencies metadata file
- Parameters:
root_name – name of the root package
local_deps – list of workspace local dependencies patterns
- class nmk_python.build.PythonIgnoredLockfileResolver(model: nmk.model.model.NmkModel)¶
Bases:
nmk.model.resolver.NmkListConfigResolverPython ignored lockfile resolver
- get_value(name: str) list[str]¶
Return the list of lockfiles to be ignored, depending on the env backend and if the project is locked or not