diff --git a/charmcraft/templates/init-django-framework-26.04/pyproject.toml.j2 b/charmcraft/templates/init-django-framework-26.04/pyproject.toml.j2 index 85441d1bd..a3c32be91 100644 --- a/charmcraft/templates/init-django-framework-26.04/pyproject.toml.j2 +++ b/charmcraft/templates/init-django-framework-26.04/pyproject.toml.j2 @@ -25,6 +25,25 @@ charmlibs-pydeps = [ "cosl==1.9.1", "pydantic==2.13.3", ] +# Dependencies of linting and static type checks +lint = [ + "ruff", + "codespell", + "pyright", +] +# Dependencies of unit tests +unit = [ + "coverage[toml]", + "ops[testing]", + "pytest", +] +# Dependencies of integration tests +integration = [ + "jubilant>=1.8,<2", + "pytest", + "pytest-jubilant>=2.0.1,<3", + "PyYAML", +] # Testing tools configuration diff --git a/charmcraft/templates/init-django-framework-26.04/src/charm.py.j2 b/charmcraft/templates/init-django-framework-26.04/src/charm.py.j2 index 359b47307..4a994d611 100755 --- a/charmcraft/templates/init-django-framework-26.04/src/charm.py.j2 +++ b/charmcraft/templates/init-django-framework-26.04/src/charm.py.j2 @@ -8,7 +8,6 @@ import logging import typing import ops - import paas_charm.django logger = logging.getLogger(__name__) diff --git a/charmcraft/templates/init-django-framework-26.04/tox.ini.j2 b/charmcraft/templates/init-django-framework-26.04/tox.ini.j2 index bd15d819c..17bbc92fb 100644 --- a/charmcraft/templates/init-django-framework-26.04/tox.ini.j2 +++ b/charmcraft/templates/init-django-framework-26.04/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] @@ -31,50 +31,46 @@ commands = ruff check --fix {[vars]all_path} [testenv:lint] -description = Check code against coding style standards -deps = - ruff - codespell +description = Check code against coding style standards, and static checks +runner = uv-venv-lock-runner +dependency_groups = + lint + unit + integration commands = codespell {tox_root} ruff check {[vars]all_path} ruff format --check --diff {[vars]all_path} + pyright {posargs} [testenv:unit] description = Run unit tests -deps = - pytest - coverage[toml] - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + unit commands = - coverage run --source={[vars]src_path} \ - -m pytest \ - --tb native \ - -v \ - -s \ - {posargs} \ - {[vars]tests_path}/unit + coverage run --source={[vars]src_path} -m pytest \ + -v \ + -s \ + --tb native \ + {[vars]tests_path}/unit \ + {posargs} coverage report -[testenv:static] -description = Run static type checks -deps = - pyright - -r {tox_root}/requirements.txt -commands = - pyright {posargs} - [testenv:integration] description = Run integration tests -deps = - pytest - juju - pytest-operator - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + integration +pass_env = + # The integration tests don't pack the charm. If CHARM_PATH is set, the tests deploy the + # specified .charm file. Otherwise, the tests look for a .charm file in the project dir. + CHARM_PATH commands = - pytest -v \ - -s \ - --tb native \ - --log-cli-level=INFO \ - {posargs} \ - {[vars]tests_path}/integration + pytest \ + -v \ + -s \ + --tb native \ + --log-cli-level=INFO \ + {[vars]tests_path}/integration \ + {posargs} diff --git a/charmcraft/templates/init-django-framework/tox.ini.j2 b/charmcraft/templates/init-django-framework/tox.ini.j2 index bd15d819c..bacc920a4 100644 --- a/charmcraft/templates/init-django-framework/tox.ini.j2 +++ b/charmcraft/templates/init-django-framework/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] diff --git a/charmcraft/templates/init-expressjs-framework-26.04/pyproject.toml.j2 b/charmcraft/templates/init-expressjs-framework-26.04/pyproject.toml.j2 index 85441d1bd..a3c32be91 100644 --- a/charmcraft/templates/init-expressjs-framework-26.04/pyproject.toml.j2 +++ b/charmcraft/templates/init-expressjs-framework-26.04/pyproject.toml.j2 @@ -25,6 +25,25 @@ charmlibs-pydeps = [ "cosl==1.9.1", "pydantic==2.13.3", ] +# Dependencies of linting and static type checks +lint = [ + "ruff", + "codespell", + "pyright", +] +# Dependencies of unit tests +unit = [ + "coverage[toml]", + "ops[testing]", + "pytest", +] +# Dependencies of integration tests +integration = [ + "jubilant>=1.8,<2", + "pytest", + "pytest-jubilant>=2.0.1,<3", + "PyYAML", +] # Testing tools configuration diff --git a/charmcraft/templates/init-expressjs-framework-26.04/src/charm.py.j2 b/charmcraft/templates/init-expressjs-framework-26.04/src/charm.py.j2 index 798b68376..c64fe9ee8 100755 --- a/charmcraft/templates/init-expressjs-framework-26.04/src/charm.py.j2 +++ b/charmcraft/templates/init-expressjs-framework-26.04/src/charm.py.j2 @@ -8,7 +8,6 @@ import logging import typing import ops - import paas_charm.expressjs logger = logging.getLogger(__name__) diff --git a/charmcraft/templates/init-expressjs-framework-26.04/tox.ini.j2 b/charmcraft/templates/init-expressjs-framework-26.04/tox.ini.j2 index bd15d819c..17bbc92fb 100644 --- a/charmcraft/templates/init-expressjs-framework-26.04/tox.ini.j2 +++ b/charmcraft/templates/init-expressjs-framework-26.04/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] @@ -31,50 +31,46 @@ commands = ruff check --fix {[vars]all_path} [testenv:lint] -description = Check code against coding style standards -deps = - ruff - codespell +description = Check code against coding style standards, and static checks +runner = uv-venv-lock-runner +dependency_groups = + lint + unit + integration commands = codespell {tox_root} ruff check {[vars]all_path} ruff format --check --diff {[vars]all_path} + pyright {posargs} [testenv:unit] description = Run unit tests -deps = - pytest - coverage[toml] - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + unit commands = - coverage run --source={[vars]src_path} \ - -m pytest \ - --tb native \ - -v \ - -s \ - {posargs} \ - {[vars]tests_path}/unit + coverage run --source={[vars]src_path} -m pytest \ + -v \ + -s \ + --tb native \ + {[vars]tests_path}/unit \ + {posargs} coverage report -[testenv:static] -description = Run static type checks -deps = - pyright - -r {tox_root}/requirements.txt -commands = - pyright {posargs} - [testenv:integration] description = Run integration tests -deps = - pytest - juju - pytest-operator - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + integration +pass_env = + # The integration tests don't pack the charm. If CHARM_PATH is set, the tests deploy the + # specified .charm file. Otherwise, the tests look for a .charm file in the project dir. + CHARM_PATH commands = - pytest -v \ - -s \ - --tb native \ - --log-cli-level=INFO \ - {posargs} \ - {[vars]tests_path}/integration + pytest \ + -v \ + -s \ + --tb native \ + --log-cli-level=INFO \ + {[vars]tests_path}/integration \ + {posargs} diff --git a/charmcraft/templates/init-expressjs-framework/tox.ini.j2 b/charmcraft/templates/init-expressjs-framework/tox.ini.j2 index bd15d819c..bacc920a4 100644 --- a/charmcraft/templates/init-expressjs-framework/tox.ini.j2 +++ b/charmcraft/templates/init-expressjs-framework/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] diff --git a/charmcraft/templates/init-fastapi-framework-26.04/pyproject.toml.j2 b/charmcraft/templates/init-fastapi-framework-26.04/pyproject.toml.j2 index 85441d1bd..a3c32be91 100644 --- a/charmcraft/templates/init-fastapi-framework-26.04/pyproject.toml.j2 +++ b/charmcraft/templates/init-fastapi-framework-26.04/pyproject.toml.j2 @@ -25,6 +25,25 @@ charmlibs-pydeps = [ "cosl==1.9.1", "pydantic==2.13.3", ] +# Dependencies of linting and static type checks +lint = [ + "ruff", + "codespell", + "pyright", +] +# Dependencies of unit tests +unit = [ + "coverage[toml]", + "ops[testing]", + "pytest", +] +# Dependencies of integration tests +integration = [ + "jubilant>=1.8,<2", + "pytest", + "pytest-jubilant>=2.0.1,<3", + "PyYAML", +] # Testing tools configuration diff --git a/charmcraft/templates/init-fastapi-framework-26.04/src/charm.py.j2 b/charmcraft/templates/init-fastapi-framework-26.04/src/charm.py.j2 index 84f9fa77a..59042cc4a 100755 --- a/charmcraft/templates/init-fastapi-framework-26.04/src/charm.py.j2 +++ b/charmcraft/templates/init-fastapi-framework-26.04/src/charm.py.j2 @@ -8,7 +8,6 @@ import logging import typing import ops - import paas_charm.fastapi logger = logging.getLogger(__name__) diff --git a/charmcraft/templates/init-fastapi-framework-26.04/tox.ini.j2 b/charmcraft/templates/init-fastapi-framework-26.04/tox.ini.j2 index bd15d819c..17bbc92fb 100644 --- a/charmcraft/templates/init-fastapi-framework-26.04/tox.ini.j2 +++ b/charmcraft/templates/init-fastapi-framework-26.04/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] @@ -31,50 +31,46 @@ commands = ruff check --fix {[vars]all_path} [testenv:lint] -description = Check code against coding style standards -deps = - ruff - codespell +description = Check code against coding style standards, and static checks +runner = uv-venv-lock-runner +dependency_groups = + lint + unit + integration commands = codespell {tox_root} ruff check {[vars]all_path} ruff format --check --diff {[vars]all_path} + pyright {posargs} [testenv:unit] description = Run unit tests -deps = - pytest - coverage[toml] - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + unit commands = - coverage run --source={[vars]src_path} \ - -m pytest \ - --tb native \ - -v \ - -s \ - {posargs} \ - {[vars]tests_path}/unit + coverage run --source={[vars]src_path} -m pytest \ + -v \ + -s \ + --tb native \ + {[vars]tests_path}/unit \ + {posargs} coverage report -[testenv:static] -description = Run static type checks -deps = - pyright - -r {tox_root}/requirements.txt -commands = - pyright {posargs} - [testenv:integration] description = Run integration tests -deps = - pytest - juju - pytest-operator - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + integration +pass_env = + # The integration tests don't pack the charm. If CHARM_PATH is set, the tests deploy the + # specified .charm file. Otherwise, the tests look for a .charm file in the project dir. + CHARM_PATH commands = - pytest -v \ - -s \ - --tb native \ - --log-cli-level=INFO \ - {posargs} \ - {[vars]tests_path}/integration + pytest \ + -v \ + -s \ + --tb native \ + --log-cli-level=INFO \ + {[vars]tests_path}/integration \ + {posargs} diff --git a/charmcraft/templates/init-fastapi-framework/tox.ini.j2 b/charmcraft/templates/init-fastapi-framework/tox.ini.j2 index bd15d819c..bacc920a4 100644 --- a/charmcraft/templates/init-fastapi-framework/tox.ini.j2 +++ b/charmcraft/templates/init-fastapi-framework/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] diff --git a/charmcraft/templates/init-flask-framework-26.04/pyproject.toml.j2 b/charmcraft/templates/init-flask-framework-26.04/pyproject.toml.j2 index 85441d1bd..a3c32be91 100644 --- a/charmcraft/templates/init-flask-framework-26.04/pyproject.toml.j2 +++ b/charmcraft/templates/init-flask-framework-26.04/pyproject.toml.j2 @@ -25,6 +25,25 @@ charmlibs-pydeps = [ "cosl==1.9.1", "pydantic==2.13.3", ] +# Dependencies of linting and static type checks +lint = [ + "ruff", + "codespell", + "pyright", +] +# Dependencies of unit tests +unit = [ + "coverage[toml]", + "ops[testing]", + "pytest", +] +# Dependencies of integration tests +integration = [ + "jubilant>=1.8,<2", + "pytest", + "pytest-jubilant>=2.0.1,<3", + "PyYAML", +] # Testing tools configuration diff --git a/charmcraft/templates/init-flask-framework-26.04/src/charm.py.j2 b/charmcraft/templates/init-flask-framework-26.04/src/charm.py.j2 index 94cb3f33f..76f7e7d62 100755 --- a/charmcraft/templates/init-flask-framework-26.04/src/charm.py.j2 +++ b/charmcraft/templates/init-flask-framework-26.04/src/charm.py.j2 @@ -8,7 +8,6 @@ import logging import typing import ops - import paas_charm.flask logger = logging.getLogger(__name__) diff --git a/charmcraft/templates/init-flask-framework-26.04/tox.ini.j2 b/charmcraft/templates/init-flask-framework-26.04/tox.ini.j2 index bd15d819c..17bbc92fb 100644 --- a/charmcraft/templates/init-flask-framework-26.04/tox.ini.j2 +++ b/charmcraft/templates/init-flask-framework-26.04/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] @@ -31,50 +31,46 @@ commands = ruff check --fix {[vars]all_path} [testenv:lint] -description = Check code against coding style standards -deps = - ruff - codespell +description = Check code against coding style standards, and static checks +runner = uv-venv-lock-runner +dependency_groups = + lint + unit + integration commands = codespell {tox_root} ruff check {[vars]all_path} ruff format --check --diff {[vars]all_path} + pyright {posargs} [testenv:unit] description = Run unit tests -deps = - pytest - coverage[toml] - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + unit commands = - coverage run --source={[vars]src_path} \ - -m pytest \ - --tb native \ - -v \ - -s \ - {posargs} \ - {[vars]tests_path}/unit + coverage run --source={[vars]src_path} -m pytest \ + -v \ + -s \ + --tb native \ + {[vars]tests_path}/unit \ + {posargs} coverage report -[testenv:static] -description = Run static type checks -deps = - pyright - -r {tox_root}/requirements.txt -commands = - pyright {posargs} - [testenv:integration] description = Run integration tests -deps = - pytest - juju - pytest-operator - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + integration +pass_env = + # The integration tests don't pack the charm. If CHARM_PATH is set, the tests deploy the + # specified .charm file. Otherwise, the tests look for a .charm file in the project dir. + CHARM_PATH commands = - pytest -v \ - -s \ - --tb native \ - --log-cli-level=INFO \ - {posargs} \ - {[vars]tests_path}/integration + pytest \ + -v \ + -s \ + --tb native \ + --log-cli-level=INFO \ + {[vars]tests_path}/integration \ + {posargs} diff --git a/charmcraft/templates/init-flask-framework/tox.ini.j2 b/charmcraft/templates/init-flask-framework/tox.ini.j2 index bd15d819c..bacc920a4 100644 --- a/charmcraft/templates/init-flask-framework/tox.ini.j2 +++ b/charmcraft/templates/init-flask-framework/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] diff --git a/charmcraft/templates/init-go-framework-26.04/pyproject.toml.j2 b/charmcraft/templates/init-go-framework-26.04/pyproject.toml.j2 index 85441d1bd..a3c32be91 100644 --- a/charmcraft/templates/init-go-framework-26.04/pyproject.toml.j2 +++ b/charmcraft/templates/init-go-framework-26.04/pyproject.toml.j2 @@ -25,6 +25,25 @@ charmlibs-pydeps = [ "cosl==1.9.1", "pydantic==2.13.3", ] +# Dependencies of linting and static type checks +lint = [ + "ruff", + "codespell", + "pyright", +] +# Dependencies of unit tests +unit = [ + "coverage[toml]", + "ops[testing]", + "pytest", +] +# Dependencies of integration tests +integration = [ + "jubilant>=1.8,<2", + "pytest", + "pytest-jubilant>=2.0.1,<3", + "PyYAML", +] # Testing tools configuration diff --git a/charmcraft/templates/init-go-framework-26.04/src/charm.py.j2 b/charmcraft/templates/init-go-framework-26.04/src/charm.py.j2 index c32223b7e..969734515 100755 --- a/charmcraft/templates/init-go-framework-26.04/src/charm.py.j2 +++ b/charmcraft/templates/init-go-framework-26.04/src/charm.py.j2 @@ -8,7 +8,6 @@ import logging import typing import ops - import paas_charm.go logger = logging.getLogger(__name__) diff --git a/charmcraft/templates/init-go-framework-26.04/tox.ini.j2 b/charmcraft/templates/init-go-framework-26.04/tox.ini.j2 index bd15d819c..17bbc92fb 100644 --- a/charmcraft/templates/init-go-framework-26.04/tox.ini.j2 +++ b/charmcraft/templates/init-go-framework-26.04/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] @@ -31,50 +31,46 @@ commands = ruff check --fix {[vars]all_path} [testenv:lint] -description = Check code against coding style standards -deps = - ruff - codespell +description = Check code against coding style standards, and static checks +runner = uv-venv-lock-runner +dependency_groups = + lint + unit + integration commands = codespell {tox_root} ruff check {[vars]all_path} ruff format --check --diff {[vars]all_path} + pyright {posargs} [testenv:unit] description = Run unit tests -deps = - pytest - coverage[toml] - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + unit commands = - coverage run --source={[vars]src_path} \ - -m pytest \ - --tb native \ - -v \ - -s \ - {posargs} \ - {[vars]tests_path}/unit + coverage run --source={[vars]src_path} -m pytest \ + -v \ + -s \ + --tb native \ + {[vars]tests_path}/unit \ + {posargs} coverage report -[testenv:static] -description = Run static type checks -deps = - pyright - -r {tox_root}/requirements.txt -commands = - pyright {posargs} - [testenv:integration] description = Run integration tests -deps = - pytest - juju - pytest-operator - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + integration +pass_env = + # The integration tests don't pack the charm. If CHARM_PATH is set, the tests deploy the + # specified .charm file. Otherwise, the tests look for a .charm file in the project dir. + CHARM_PATH commands = - pytest -v \ - -s \ - --tb native \ - --log-cli-level=INFO \ - {posargs} \ - {[vars]tests_path}/integration + pytest \ + -v \ + -s \ + --tb native \ + --log-cli-level=INFO \ + {[vars]tests_path}/integration \ + {posargs} diff --git a/charmcraft/templates/init-go-framework/tox.ini.j2 b/charmcraft/templates/init-go-framework/tox.ini.j2 index bd15d819c..bacc920a4 100644 --- a/charmcraft/templates/init-go-framework/tox.ini.j2 +++ b/charmcraft/templates/init-go-framework/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] diff --git a/charmcraft/templates/init-spring-boot-framework-26.04/pyproject.toml.j2 b/charmcraft/templates/init-spring-boot-framework-26.04/pyproject.toml.j2 index 46991a3ea..96b231689 100644 --- a/charmcraft/templates/init-spring-boot-framework-26.04/pyproject.toml.j2 +++ b/charmcraft/templates/init-spring-boot-framework-26.04/pyproject.toml.j2 @@ -25,6 +25,25 @@ charmlibs-pydeps = [ "cosl==1.9.1", "pydantic==2.13.3", ] +# Dependencies of linting and static type checks +lint = [ + "ruff", + "codespell", + "pyright", +] +# Dependencies of unit tests +unit = [ + "coverage[toml]", + "ops[testing]", + "pytest", +] +# Dependencies of integration tests +integration = [ + "jubilant>=1.8,<2", + "pytest", + "pytest-jubilant>=2.0.1,<3", + "PyYAML", +] # Testing tools configuration diff --git a/charmcraft/templates/init-spring-boot-framework-26.04/src/charm.py.j2 b/charmcraft/templates/init-spring-boot-framework-26.04/src/charm.py.j2 index cb3178463..a90bbe2de 100755 --- a/charmcraft/templates/init-spring-boot-framework-26.04/src/charm.py.j2 +++ b/charmcraft/templates/init-spring-boot-framework-26.04/src/charm.py.j2 @@ -8,7 +8,6 @@ import logging import typing import ops - import paas_charm.springboot logger = logging.getLogger(__name__) diff --git a/charmcraft/templates/init-spring-boot-framework-26.04/tox.ini.j2 b/charmcraft/templates/init-spring-boot-framework-26.04/tox.ini.j2 index bd15d819c..17bbc92fb 100644 --- a/charmcraft/templates/init-spring-boot-framework-26.04/tox.ini.j2 +++ b/charmcraft/templates/init-spring-boot-framework-26.04/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] @@ -31,50 +31,46 @@ commands = ruff check --fix {[vars]all_path} [testenv:lint] -description = Check code against coding style standards -deps = - ruff - codespell +description = Check code against coding style standards, and static checks +runner = uv-venv-lock-runner +dependency_groups = + lint + unit + integration commands = codespell {tox_root} ruff check {[vars]all_path} ruff format --check --diff {[vars]all_path} + pyright {posargs} [testenv:unit] description = Run unit tests -deps = - pytest - coverage[toml] - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + unit commands = - coverage run --source={[vars]src_path} \ - -m pytest \ - --tb native \ - -v \ - -s \ - {posargs} \ - {[vars]tests_path}/unit + coverage run --source={[vars]src_path} -m pytest \ + -v \ + -s \ + --tb native \ + {[vars]tests_path}/unit \ + {posargs} coverage report -[testenv:static] -description = Run static type checks -deps = - pyright - -r {tox_root}/requirements.txt -commands = - pyright {posargs} - [testenv:integration] description = Run integration tests -deps = - pytest - juju - pytest-operator - -r {tox_root}/requirements.txt +runner = uv-venv-lock-runner +dependency_groups = + integration +pass_env = + # The integration tests don't pack the charm. If CHARM_PATH is set, the tests deploy the + # specified .charm file. Otherwise, the tests look for a .charm file in the project dir. + CHARM_PATH commands = - pytest -v \ - -s \ - --tb native \ - --log-cli-level=INFO \ - {posargs} \ - {[vars]tests_path}/integration + pytest \ + -v \ + -s \ + --tb native \ + --log-cli-level=INFO \ + {[vars]tests_path}/integration \ + {posargs} diff --git a/charmcraft/templates/init-spring-boot-framework/tox.ini.j2 b/charmcraft/templates/init-spring-boot-framework/tox.ini.j2 index bd15d819c..bacc920a4 100644 --- a/charmcraft/templates/init-spring-boot-framework/tox.ini.j2 +++ b/charmcraft/templates/init-spring-boot-framework/tox.ini.j2 @@ -9,7 +9,7 @@ min_version = 4.0.0 [vars] src_path = {tox_root}/src -;tests_path = {tox_root}/tests +tests_path = {tox_root}/tests all_path = {[vars]src_path} [testenv] diff --git a/docs/howto/manage-extensions.rst b/docs/howto/manage-extensions.rst index 8ab98965c..6bcdfa939 100644 --- a/docs/howto/manage-extensions.rst +++ b/docs/howto/manage-extensions.rst @@ -1,3 +1,6 @@ +.. meta:: + :description: How to view and manage extensions. + .. _manage-extensions: Manage extensions @@ -17,9 +20,15 @@ For example: .. code-block:: bash $ charmcraft list-extensions - Extension name Supported bases Experimental bases - ---------------- ----------------- -------------------- - flask-framework ubuntu@22.04 + Extension name Supported bases Experimental bases + --------------------- -------------------------- -------------------- + django-framework ubuntu@22.04, ubuntu@24.04 ubuntu@26.04 + expressjs-framework ubuntu@24.04 ubuntu@26.04 + fastapi-framework ubuntu@24.04 ubuntu@26.04 + flask-framework ubuntu@22.04, ubuntu@24.04 ubuntu@26.04 + go-framework ubuntu@24.04 ubuntu@26.04 + spring-boot-framework ubuntu@24.04 ubuntu@26.04 + View details about the extension in use --------------------------------------- diff --git a/docs/howto/manage-web-app-charms/use-web-app-charm.rst b/docs/howto/manage-web-app-charms/use-web-app-charm.rst index 35cd431c1..89dd0897e 100644 --- a/docs/howto/manage-web-app-charms/use-web-app-charm.rst +++ b/docs/howto/manage-web-app-charms/use-web-app-charm.rst @@ -1,8 +1,23 @@ +.. meta:: + :description: How to use a 12-factor app charm, including troubleshooting, observability, and TLS. + .. _use-12-factor-charms: Use a 12-factor app charm ========================= +.. important:: + + Extension behaviour differs between Ubuntu base versions. + + - Ubuntu 22.04 LTS (Jammy) and Ubuntu 24.04 LTS (Noble) use the original + ``paas-charm`` templates. + - Ubuntu 26.04 LTS (Resolute) and higher use the ``-26.04`` templates, with + updated configuration and behaviour. + + If you are targeting Ubuntu 26.04 LTS or higher, use the ``-26.04`` templates. + The guides on this page apply to both base groups unless noted otherwise. + .. _use-12-factor-charms-admin-user-django: Create an admin user for a Django app charm @@ -61,48 +76,101 @@ To view the Pebble logs for a deployed web app, run: .. tab-set:: - .. tab-item:: Django - :sync: django + .. tab-item:: Ubuntu 22.04 and 24.04 + :sync: base-22-24 - .. code-block:: bash + .. tab-set:: - juju ssh --container django-app /0 pebble logs + .. tab-item:: Django + :sync: django - .. tab-item:: Express - :sync: express + .. code-block:: bash - .. code-block:: bash + juju ssh --container django-app /0 pebble logs - juju ssh --container app /0 pebble logs + .. tab-item:: Express + :sync: express - .. tab-item:: FastAPI - :sync: fastapi + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 pebble logs - juju ssh --container app /0 pebble logs + .. tab-item:: FastAPI + :sync: fastapi - .. tab-item:: Flask - :sync: flask + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 pebble logs - juju ssh --container flask-app /0 pebble logs + .. tab-item:: Flask + :sync: flask - .. tab-item:: Go - :sync: go + .. code-block:: bash - .. code-block:: bash + juju ssh --container flask-app /0 pebble logs - juju ssh --container app /0 pebble logs + .. tab-item:: Go + :sync: go - .. tab-item:: Spring Boot - :sync: spring-boot + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 pebble logs + + .. tab-item:: Spring Boot + :sync: spring-boot + + .. code-block:: bash + + juju ssh /0 \ + PEBBLE_SOCKET=/charm/containers/app/pebble.socket /charm/bin/pebble logs + + .. tab-item:: Ubuntu 26.04 and higher + :sync: base-26-plus + + .. tab-set:: + + .. tab-item:: Django + :sync: django + + .. code-block:: bash + + juju ssh --container app /0 pebble logs + + .. tab-item:: Express + :sync: express + + .. code-block:: bash + + juju ssh --container app /0 pebble logs + + .. tab-item:: FastAPI + :sync: fastapi + + .. code-block:: bash + + juju ssh --container app /0 pebble logs + + .. tab-item:: Flask + :sync: flask + + .. code-block:: bash + + juju ssh --container app /0 pebble logs + + .. tab-item:: Go + :sync: go + + .. code-block:: bash + + juju ssh --container app /0 pebble logs - juju ssh /0 \ - PEBBLE_SOCKET=/charm/containers/app/pebble.socket /charm/bin/pebble logs + .. tab-item:: Spring Boot + :sync: spring-boot + + .. code-block:: bash + + juju ssh /0 \ + PEBBLE_SOCKET=/charm/containers/app/pebble.socket /charm/bin/pebble logs .. seealso:: @@ -116,48 +184,101 @@ To view more details about the web app itself, run: .. tab-set:: - .. tab-item:: Django - :sync: django + .. tab-item:: Ubuntu 22.04 and 24.04 + :sync: base-22-24 - .. code-block:: bash + .. tab-set:: - juju ssh --container django-app /0 pebble plan + .. tab-item:: Django + :sync: django - .. tab-item:: Express - :sync: express + .. code-block:: bash - .. code-block:: bash + juju ssh --container django-app /0 pebble plan - juju ssh --container app /0 pebble plan + .. tab-item:: Express + :sync: express - .. tab-item:: FastAPI - :sync: fastapi + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 pebble plan - juju ssh --container app /0 pebble plan + .. tab-item:: FastAPI + :sync: fastapi - .. tab-item:: Flask - :sync: flask + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 pebble plan - juju ssh --container flask-app /0 pebble plan + .. tab-item:: Flask + :sync: flask - .. tab-item:: Go - :sync: go + .. code-block:: bash - .. code-block:: bash + juju ssh --container flask-app /0 pebble plan + + .. tab-item:: Go + :sync: go - juju ssh --container app /0 pebble plan + .. code-block:: bash - .. tab-item:: Spring Boot - :sync: spring-boot + juju ssh --container app /0 pebble plan - .. code-block:: bash + .. tab-item:: Spring Boot + :sync: spring-boot + + .. code-block:: bash + + juju ssh /0 \ + PEBBLE_SOCKET=/charm/containers/app/pebble.socket /charm/bin/pebble plan + + .. tab-item:: Ubuntu 26.04 and higher + :sync: base-26-plus + + .. tab-set:: - juju ssh /0 \ - PEBBLE_SOCKET=/charm/containers/app/pebble.socket /charm/bin/pebble plan + .. tab-item:: Django + :sync: django + + .. code-block:: bash + + juju ssh --container app /0 pebble plan + + .. tab-item:: Express + :sync: express + + .. code-block:: bash + + juju ssh --container app /0 pebble plan + + .. tab-item:: FastAPI + :sync: fastapi + + .. code-block:: bash + + juju ssh --container app /0 pebble plan + + .. tab-item:: Flask + :sync: flask + + .. code-block:: bash + + juju ssh --container app /0 pebble plan + + .. tab-item:: Go + :sync: go + + .. code-block:: bash + + juju ssh --container app /0 pebble plan + + .. tab-item:: Spring Boot + :sync: spring-boot + + .. code-block:: bash + + juju ssh /0 \ + PEBBLE_SOCKET=/charm/containers/app/pebble.socket /charm/bin/pebble plan This command provides information on what services you may start in your app and what environment variables exist (i.e., what is available for the app to @@ -176,54 +297,114 @@ Juju container: .. tab-set:: - .. tab-item:: Django - :sync: django + .. tab-item:: Ubuntu 22.04 and 24.04 + :sync: base-22-24 - .. code-block:: bash + .. tab-set:: - juju ssh --container django-app /0 \ - pebble exec --context=django -- bash + .. tab-item:: Django + :sync: django - .. tab-item:: Express - :sync: express + .. code-block:: bash - .. code-block:: bash + juju ssh --container django-app /0 \ + pebble exec --context=django -- bash - juju ssh --container app /0 \ - pebble exec --context=expressjs -- bash + .. tab-item:: Express + :sync: express - .. tab-item:: FastAPI - :sync: fastapi + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 \ + pebble exec --context=expressjs -- bash - juju ssh --container app /0 \ - pebble exec --context=fastapi -- bash + .. tab-item:: FastAPI + :sync: fastapi - .. tab-item:: Flask - :sync: flask + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 \ + pebble exec --context=fastapi -- bash - juju ssh --container flask-app /0 \ - pebble exec --context=flask -- bash + .. tab-item:: Flask + :sync: flask - .. tab-item:: Go - :sync: go + .. code-block:: bash - .. code-block:: bash + juju ssh --container flask-app /0 \ + pebble exec --context=flask -- bash - juju ssh --container app /0 \ - pebble exec --context=go -- bash + .. tab-item:: Go + :sync: go - .. tab-item:: Spring Boot - :sync: spring-boot + .. code-block:: bash - .. code-block:: bash + juju ssh --container app /0 \ + pebble exec --context=go -- bash + + .. tab-item:: Spring Boot + :sync: spring-boot + + .. code-block:: bash + + juju ssh /0 \ + PEBBLE_SOCKET=/charm/containers/app/pebble.socket \ + /charm/bin/pebble exec --context=spring-boot -- bash + + + .. tab-item:: Ubuntu 26.04 and higher + :sync: base-26-plus + + .. tab-set:: + + .. tab-item:: Django + :sync: django + + .. code-block:: bash + + juju ssh --container app /0 \ + pebble exec --context=django -- bash + + .. tab-item:: Express + :sync: express + + .. code-block:: bash + + juju ssh --container app /0 \ + pebble exec --context=expressjs -- bash + + .. tab-item:: FastAPI + :sync: fastapi + + .. code-block:: bash + + juju ssh --container app /0 \ + pebble exec --context=fastapi -- bash + + .. tab-item:: Flask + :sync: flask + + .. code-block:: bash + + juju ssh --container app /0 \ + pebble exec --context=flask -- bash + + .. tab-item:: Go + :sync: go + + .. code-block:: bash + + juju ssh --container app /0 \ + pebble exec --context=go -- bash + + .. tab-item:: Spring Boot + :sync: spring-boot + + .. code-block:: bash - juju ssh /0 \ - PEBBLE_SOCKET=/charm/containers/app/pebble.socket \ - /charm/bin/pebble exec --context=spring-boot -- bash + juju ssh /0 \ + PEBBLE_SOCKET=/charm/containers/app/pebble.socket \ + /charm/bin/pebble exec --context=spring-boot -- bash .. important:: @@ -293,119 +474,171 @@ name of the web app with the ``-c`` option. .. tab-set:: - .. tab-item:: Django - :sync: django + .. tab-item:: Ubuntu 22.04 and 24.04 + :sync: base-22-24 .. tab-set:: - .. tab-item:: MicroK8s - :sync: microk8s + .. tab-item:: Django + :sync: django .. code-block:: bash microk8s kubectl logs -n -c django-app - .. tab-item:: Canonical K8s - :sync: canonical-k8s + .. tab-item:: Express + :sync: express .. code-block:: bash - sudo k8s kubectl logs -n -c django-app + microk8s kubectl logs -n -c app - .. tab-item:: Express - :sync: express + .. tab-item:: FastAPI + :sync: fastapi - .. tab-set:: + .. code-block:: bash - .. tab-item:: MicroK8s - :sync: microk8s + microk8s kubectl logs -n -c app + + .. tab-item:: Flask + :sync: flask + + .. code-block:: bash + + microk8s kubectl logs -n -c flask-app + + .. tab-item:: Go + :sync: go .. code-block:: bash microk8s kubectl logs -n -c app - .. tab-item:: Canonical K8s - :sync: canonical-k8s + .. tab-item:: Spring Boot + :sync: spring-boot .. code-block:: bash - sudo k8s kubectl logs -n -c app + microk8s kubectl logs -n -c app - .. tab-item:: FastAPI - :sync: fastapi + .. tab-item:: Ubuntu 26.04 and higher + :sync: base-26-plus .. tab-set:: - .. tab-item:: MicroK8s - :sync: microk8s + .. tab-item:: Django + :sync: django - .. code-block:: bash + .. tab-set:: - microk8s kubectl logs -n -c app + .. tab-item:: MicroK8s + :sync: microk8s - .. tab-item:: Canonical K8s - :sync: canonical-k8s + .. code-block:: bash - .. code-block:: bash + microk8s kubectl logs -n -c app - sudo k8s kubectl logs -n -c app + .. tab-item:: Canonical K8s + :sync: canonical-k8s - .. tab-item:: Flask - :sync: flask + .. code-block:: bash - .. tab-set:: + sudo k8s kubectl logs -n -c app - .. tab-item:: MicroK8s - :sync: microk8s + .. tab-item:: Express + :sync: express - .. code-block:: bash + .. tab-set:: - microk8s kubectl logs -n -c flask-app + .. tab-item:: MicroK8s + :sync: microk8s - .. tab-item:: Canonical K8s - :sync: canonical-k8s + .. code-block:: bash - .. code-block:: bash + microk8s kubectl logs -n -c app - sudo k8s kubectl logs -n -c flask-app + .. tab-item:: Canonical K8s + :sync: canonical-k8s - .. tab-item:: Go - :sync: go + .. code-block:: bash - .. tab-set:: + sudo k8s kubectl logs -n -c app - .. tab-item:: MicroK8s - :sync: microk8s + .. tab-item:: FastAPI + :sync: fastapi - .. code-block:: bash + .. tab-set:: - microk8s kubectl logs -n -c app + .. tab-item:: MicroK8s + :sync: microk8s - .. tab-item:: Canonical K8s - :sync: canonical-k8s + .. code-block:: bash - .. code-block:: bash + microk8s kubectl logs -n -c app - sudo k8s kubectl logs -n -c app + .. tab-item:: Canonical K8s + :sync: canonical-k8s - .. tab-item:: Spring Boot - :sync: spring-boot + .. code-block:: bash - .. tab-set:: + sudo k8s kubectl logs -n -c app - .. tab-item:: MicroK8s - :sync: microk8s + .. tab-item:: Flask + :sync: flask - .. code-block:: bash + .. tab-set:: - microk8s kubectl logs -n -c app + .. tab-item:: MicroK8s + :sync: microk8s - .. tab-item:: Canonical K8s - :sync: canonical-k8s + .. code-block:: bash - .. code-block:: bash + microk8s kubectl logs -n -c app + + .. tab-item:: Canonical K8s + :sync: canonical-k8s + + .. code-block:: bash + + sudo k8s kubectl logs -n -c app + + .. tab-item:: Go + :sync: go + + .. tab-set:: + + .. tab-item:: MicroK8s + :sync: microk8s + + .. code-block:: bash + + microk8s kubectl logs -n -c app + + .. tab-item:: Canonical K8s + :sync: canonical-k8s + + .. code-block:: bash + + sudo k8s kubectl logs -n -c app + + .. tab-item:: Spring Boot + :sync: spring-boot + + .. tab-set:: + + .. tab-item:: MicroK8s + :sync: microk8s + + .. code-block:: bash + + microk8s kubectl logs -n -c app + + .. tab-item:: Canonical K8s + :sync: canonical-k8s + + .. code-block:: bash - sudo k8s kubectl logs -n -c app + sudo k8s kubectl logs -n -c app .. seealso::