Bootstrap Python project and add base domain model
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user