From e0053c7b9709692e063e0523cdc894900c8cf373 Mon Sep 17 00:00:00 2001 From: Martin Tazl Date: Sat, 11 Jul 2026 16:48:01 +0200 Subject: [PATCH] Bootstrap Python project and add base domain model --- pyproject.toml | 53 ++++++++++++++++++++++++++++++++++++++++ src/mka/models/base.py | 6 ++--- tests/test_base_model.py | 21 ++++++++++++++++ 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 tests/test_base_model.py diff --git a/pyproject.toml b/pyproject.toml index e69de29..3640b79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -0,0 +1,53 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "meeting-assistant" +version = "0.1.0" +description = "Local-first meeting transcription and knowledge capture assistant" +readme = "README.md" +requires-python = ">=3.11" +authors = [ + { name = "Martin Tazl" } +] +dependencies = [ + "pydantic>=2,<3" +] + +[project.optional-dependencies] +dev = [ + "pytest>=8,<10", + "ruff>=0.8,<1" +] + +[tool.hatch.build.targets.wheel] +packages = ["src/mka"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +pythonpath = ["src"] +addopts = [ + "-ra", + "--strict-markers" +] + +[tool.ruff] +target-version = "py311" +line-length = 100 +src = ["src", "tests"] + +[tool.ruff.lint] +select = [ + "E", + "F", + "I", + "UP", + "B", + "SIM" +] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +line-ending = "auto" diff --git a/src/mka/models/base.py b/src/mka/models/base.py index c9e93ec..32d1710 100644 --- a/src/mka/models/base.py +++ b/src/mka/models/base.py @@ -1,6 +1,6 @@ """Shared base classes for the Meeting Assistant domain model.""" -from datetime import datetime, timezone +from datetime import UTC, datetime from uuid import UUID, uuid4 from pydantic import BaseModel, ConfigDict, Field @@ -8,7 +8,7 @@ from pydantic import BaseModel, ConfigDict, Field def utc_now() -> datetime: """Return the current time as a timezone-aware UTC datetime.""" - return datetime.now(timezone.utc) + return datetime.now(UTC) class DomainModel(BaseModel): @@ -22,4 +22,4 @@ class DomainModel(BaseModel): id: UUID = Field(default_factory=uuid4) created_at: datetime = Field(default_factory=utc_now) - updated_at: datetime = Field(default_factory=utc_now) + updated_at: datetime = Field(default_factory=utc_now) \ No newline at end of file diff --git a/tests/test_base_model.py b/tests/test_base_model.py new file mode 100644 index 0000000..36dd6f8 --- /dev/null +++ b/tests/test_base_model.py @@ -0,0 +1,21 @@ +from datetime import UTC +from uuid import UUID + +from mka.models.base import DomainModel + + +def test_domain_model_creates_uuid_and_utc_timestamps() -> None: + model = DomainModel() + + assert isinstance(model.id, UUID) + assert model.created_at.tzinfo is UTC + assert model.updated_at.tzinfo is UTC + + +def test_domain_model_json_roundtrip() -> None: + original = DomainModel() + + serialized = original.model_dump_json() + restored = DomainModel.model_validate_json(serialized) + + assert restored == original