diff --git a/charm/charmcraft.yaml b/charm/charmcraft.yaml index 9f835e2..262c0d2 100644 --- a/charm/charmcraft.yaml +++ b/charm/charmcraft.yaml @@ -11,6 +11,6 @@ bases: channel: "20.04" parts: charm: - charm-binary-python-packages: [cryptography, jsonschema] + charm-binary-python-packages: [cryptography, jsonschema, pydantic-core] build-packages: - git diff --git a/charm/src/charm.py b/charm/src/charm.py index e8133c8..e35838c 100755 --- a/charm/src/charm.py +++ b/charm/src/charm.py @@ -14,23 +14,18 @@ from typing import Optional, cast from urllib.parse import urlparse -from charms.catalogue_k8s.v1.catalogue import ( - CatalogueItemsChangedEvent, - CatalogueProvider, -) +from charms.catalogue_k8s.v1.catalogue import CatalogueItemsChangedEvent, CatalogueProvider from charms.observability_libs.v1.cert_handler import CertHandler from charms.tempo_k8s.v1.charm_tracing import trace_charm from charms.tempo_k8s.v2.tracing import TracingEndpointRequirer -from charms.traefik_k8s.v2.ingress import ( - IngressPerAppReadyEvent, - IngressPerAppRequirer, -) -from nginx_config import CA_CERT_PATH, CERT_PATH, KEY_PATH, NGINX_CONFIG_PATH, NginxConfigBuilder +from charms.traefik_k8s.v2.ingress import IngressPerAppReadyEvent, IngressPerAppRequirer from ops.charm import ActionEvent, CharmBase from ops.main import main from ops.model import ActiveStatus, BlockedStatus, WaitingStatus from ops.pebble import ChangeError, Error, Layer, PathError, ProtocolError +from nginx_config import CA_CERT_PATH, CERT_PATH, KEY_PATH, NGINX_CONFIG_PATH, NginxConfigBuilder + logger = logging.getLogger(__name__) ROOT_PATH = "/web" diff --git a/charm/tests/unit/test_charm.py b/charm/tests/unit/test_charm.py index 76fe4fa..f9fddee 100644 --- a/charm/tests/unit/test_charm.py +++ b/charm/tests/unit/test_charm.py @@ -10,12 +10,13 @@ from unittest.mock import Mock, patch from urllib.parse import urlparse -from charm import CatalogueCharm from charms.catalogue_k8s.v1.catalogue import DEFAULT_RELATION_NAME from ops.charm import ActionEvent from ops.model import ActiveStatus from ops.testing import Harness +from charm import CatalogueCharm + CONTAINER_NAME = "catalogue" diff --git a/charm/tox.ini b/charm/tox.ini index fe0c7ba..f3583d0 100644 --- a/charm/tox.ini +++ b/charm/tox.ini @@ -32,9 +32,11 @@ description = Apply coding style standards to code deps = black ruff + isort commands = - ruff --fix {[vars]all_path} + isort {[vars]all_path} black {[vars]all_path} + ruff check {[vars]all_path} --fix [testenv:lint] description = Check code against coding style standards @@ -46,7 +48,7 @@ commands = codespell {[vars]lib_path} codespell . --skip .git --skip .tox --skip build --skip lib --skip venv --skip .mypy_cache --skip nginx_config.py --skip tox.ini codespell src/nginx_config.py -L anull - ruff {[vars]all_path} + ruff check {[vars]all_path} black --check --diff {[vars]all_path} [testenv:static-{charm,lib}]