Bootstrap Python project and add base domain model

This commit is contained in:
2026-07-11 16:48:01 +02:00
parent 5b4d52b201
commit e0053c7b97
3 changed files with 77 additions and 3 deletions
+53
View File
@@ -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"
+3 -3
View File
@@ -1,6 +1,6 @@
"""Shared base classes for the Meeting Assistant domain model.""" """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 uuid import UUID, uuid4
from pydantic import BaseModel, ConfigDict, Field from pydantic import BaseModel, ConfigDict, Field
@@ -8,7 +8,7 @@ from pydantic import BaseModel, ConfigDict, Field
def utc_now() -> datetime: def utc_now() -> datetime:
"""Return the current time as a timezone-aware UTC datetime.""" """Return the current time as a timezone-aware UTC datetime."""
return datetime.now(timezone.utc) return datetime.now(UTC)
class DomainModel(BaseModel): class DomainModel(BaseModel):
@@ -22,4 +22,4 @@ class DomainModel(BaseModel):
id: UUID = Field(default_factory=uuid4) id: UUID = Field(default_factory=uuid4)
created_at: datetime = Field(default_factory=utc_now) created_at: datetime = Field(default_factory=utc_now)
updated_at: datetime = Field(default_factory=utc_now) updated_at: datetime = Field(default_factory=utc_now)
+21
View File
@@ -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