diff --git a/charmcraft.yaml b/charmcraft.yaml index 21b812d..d351c66 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -51,7 +51,7 @@ parts: source: . after: - poetry-deps - poetry-export-extra-args: ['--only', 'main,charm-libs'] + poetry-export-extra-args: ['--only', 'main,charm-libs,single-kernel'] build-packages: - libffi-dev # Needed to build Python dependencies with Rust from source - libssl-dev # Needed to build Python dependencies with Rust from source diff --git a/poetry.lock b/poetry.lock index 186707e..9efcafc 100644 --- a/poetry.lock +++ b/poetry.lock @@ -66,7 +66,7 @@ version = "4.14.0" description = "High-level concurrency and networking framework on top of asyncio or Trio" optional = false python-versions = ">=3.10" -groups = ["main"] +groups = ["main", "charm-libs"] files = [ {file = "anyio-4.14.0-py3-none-any.whl", hash = "sha256:dd9b7a2a9799ed6552fde617b2c5df02b7fdd7d88392fc48101e51bae46164d9"}, {file = "anyio-4.14.0.tar.gz", hash = "sha256:b47c1f9ccf73e67021df785332508f99379c68fa7d0684e8e3492cb1d4b23f89"}, @@ -247,7 +247,7 @@ version = "2026.6.17" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration"] files = [ {file = "certifi-2026.6.17-py3-none-any.whl", hash = "sha256:2227dcbaafe0d2f59279d1762ddddc37783ed4354594f194ffc31d20f41fc3db"}, {file = "certifi-2026.6.17.tar.gz", hash = "sha256:024c88eeec92ca068db80f02b8b07c9cef7b9fe261d1d535abfd5abd6f6af432"}, @@ -259,7 +259,7 @@ version = "2.0.0" description = "Foreign Function Interface for Python calling C code." optional = false python-versions = ">=3.9" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration"] markers = "platform_python_implementation != \"PyPy\"" files = [ {file = "cffi-2.0.0-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:0cf2d91ecc3fcc0625c2c530fe004f82c110405f101548512cce44322fa8ac44"}, @@ -416,6 +416,59 @@ files = [ dunamai = ">=1.23.1" tomlkit = ">=0.13.2" +[[package]] +name = "charmlibs-interfaces-tls-certificates" +version = "1.8.3" +description = "The charmlibs.interfaces.tls_certificates package." +optional = false +python-versions = ">=3.10" +groups = ["charm-libs"] +files = [ + {file = "charmlibs_interfaces_tls_certificates-1.8.3-py3-none-any.whl", hash = "sha256:fa0aa150b4e4513d439c7afb7eb0ceaf00363671143b27b09382758deea8a0cc"}, + {file = "charmlibs_interfaces_tls_certificates-1.8.3.tar.gz", hash = "sha256:6bc35ee330681f2e0c58cf67e41133b144f3281f73d27293714c9ca918ee7cbc"}, +] + +[package.dependencies] +cryptography = ">=43.0.0" +ops = "*" +pydantic = "*" + +[[package]] +name = "charmlibs-pathops" +version = "1.3.0.post0" +description = "A pathlib-like interface for Juju K8s charms to interact with files in their workload container." +optional = false +python-versions = ">=3.10" +groups = ["charm-libs"] +files = [ + {file = "charmlibs_pathops-1.3.0.post0-py3-none-any.whl", hash = "sha256:c6fc3e3460ffa03a7d4273cc7784c9d74378609a098c728cd9bbb2ed90bdfa5b"}, + {file = "charmlibs_pathops-1.3.0.post0.tar.gz", hash = "sha256:36ac11b0c7c55b71341a549a1803f5c8d61c2279204862b8d50736041b782f59"}, +] + +[package.dependencies] +ops = ">=2.19,<4" + +[[package]] +name = "charmlibs-rollingops" +version = "1.1.1" +description = "The charmlibs.rollingops package." +optional = false +python-versions = ">=3.12" +groups = ["charm-libs"] +files = [ + {file = "charmlibs_rollingops-1.1.1-py3-none-any.whl", hash = "sha256:1e61347c7792ec11afefa60d36f77a5afccf867832854d5aeef2da0b536afec4"}, + {file = "charmlibs_rollingops-1.1.1.tar.gz", hash = "sha256:831457d2ef12117794f89a483ee9a5c347cb209a87dafe82907e9dede7d4641c"}, +] + +[package.dependencies] +charmlibs-interfaces-tls-certificates = ">=1.8.1" +charmlibs-pathops = ">=1.2.1" +dpcharmlibs-interfaces = "1.0.0" +ops = ">=2.23.1,<4" +pydantic = ">=2.12.5" +shortuuid = ">=1.0.13" +tenacity = "*" + [[package]] name = "charmlibs-snap" version = "1.0.1.post0" @@ -723,7 +776,7 @@ version = "49.0.0" description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." optional = false python-versions = "!=3.9.0,!=3.9.1,>=3.9" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration"] files = [ {file = "cryptography-49.0.0-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:966fe0e9c67490071f14c0d2b1cb2dfb3023c5ce39457343931415f08382f2db"}, {file = "cryptography-49.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:36d1709f992593689b45bda411498d62c6e365f2ca00b84657d4dadd24de16db"}, @@ -779,6 +832,27 @@ cffi = {version = ">=2.0.0", markers = "platform_python_implementation != \"PyPy [package.extras] ssh = ["bcrypt (>=3.1.5)"] +[[package]] +name = "data-platform-helpers" +version = "1.1.0" +description = "" +optional = false +python-versions = "<4.0,>=3.10" +groups = ["charm-libs"] +files = [ + {file = "data_platform_helpers-1.1.0-py3-none-any.whl", hash = "sha256:71b2c2ba31d1bc01c55c9da82d02b0cb654b99231172916722ecaf4c469d27c4"}, + {file = "data_platform_helpers-1.1.0.tar.gz", hash = "sha256:7539ef1c1047fec36ee8298aa4c75fe2bb36419544193b691805c12ca407a797"}, +] + +[package.dependencies] +ops = ">=3,<4" +pydantic = ">=2.11,<3" +rich = "*" + +[package.extras] +all = ["pytest-operator"] +tests = ["pytest-operator"] + [[package]] name = "decorator" version = "5.3.1" @@ -791,6 +865,22 @@ files = [ {file = "decorator-5.3.1.tar.gz", hash = "sha256:4cbcdd55a6efadb9dbea26b858f4fb3264567b52d69ca0d25b721b553f60ea82"}, ] +[[package]] +name = "dpcharmlibs-interfaces" +version = "1.0.0" +description = "The dpcharmlibs.interfaces package." +optional = false +python-versions = ">=3.10" +groups = ["charm-libs"] +files = [ + {file = "dpcharmlibs_interfaces-1.0.0-py3-none-any.whl", hash = "sha256:afff80be30e3ff8c31f68557946e9d5959247f1973cbc00e96da55b095f95a21"}, + {file = "dpcharmlibs_interfaces-1.0.0.tar.gz", hash = "sha256:a177653019781a7a165be52cf4293134ee58912cd93686082cdd82da347a3bed"}, +] + +[package.dependencies] +ops = ">=3,<4" +pydantic = ">=2.11,<3" + [[package]] name = "dunamai" version = "1.26.1" @@ -855,7 +945,7 @@ version = "0.16.0" description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["main", "charm-libs"] files = [ {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, @@ -895,7 +985,7 @@ version = "1.0.9" description = "A minimal low-level HTTP client." optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["main", "charm-libs"] files = [ {file = "httpcore-1.0.9-py3-none-any.whl", hash = "sha256:2d400746a40668fc9dec9810239072b40b4484b640a8c38fd654a024c7a1bf55"}, {file = "httpcore-1.0.9.tar.gz", hash = "sha256:6e34463af53fd2ab5d807f399a9b45ea31c3dfa2276f15a2c3f00afff6e176e8"}, @@ -917,7 +1007,7 @@ version = "0.28.1" description = "The next generation HTTP client." optional = false python-versions = ">=3.8" -groups = ["main"] +groups = ["main", "charm-libs"] files = [ {file = "httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad"}, {file = "httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc"}, @@ -991,7 +1081,7 @@ version = "3.18" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.9" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration"] files = [ {file = "idna-3.18-py3-none-any.whl", hash = "sha256:7f952cbe720b688055e3f87de14f5c3e5fdaa8bc3928985c4077ca689de849a2"}, {file = "idna-3.18.tar.gz", hash = "sha256:ffb385a7e039654cef1ab9ef32c6fafe283c0c0467bba1d9029738ce4a14a848"}, @@ -1287,6 +1377,30 @@ pyRFC3339 = ">=1.0,<2.0" requests = ">=2.18.1,<3.0" six = ">=1.11.0,<2.0" +[[package]] +name = "markdown-it-py" +version = "4.2.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = false +python-versions = ">=3.10" +groups = ["charm-libs"] +files = [ + {file = "markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a"}, + {file = "markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "markdown-it-pyrs", "mistletoe (>=1.0,<2.0)", "mistune (>=3.0,<4.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins (>=0.5.0)"] +profiling = ["gprof2dot"] +rtd = ["ipykernel", "jupyter_sphinx", "mdit-py-plugins (>=0.5.0)", "myst-parser", "pyyaml", "sphinx", "sphinx-book-theme (>=1.0,<2.0)", "sphinx-copybutton", "sphinx-design"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions", "pytest-timeout", "requests"] + [[package]] name = "markupsafe" version = "3.0.3" @@ -1404,6 +1518,18 @@ traitlets = "*" [package.extras] test = ["flake8", "matplotlib", "nbdime", "nbval", "notebook", "pytest"] +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = false +python-versions = ">=3.7" +groups = ["charm-libs"] +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + [[package]] name = "mypy-extensions" version = "1.1.0" @@ -1439,7 +1565,7 @@ version = "1.42.1" description = "OpenTelemetry Python API" optional = false python-versions = ">=3.10" -groups = ["main"] +groups = ["main", "charm-libs", "single-kernel"] files = [ {file = "opentelemetry_api-1.42.1-py3-none-any.whl", hash = "sha256:51a69edacadbc03a8950ace1c4c21099cacc538820ac2c9e36277e78cebba714"}, {file = "opentelemetry_api-1.42.1.tar.gz", hash = "sha256:56c63bea9f77b62856be8c47600474acad853b2924b99b1687c4cb6297166716"}, @@ -1454,7 +1580,7 @@ version = "3.7.1" description = "The Python library behind great charms" optional = false python-versions = ">=3.10" -groups = ["main"] +groups = ["main", "charm-libs", "single-kernel"] files = [ {file = "ops-3.7.1-py3-none-any.whl", hash = "sha256:559dc6770e551da5f4b9686a5605ed927c140182eb38bcc31c1c531c2f98923a"}, {file = "ops-3.7.1.tar.gz", hash = "sha256:1765bf6d1cff376ea27608542e183b055c89f2c5f54bca602072bcc817195abc"}, @@ -1576,24 +1702,22 @@ testing = ["coverage", "pytest", "pytest-benchmark"] [[package]] name = "postgresql-charms-single-kernel" -version = "16.2.2" +version = "16.3.0" description = "Shared and reusable code for PostgreSQL-related charms" optional = false python-versions = "<4.0,>=3.8" -groups = ["main"] +groups = ["single-kernel"] files = [ - {file = "postgresql_charms_single_kernel-16.2.2-py3-none-any.whl", hash = "sha256:53b485f34aa1159e9875fd8e4d73870bc92e855eeec5175aa76a33829f4446b2"}, - {file = "postgresql_charms_single_kernel-16.2.2.tar.gz", hash = "sha256:95d027d1d52a4eb0237b2fd7cc6b548b279d7a99f82835659d9553f208dc2f81"}, + {file = "postgresql_charms_single_kernel-16.3.0-py3-none-any.whl", hash = "sha256:3f0a392b3f26ce3676ac365b49f25baa6ac812f82143c517689935f42114efbd"}, + {file = "postgresql_charms_single_kernel-16.3.0.tar.gz", hash = "sha256:7e0d7db80d0b1a5a97baf002809c101d55e4ffe5b9f26a3ae20b9b150c6ae51e"}, ] [package.dependencies] -httpx = {version = "*", optional = true, markers = "python_full_version >= \"3.12.0\" and extra == \"postgresql\""} ops = ">=2.0.0" -psycopg2 = ">=2.9.10" tenacity = ">=9.0.0" [package.extras] -postgresql = ["httpx ; python_full_version >= \"3.12.0\""] +postgresql = ["charm-refresh ; python_full_version >= \"3.12.0\"", "charmlibs-interfaces-tls-certificates (>=1.8.3) ; python_full_version >= \"3.12.0\"", "charmlibs-pathops (>=1.0.1) ; python_full_version >= \"3.12.0\"", "charmlibs-rollingops (>=1.1.1) ; python_full_version >= \"3.12.0\"", "charmlibs-snap (>=1.0.1) ; python_full_version >= \"3.12.0\"", "data-platform-helpers (>=0.1.7) ; python_full_version >= \"3.12.0\"", "httpx ; python_full_version >= \"3.12.0\"", "jinja2 (>=3.1.6) ; python_full_version >= \"3.12.0\"", "psycopg2 (>=2.9.10)", "pydantic (>=2.0) ; python_full_version >= \"3.12.0\"", "requests ; python_full_version >= \"3.12.0\"", "tomli ; python_full_version >= \"3.12.0\""] [[package]] name = "prompt-toolkit" @@ -1819,7 +1943,7 @@ version = "3.0" description = "C parser in Python" optional = false python-versions = ">=3.10" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration"] markers = "platform_python_implementation != \"PyPy\" and implementation_name != \"PyPy\"" files = [ {file = "pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992"}, @@ -1987,7 +2111,7 @@ version = "2.20.0" description = "Pygments is a syntax highlighting package written in Python." optional = false python-versions = ">=3.9" -groups = ["integration", "unit"] +groups = ["charm-libs", "integration", "unit"] files = [ {file = "pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176"}, {file = "pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f"}, @@ -2174,7 +2298,7 @@ version = "6.0.3" description = "YAML parser and emitter for Python" optional = false python-versions = ">=3.8" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration", "single-kernel"] files = [ {file = "PyYAML-6.0.3-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f"}, {file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4"}, @@ -2309,6 +2433,25 @@ requests = ">=2.0.0" [package.extras] rsa = ["oauthlib[signedtoken] (>=3.0.0)"] +[[package]] +name = "rich" +version = "15.0.0" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +optional = false +python-versions = ">=3.9.0" +groups = ["charm-libs"] +files = [ + {file = "rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb"}, + {file = "rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0" +pygments = ">=2.13.0,<3.0.0" + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + [[package]] name = "rpds-py" version = "2026.5.1" @@ -2477,6 +2620,18 @@ files = [ {file = "ruff-0.15.18.tar.gz", hash = "sha256:2698a964c70e8bf402dcb99c8810472d270d141e7aa8c4e13599fd52033a2f33"}, ] +[[package]] +name = "shortuuid" +version = "1.0.13" +description = "A generator library for concise, unambiguous and URL-safe UUIDs." +optional = false +python-versions = ">=3.6" +groups = ["charm-libs"] +files = [ + {file = "shortuuid-1.0.13-py3-none-any.whl", hash = "sha256:a482a497300b49b4953e15108a7913244e1bb0d41f9d332f5e9925dba33a3c5a"}, + {file = "shortuuid-1.0.13.tar.gz", hash = "sha256:3bb9cf07f606260584b1df46399c0b87dd84773e7b25912b7e391e30797c5e72"}, +] + [[package]] name = "six" version = "1.17.0" @@ -2515,7 +2670,7 @@ version = "9.1.4" description = "Retry code until it succeeds" optional = false python-versions = ">=3.10" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration", "single-kernel"] files = [ {file = "tenacity-9.1.4-py3-none-any.whl", hash = "sha256:6095a360c919085f28c6527de529e76a06ad89b23659fa881ae0649b867a9d55"}, {file = "tenacity-9.1.4.tar.gz", hash = "sha256:adb31d4c263f2bd041081ab33b498309a57c77f9acf2db65aadf0898179cf93a"}, @@ -2531,7 +2686,7 @@ version = "2.4.1" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration"] files = [ {file = "tomli-2.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f8f0fc26ec2cc2b965b7a3b87cd19c5c6b8c5e5f436b984e85f486d652285c30"}, {file = "tomli-2.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4ab97e64ccda8756376892c53a72bd1f964e519c77236368527f758fbc36a53a"}, @@ -2668,7 +2823,7 @@ version = "4.15.0" description = "Backported and Experimental Type Hints for Python 3.9+" optional = false python-versions = ">=3.9" -groups = ["main", "charm-libs", "integration", "unit"] +groups = ["main", "charm-libs", "integration", "single-kernel", "unit"] files = [ {file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"}, {file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"}, @@ -2742,7 +2897,7 @@ version = "1.9.0" description = "WebSocket client for Python with low level API options" optional = false python-versions = ">=3.9" -groups = ["main", "integration"] +groups = ["main", "charm-libs", "integration", "single-kernel"] files = [ {file = "websocket_client-1.9.0-py3-none-any.whl", hash = "sha256:af248a825037ef591efbf6ed20cc5faa03d3b47b9e5a2230a529eeee1c1fc3ef"}, {file = "websocket_client-1.9.0.tar.gz", hash = "sha256:9e813624b6eb619999a97dc7958469217c3176312b3a16a4bd1bc7e08a46ec98"}, @@ -2842,4 +2997,4 @@ h11 = ">=0.16.0,<1" [metadata] lock-version = "2.1" python-versions = ">=3.12,<4.0" -content-hash = "159a739e80a5e3f68c7d73b495116b9272a4635bc978c7ea0fd77fcc1d4f12b3" +content-hash = "f9d2198450f44124af9cf4468acfc8fa09da56f40c9851f7af5aeef96ce230ed" diff --git a/pyproject.toml b/pyproject.toml index bd75382..1be8a9f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,11 +18,22 @@ pysyncobj = "^0.3.15" charm-refresh = "^3.1.0.2" charmlibs-snap = "^1.0.1" charmlibs-systemd = "^1.0.0" -postgresql-charms-single-kernel = {extras = ["postgresql"], version="16.2.2"} + +[tool.poetry.group.single-kernel.dependencies] +postgresql-charms-single-kernel = "16.3.0" [tool.poetry.group.charm-libs.dependencies] # data_platform_libs/v0/data_models.py pydantic = "*" +# single-kernel is pinned bare (no extra) in the single-kernel group, so the +# charm build declares the lib's "postgresql"-extra runtime deps that aren't +# already in main (see the library's optional-dependencies for the full set). +httpx = "*" +data-platform-helpers = ">=0.1.7" +charmlibs-pathops = ">=1.0.1" +charmlibs-interfaces-tls-certificates = ">=1.8.3" +charmlibs-rollingops = ">=1.1.1" +tomli = "^2.4.1" [tool.poetry.group.format] optional = true @@ -52,6 +63,10 @@ tomli-w = "^1.2.0" optional = true [tool.poetry.group.integration.dependencies] +# single-kernel itself (bare, no extra) is installed via the shared single-kernel +# group (see tox.ini); the tests only import its pure-stdlib config.literals. +# psycopg2-binary provides the psycopg2 module the tests import without building +# the source psycopg2 the lib's postgresql extra would pull in. pytest = "^9.1.1" pytest-operator = "^0.43.2" # renovate caret doesn't work: https://github.com/renovatebot/renovate/issues/26940 diff --git a/src/charm.py b/src/charm.py index 8312d1f..be2fc34 100755 --- a/src/charm.py +++ b/src/charm.py @@ -25,7 +25,8 @@ SecretRemoveEvent, main, ) -from single_kernel_postgresql.config.literals import PEER, Substrates +from single_kernel_postgresql.config.enums import Substrates +from single_kernel_postgresql.config.literals import PEER_RELATION from single_kernel_postgresql.utils import _change_owner from config import CharmConfig @@ -285,7 +286,7 @@ def _peers(self) -> Relation | None: A:class:`ops.model.Relation` object representing the peer relation. """ - return self.model.get_relation(PEER) + return self.model.get_relation(PEER_RELATION) if __name__ == "__main__": diff --git a/src/constants.py b/src/constants.py index 6ab1efd..549cab8 100644 --- a/src/constants.py +++ b/src/constants.py @@ -3,15 +3,8 @@ """File containing constants to be used in the charm.""" -API_REQUEST_TIMEOUT = 5 -PATRONI_CLUSTER_STATUS_ENDPOINT = "cluster" -PEER = "database-peers" - # Snap constants. SNAP_COMMON_PATH = "/var/snap/charmed-postgresql/common" -# # Watcher constants -WATCHER_RELATION = "watcher" - RAFT_PORT = 2222 RAFT_PARTNER_PREFIX = "partner_node_status_server_" diff --git a/src/raft_controller.py b/src/raft_controller.py index 1576af3..5d8721a 100644 --- a/src/raft_controller.py +++ b/src/raft_controller.py @@ -34,7 +34,8 @@ ) from jinja2 import Template from pysyncobj.utility import TcpUtility -from single_kernel_postgresql.config.literals import Substrates +from single_kernel_postgresql.config.enums import Substrates +from single_kernel_postgresql.config.literals import PATRONI_CLUSTER_STATUS_ENDPOINT from single_kernel_postgresql.utils import ( create_directory, parallel_patroni_get_request, @@ -43,7 +44,7 @@ from tenacity import RetryError, Retrying, stop_after_attempt, wait_fixed from cluster import ClusterMember -from constants import PATRONI_CLUSTER_STATUS_ENDPOINT, RAFT_PARTNER_PREFIX, RAFT_PORT +from constants import RAFT_PARTNER_PREFIX, RAFT_PORT if TYPE_CHECKING: from charm import PostgresqlWatcherCharm diff --git a/src/relations/watcher_requirer.py b/src/relations/watcher_requirer.py index 71307b9..7ace749 100644 --- a/src/relations/watcher_requirer.py +++ b/src/relations/watcher_requirer.py @@ -38,10 +38,11 @@ UpdateStatusEvent, WaitingStatus, ) -from single_kernel_postgresql.config.literals import Substrates +from single_kernel_postgresql.config.enums import Substrates +from single_kernel_postgresql.config.literals import WATCHER_RELATION from single_kernel_postgresql.utils import _change_owner -from constants import RAFT_PORT, SNAP_COMMON_PATH, WATCHER_RELATION +from constants import RAFT_PORT, SNAP_COMMON_PATH from raft_controller import RaftController, install_service if typing.TYPE_CHECKING: @@ -49,9 +50,6 @@ logger = logging.getLogger(__name__) -SNAP_NAME = "charmed-postgresql" -SNAP_CHANNEL = "16/edge" - class WatcherRequirerHandler(Object): """Handles the watcher requirer relation and watcher-mode lifecycle.""" diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 7a4c0db..d5c7dcb 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -12,14 +12,13 @@ import yaml from juju.model import Model from pytest_operator.plugin import OpsTest +from single_kernel_postgresql.config.literals import PEER_RELATION from tenacity import ( retry, stop_after_attempt, wait_exponential, ) -from constants import PEER - CHARM_BASE = "ubuntu@22.04" METADATA = yaml.safe_load(Path("./metadata.yaml").read_text()) DATABASE_APP_NAME = "postgresql" @@ -120,7 +119,7 @@ async def get_password( Returns: the user password. """ - secret = await get_secret_by_label(ops_test, label=f"{PEER}.{database_app_name}.app") + secret = await get_secret_by_label(ops_test, label=f"{PEER_RELATION}.{database_app_name}.app") password = secret.get(f"{username}-password") return password diff --git a/tests/integration/high_availability/high_availability_helpers_new.py b/tests/integration/high_availability/high_availability_helpers_new.py index 34b29d8..537cbed 100644 --- a/tests/integration/high_availability/high_availability_helpers_new.py +++ b/tests/integration/high_availability/high_availability_helpers_new.py @@ -8,10 +8,11 @@ from jubilant import Juju from jubilant.statustypes import Status, UnitStatus from pysyncobj.utility import TcpUtility +from single_kernel_postgresql.config.literals import PEER_RELATION from tenacity import Retrying, stop_after_delay, wait_fixed from yaml import safe_load -from constants import PEER, RAFT_PARTNER_PREFIX +from constants import RAFT_PARTNER_PREFIX from ..helpers import execute_queries_on_unit @@ -138,7 +139,7 @@ def wait_for_apps_status(jubilant_status_func: JujuAppsStatusFn, *apps: str) -> def get_user_password(juju: Juju, app_name: str, user: str) -> str | None: """Get a system user's password.""" for secret in juju.secrets(): - if secret.label == f"{PEER}.{app_name}.app": + if secret.label == f"{PEER_RELATION}.{app_name}.app": revealed_secret = juju.show_secret(secret.uri, reveal=True) return revealed_secret.content.get(f"{user}-password") diff --git a/tests/unit/test_raft_controller.py b/tests/unit/test_raft_controller.py index 718028f..77dba6f 100644 --- a/tests/unit/test_raft_controller.py +++ b/tests/unit/test_raft_controller.py @@ -6,7 +6,7 @@ from jinja2 import Template from pytest import fixture -from single_kernel_postgresql.config.literals import Substrates +from single_kernel_postgresql.config.enums import Substrates from tenacity import stop_after_delay, wait_fixed from constants import RAFT_PARTNER_PREFIX diff --git a/tox.ini b/tox.ini index 6864dc7..b30be69 100644 --- a/tox.ini +++ b/tox.ini @@ -47,7 +47,7 @@ description = Run unit tests set_env = {[testenv]set_env} commands_pre = - poetry install --only main,charm-libs,unit --no-root + poetry install --only main,charm-libs,single-kernel,unit --no-root commands = poetry run coverage run --source={[vars]src_path} \ -m pytest -v --tb native -s {posargs} {[vars]tests_path}/unit @@ -66,6 +66,6 @@ pass_env = LANDSCAPE_ACCOUNT_NAME LANDSCAPE_REGISTRATION_KEY commands_pre = - poetry install --only integration --no-root + poetry install --only integration,single-kernel --no-root commands = poetry run pytest -v --tb native --log-cli-level=INFO -s --ignore={[vars]tests_path}/unit/ {posargs}