exactdocs-kernel 0.1.0__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,33 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .coverage
11
+ coverage.xml
12
+ htmlcov/
13
+ reports/
14
+
15
+ # Built web UI bundled into the wheel / image (see web/README.md)
16
+ packages/exactdocs/src/exactdocs/_web/
17
+
18
+ # Local data and secrets
19
+ data/
20
+ *.db
21
+ .env
22
+ .env.*
23
+ !.env.example
24
+
25
+ # Editors / OS
26
+ .idea/
27
+ .vscode/*
28
+ !.vscode/extensions.json
29
+ .DS_Store
30
+ Thumbs.db
31
+
32
+ # Claude Code local settings
33
+ .claude/settings.local.json
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.5
2
+ Name: exactdocs-kernel
3
+ Version: 0.1.0
4
+ Summary: Shared kernel for ExactDocs domains: framework-free building blocks every domain may import.
5
+ Project-URL: Repository, https://github.com/SirCypkowskyy/ExactDocs
6
+ Author: Cyprian Gburek
7
+ License-Expression: Apache-2.0
8
+ Classifier: Programming Language :: Python :: 3.14
9
+ Classifier: Typing :: Typed
10
+ Requires-Python: >=3.14
11
+ Description-Content-Type: text/markdown
12
+
13
+ # exactdocs-kernel
14
+
15
+ Shared kernel of [ExactDocs](https://github.com/SirCypkowskyy/ExactDocs).
16
+
17
+ The only code every domain of the `exactdocs` modular monolith may import. It must stay
18
+ small, stable and framework-free (no FastAPI, FastMCP, Pydantic or database drivers), and it
19
+ must never import `exactdocs`.
@@ -0,0 +1,7 @@
1
+ # exactdocs-kernel
2
+
3
+ Shared kernel of [ExactDocs](https://github.com/SirCypkowskyy/ExactDocs).
4
+
5
+ The only code every domain of the `exactdocs` modular monolith may import. It must stay
6
+ small, stable and framework-free (no FastAPI, FastMCP, Pydantic or database drivers), and it
7
+ must never import `exactdocs`.
@@ -0,0 +1,31 @@
1
+ [project]
2
+ name = "exactdocs-kernel"
3
+ dynamic = ["version"]
4
+ description = "Shared kernel for ExactDocs domains: framework-free building blocks every domain may import."
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ requires-python = ">=3.14"
8
+ authors = [{ name = "Cyprian Gburek" }]
9
+ classifiers = [
10
+ "Programming Language :: Python :: 3.14",
11
+ "Typing :: Typed",
12
+ ]
13
+ dependencies = []
14
+
15
+ [project.urls]
16
+ Repository = "https://github.com/SirCypkowskyy/ExactDocs"
17
+
18
+ [build-system]
19
+ requires = ["hatchling>=1.27", "uv-dynamic-versioning>=0.11"]
20
+ build-backend = "hatchling.build"
21
+
22
+ [tool.hatch.version]
23
+ source = "uv-dynamic-versioning"
24
+
25
+ [tool.uv-dynamic-versioning]
26
+ vcs = "git"
27
+ style = "pep440"
28
+ fallback-version = "0.0.0"
29
+
30
+ [tool.hatch.build.targets.wheel]
31
+ packages = ["src/exactdocs_kernel"]
@@ -0,0 +1,16 @@
1
+ """Shared kernel: the only code every ExactDocs domain may import.
2
+
3
+ Keep it small, stable and framework-free. It must never import ``exactdocs``.
4
+ """
5
+
6
+ from exactdocs_kernel.clock import Clock, SystemClock
7
+ from exactdocs_kernel.errors import ConflictError, DomainError, NotFoundError, ValidationError
8
+
9
+ __all__ = [
10
+ "Clock",
11
+ "ConflictError",
12
+ "DomainError",
13
+ "NotFoundError",
14
+ "SystemClock",
15
+ "ValidationError",
16
+ ]
@@ -0,0 +1,20 @@
1
+ from dataclasses import dataclass
2
+ from datetime import UTC, datetime
3
+ from typing import Protocol
4
+
5
+
6
+ class Clock(Protocol):
7
+ """Driven port for the current time, so time-dependent logic stays testable."""
8
+
9
+ def now(self) -> datetime:
10
+ """Return the current, timezone-aware time."""
11
+ ...
12
+
13
+
14
+ @dataclass(frozen=True, slots=True)
15
+ class SystemClock:
16
+ """Real wall clock (UTC)."""
17
+
18
+ def now(self) -> datetime:
19
+ """Return the current UTC time."""
20
+ return datetime.now(UTC)
@@ -0,0 +1,29 @@
1
+ """Error vocabulary shared by all domains.
2
+
3
+ Driving adapters translate these into transport errors (HTTP status codes, MCP tool errors)
4
+ in one place, so domains never import a web framework to signal failure.
5
+ """
6
+
7
+
8
+ class DomainError(Exception):
9
+ """Base class for expected, business-level failures."""
10
+
11
+ code: str = "domain_error"
12
+
13
+
14
+ class NotFoundError(DomainError):
15
+ """The requested thing does not exist (or is not visible to the caller)."""
16
+
17
+ code = "not_found"
18
+
19
+
20
+ class ConflictError(DomainError):
21
+ """The request conflicts with the current state."""
22
+
23
+ code = "conflict"
24
+
25
+
26
+ class ValidationError(DomainError):
27
+ """The request is well-formed but violates a business rule."""
28
+
29
+ code = "validation_error"
File without changes
@@ -0,0 +1,9 @@
1
+ from datetime import UTC
2
+
3
+ from exactdocs_kernel import Clock, SystemClock
4
+
5
+
6
+ def test_system_clock_is_a_clock_and_returns_aware_utc_time() -> None:
7
+ clock: Clock = SystemClock()
8
+
9
+ assert clock.now().tzinfo is UTC