postgresql-charms-single-kernel 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: postgresql-charms-single-kernel
3
+ Version: 0.0.1
4
+ Summary: Shared and reusable code for PostgreSQL-related charms
5
+ Author-email: Canonical Data Platform <data-platform@lists.launchpad.net>
6
+ License-Expression: Apache-2.0
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Requires-Python: <4.0,>=3.8
11
+ Description-Content-Type: text/markdown
12
+
13
+ # postgresql-single-kernel-library
@@ -0,0 +1 @@
1
+ # postgresql-single-kernel-library
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: postgresql-charms-single-kernel
3
+ Version: 0.0.1
4
+ Summary: Shared and reusable code for PostgreSQL-related charms
5
+ Author-email: Canonical Data Platform <data-platform@lists.launchpad.net>
6
+ License-Expression: Apache-2.0
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Requires-Python: <4.0,>=3.8
11
+ Description-Content-Type: text/markdown
12
+
13
+ # postgresql-single-kernel-library
@@ -0,0 +1,12 @@
1
+ README.md
2
+ pyproject.toml
3
+ postgresql_charms_single_kernel.egg-info/PKG-INFO
4
+ postgresql_charms_single_kernel.egg-info/SOURCES.txt
5
+ postgresql_charms_single_kernel.egg-info/dependency_links.txt
6
+ postgresql_charms_single_kernel.egg-info/top_level.txt
7
+ single_kernel_postgresql/__init__.py
8
+ single_kernel_postgresql/abstract_charm.py
9
+ single_kernel_postgresql/config/__init__.py
10
+ single_kernel_postgresql/config/literals.py
11
+ single_kernel_postgresql/utils/__init__.py
12
+ single_kernel_postgresql/utils/postgresql.py
@@ -0,0 +1,109 @@
1
+ # Copyright 2025 Canonical Ltd.
2
+ # See LICENSE file for licensing details.
3
+
4
+ [project]
5
+ name = "postgresql-charms-single-kernel"
6
+ description = "Shared and reusable code for PostgreSQL-related charms"
7
+ version = "0.0.1"
8
+ readme = "README.md"
9
+ license = "Apache-2.0"
10
+ authors = [
11
+ {name = "Canonical Data Platform", email = "data-platform@lists.launchpad.net"}
12
+ ]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Developers",
16
+ "Operating System :: POSIX :: Linux",
17
+ ]
18
+ requires-python = ">=3.8,<4.0"
19
+
20
+ [dependency-groups]
21
+ lib = [
22
+ "ops>=2.0.0",
23
+ "psycopg2>=2.9.10",
24
+ ]
25
+ format = [
26
+ "ruff==0.12.11"
27
+ ]
28
+ lint = [
29
+ "codespell==2.4.1",
30
+ "pyright==1.1.405"
31
+ ]
32
+ unit = [
33
+ "coverage[toml]==7.9.1; python_version > '3.8'",
34
+ "pytest>=8.3.5; python_version < '3.9'",
35
+ "pytest==8.4.1; python_version >= '3.9'"
36
+ ]
37
+
38
+ # Testing tools configuration
39
+ [tool.coverage.run]
40
+ branch = true
41
+
42
+ [tool.coverage.report]
43
+ show_missing = true
44
+ exclude_lines = [
45
+ "logger\\.debug"
46
+ ]
47
+
48
+ [tool.pytest.ini_options]
49
+ minversion = "6.0"
50
+ log_cli_level = "INFO"
51
+
52
+ # Linting tools configuration
53
+ [tool.ruff]
54
+ # preview and explicit preview are enabled for CPY001
55
+ preview = true
56
+ target-version = "py38"
57
+ src = ["src", "."]
58
+ line-length = 99
59
+
60
+ [tool.ruff.lint]
61
+ explicit-preview-rules = true
62
+ select = ["A", "E", "W", "F", "C", "N", "D", "I001", "B", "CPY001", "RUF", "S", "SIM", "UP", "TCH"]
63
+ extend-ignore = [
64
+ "D203",
65
+ "D204",
66
+ "D213",
67
+ "D215",
68
+ "D400",
69
+ "D404",
70
+ "D406",
71
+ "D407",
72
+ "D408",
73
+ "D409",
74
+ "D413",
75
+ ]
76
+ # Ignore E501 because using black creates errors with this
77
+ # Ignore D107 Missing docstring in __init__
78
+ ignore = ["E501", "D107"]
79
+
80
+ [tool.ruff.lint.per-file-ignores]
81
+ "tests/*" = [
82
+ "D100", "D101", "D102", "D103", "D104",
83
+ # Asserts
84
+ "B011",
85
+ # Disable security checks for tests
86
+ "S",
87
+ ]
88
+
89
+ [tool.ruff.lint.flake8-copyright]
90
+ # Check for properly formatted copyright header in each file
91
+ author = "Canonical Ltd."
92
+ notice-rgx = "Copyright\\s\\d{4}([-,]\\d{4})*\\s+"
93
+ min-file-size = 1
94
+
95
+ [tool.ruff.lint.mccabe]
96
+ max-complexity = 10
97
+
98
+ [tool.ruff.lint.pydocstyle]
99
+ convention = "google"
100
+
101
+ [tool.pyright]
102
+ include = ["single_kernel_postgresql"]
103
+ pythonVersion = "3.8"
104
+ pythonPlatform = "All"
105
+ typeCheckingMode = "basic"
106
+ reportIncompatibleMethodOverride = false
107
+ reportImportCycles = false
108
+ reportMissingModuleSource = true
109
+ stubPath = ""
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ # Copyright 2025 Canonical Ltd.
2
+ # See LICENSE file for licensing details.
3
+ """PostgreSQL Operators Single Kernel."""
@@ -0,0 +1,26 @@
1
+ # Copyright 2025 Canonical Ltd.
2
+ # See LICENSE file for licensing details.
3
+ """Skeleton for the abstract charm."""
4
+
5
+ from ops.charm import CharmBase
6
+
7
+ from .config.literals import SYSTEM_USERS, USER
8
+ from .utils.postgresql import PostgreSQL
9
+
10
+
11
+ class AbstractPostgreSQLCharm(CharmBase):
12
+ """An abstract PostgreSQL charm."""
13
+
14
+ def __init__(self, *args):
15
+ super().__init__(*args)
16
+
17
+ self.postgresql = PostgreSQL(
18
+ primary_host="localhost",
19
+ current_host="localhost",
20
+ user=USER,
21
+ # The password is hardcoded because this is an abstract charm and
22
+ # it meant to be used only in unit tests.
23
+ password="test-password", # noqa S106
24
+ database="test-database",
25
+ system_users=SYSTEM_USERS,
26
+ )
@@ -0,0 +1,3 @@
1
+ # Copyright 2025 Canonical Ltd.
2
+ # See LICENSE file for licensing details.
3
+ """The configuration constants and objects used by the charms."""
@@ -0,0 +1,17 @@
1
+ # Copyright 2025 Canonical Ltd.
2
+ # See LICENSE file for licensing details.
3
+ """Literal string for the different charms.
4
+
5
+ This module should contain the literals used in the charms (paths, enums, etc).
6
+ """
7
+
8
+ # Relations.
9
+ PEER = "database-peers"
10
+
11
+ # Users.
12
+ BACKUP_USER = "backup"
13
+ MONITORING_USER = "monitoring"
14
+ REPLICATION_USER = "replication"
15
+ REWIND_USER = "rewind"
16
+ USER = "operator"
17
+ SYSTEM_USERS = [MONITORING_USER, REPLICATION_USER, REWIND_USER, USER]
@@ -0,0 +1,3 @@
1
+ # Copyright 2025 Canonical Ltd.
2
+ # See LICENSE file for licensing details.
3
+ """Utils and helpers for PostgreSQL charms."""