wazuh-virtual-machines/pyproject.toml
2025-11-06 10:52:59 +01:00

189 lines
6.8 KiB
TOML

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "wazuh-virtual-machines"
dynamic = ["version"]
dependencies = [
"pydantic",
"paramiko",
"pyyaml",
"jinja2",
]
requires-python = ">= 3.12"
description = "Wazuh - Virtual Machines (OVA and AMI)"
license = {file = "LICENSE"}
[tool.hatch.version]
path = "VERSION.json"
pattern = '"version": "(?P<version>[^"]+)"'
[tool.hatch.build.targets.wheel]
packages = ["."]
[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["."]
[tool.ruff]
line-length = 120
indent-width = 4
exclude = ["ova/"]
[project.urls]
Homepage = "https://wazuh.com/"
Documentation = "https://documentation.wazuh.com/current/index.html"
Repository = "https://github.com/wazuh/wazuh-virtual-machines"
[tool.ruff.lint]
select = [
"E", # pycodestyle
"F", # Pyflakes
"UP", # pyupgrade
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
]
ignore = ["E501"]
[tool.ruff.lint.extend-per-file-ignores]
"__init__.py" = ["F401"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true
[tool.coverage.run]
omit = [
"*/tests/*",
"*/__init__.py",
"*/wazuh_local_ova/*",
]
[tool.hatch.envs.dev]
description = """
Enviroment to be used for testing all virtual-machines modules
"""
dependencies = [
"pytest~=8.0",
"pytest-cov~=6.0",
"pytest-xdist",
"ruff",
"requests",
]
[tool.hatch.envs.dev-provisioner]
description = """
Enviroment to be used for testing and developing the provisioner module
"""
template = "dev"
[tool.hatch.envs.dev-core-configurer]
description = """
Enviroment to be used for testing and developing the core configurer module
"""
template = "dev"
[tool.hatch.envs.dev-ami-configurer]
description = """
Enviroment to be used for testing and developing the ami configurer module
"""
template = "dev"
[tool.hatch.envs.dev-ova-pre-configurer]
description = """
Enviroment to be used for OVA PreConfigurer execution testing
"""
template = "dev"
[tool.hatch.envs.dev-ova-post-configurer]
description = """
Enviroment to be used for OVA PostConfigurer execution testing
"""
template = "dev"
[tool.hatch.envs.dev-local-ova]
description = """
Enviroment to be used for local OVA build execution testing
"""
template = "dev"
extra-dependencies = [
"typer",
]
[tool.hatch.envs.dev-ova-dependencies]
description = """
Enviroment to be used for OVA PostConfigurer execution testing
"""
template = "dev"
[tool.hatch.envs.dev.scripts]
test-cov = "FORCE_COLOR=1 pytest -n 4 --cov=. --cov-report term-missing:skip-covered tests/ --cov-report=xml"
ruff-format = "ruff format ."
ruff-format-check = "ruff format --diff --check ."
ruff-lint-check = "ruff check --diff --unsafe-fixes ."
ruff-lint = "ruff check --fix --unsafe-fixes ."
run = "python -m main {args:}"
fix = ["ruff-format", "ruff-lint"] # The aim of this is to fix the code before pushing it to the repository. useful for local executions.
validate = [ # The aim of this is to validate the code before pushing it to the repository. Useful for when running workflows.
"- ruff-format-check",
"- ruff-lint-check",
"- test-cov",
]
[tool.hatch.envs.dev-provisioner.scripts]
test-cov = "FORCE_COLOR=1 pytest -n 4 --cov=provisioner --cov-report term-missing:skip-covered tests/test_provisioner --cov-report=xml"
ruff-format = "ruff format provisioner tests/test_provisioner"
ruff-format-check = "ruff format --diff --check provisioner tests/test_provisioner"
ruff-lint-check = "ruff check --diff --unsafe-fixes provisioner tests/test_provisioner"
ruff-lint = "ruff check --fix --unsafe-fixes provisioner tests/test_provisioner"
run = "python -m main --execute provisioner {args:}"
# fix and validate are not defined here because they are inherited from the dev environment.
[tool.hatch.envs.dev-core-configurer.scripts]
test-cov = "FORCE_COLOR=1 pytest -n 4 --cov=configurer/core --cov-report term-missing:skip-covered tests/test_configurer/test_core --cov-report=xml"
ruff-format = "ruff format configurer/core tests/test_configurer/core"
ruff-format-check = "ruff format --diff --check configurer/core tests/test_configurer/core"
ruff-lint-check = "ruff check --diff --unsafe-fixes configurer/core tests/test_configurer/core"
ruff-lint = "ruff check --fix --unsafe-fixes configurer/core tests/test_configurer/core"
run = "python -m main --execute core-configurer {args:}"
# fix and validate are not defined here because they are inherited from the dev environment.
[tool.hatch.envs.dev-ami-configurer.scripts]
test-cov = "FORCE_COLOR=1 pytest -n 4 --cov=configurer/ami --cov-report term-missing:skip-covered tests/test_configurer/test_ami --cov-report=xml"
ruff-format = "ruff format configurer/ami tests/test_configurer/test_ami"
ruff-format-check = "ruff format --diff --check configurer/ami tests/test_configurer/test_ami"
ruff-lint-check = "ruff check --diff --unsafe-fixes configurer/ami tests/test_configurer/test_ami"
ruff-lint = "ruff check --fix --unsafe-fixes configurer/ami tests/test_configurer/test_ami"
run = "python -m main --execute all-ami {args:}"
# fix and validate are not defined here because they are inherited from the dev environment.
[tool.hatch.envs.dev-ova-pre-configurer.scripts]
test-cov = "FORCE_COLOR=1 pytest -n 4 --cov=configurer/ova/ova_pre_configurer --cov-report term-missing:skip-covered tests/test_configurer/test_ova/test_ova_pre_configurer --cov-report=xml"
ruff-format = "ruff format configurer/ova/ova_pre_configurer"
ruff-format-check = "ruff format --diff --check configurer/ova/ova_pre_configurer"
ruff-lint-check = "ruff check --diff --unsafe-fixes configurer/ova/ova_pre_configurer"
ruff-lint = "ruff check --fix --unsafe-fixes configurer/ova/ova_pre_configurer"
run = "python -m main --execute ova-pre-configurer {args:}"
[tool.hatch.envs.dev-ova-post-configurer.scripts]
test-cov = "FORCE_COLOR=1 pytest -n 4 --cov=configurer/ova/ova_post_configurer --cov-report term-missing:skip-covered tests/test_configurer/test_ova/test_ova_post_configurer --cov-report=xml"
ruff-format = "ruff format configurer/ova/ova_post_configurer"
ruff-format-check = "ruff format --diff --check configurer/ova/ova_post_configurer"
ruff-lint-check = "ruff check --diff --unsafe-fixes configurer/ova/ova_post_configurer"
ruff-lint = "ruff check --fix --unsafe-fixes configurer/ova/ova_post_configurer"
run = "python -m main --execute ova-post-configurer {args:}"
[tool.hatch.envs.dev-local-ova.scripts]
ruff-format = "ruff format wazuh_local_ova"
ruff-format-check = "ruff format --diff --check wazuh_local_ova"
ruff-lint-check = "ruff check --diff --unsafe-fixes wazuh_local_ova"
ruff-lint = "ruff check --fix --unsafe-fixes wazuh_local_ova"
run = "python -m wazuh_local_ova {args:}"
[tool.hatch.envs.dev-ova-dependencies.scripts]
install = "python3 -c 'from configurer.ova.ova_pre_configurer.install_dependencies import main; main()'"