new: project skeleton with a live probe (#74)
uv project on Python 3.14 with Ruff (incl. DTZ), pyright strict, and import-linter contracts: composition root above domains above platform, each domain reachable from others only through its `service` module, and `bots/` forbidden from importing `hapi`. `just dev/test/lint` recipes and pre-commit running the same checks plus gitleaks. `just` and `pre-commit` are dev dependencies, so uv is the only tool needed outside the venv. `hapi serve` runs the public API (:8000) and the internal probe listener (:8081) as two uvicorn servers in one event loop (ADR-0009); `/livez` is constant and served only on :8081. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
16aa73251b
commit
2beb581c6d
24 files changed
+1123
-1
No files matched your search
+110
@@ -0,0 +1,110 @@
|
||||
[project]
|
||||
name = "hapi"
|
||||
version = "0.1.0"
|
||||
description = "Personal, cloud-hosted API for one Household and its automations"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"fastapi>=0.165.0",
|
||||
"typer>=0.29.3",
|
||||
"uvicorn>=0.54.0",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
hapi = "hapi.cli:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/hapi"]
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"httpx>=0.29.0",
|
||||
"import-linter>=2.17",
|
||||
"pre-commit>=4.7.0",
|
||||
"pyright>=1.1.414",
|
||||
"pytest>=9.2.0",
|
||||
"pytest-asyncio>=1.5.0",
|
||||
"ruff>=0.17.6",
|
||||
"rust-just>=1.59.0",
|
||||
]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
asyncio_default_fixture_loop_scope = "function"
|
||||
testpaths = ["tests"]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py314"
|
||||
src = ["src", "tests", "bots"]
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"E", "W", "F", "I", "N", "UP", "B", "A", "C4", "DTZ", "S", "SIM", "PT",
|
||||
"RET", "TID", "ASYNC", "PL", "RUF",
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"tests/**" = ["S101", "S603", "PLR2004"]
|
||||
|
||||
[tool.pyright]
|
||||
include = ["src", "tests", "bots"]
|
||||
pythonVersion = "3.14"
|
||||
typeCheckingMode = "strict"
|
||||
venvPath = "."
|
||||
venv = ".venv"
|
||||
|
||||
[tool.importlinter]
|
||||
root_packages = ["hapi", "bots"]
|
||||
|
||||
[[tool.importlinter.contracts]]
|
||||
name = "Composition root above domains, domains above platform"
|
||||
type = "layers"
|
||||
containers = ["hapi"]
|
||||
layers = [
|
||||
"app : cli",
|
||||
"finance : fitness : maintenance : smart_home",
|
||||
"platform",
|
||||
]
|
||||
|
||||
[[tool.importlinter.contracts]]
|
||||
name = "Finance is reachable from other domains only through its service"
|
||||
type = "protected"
|
||||
protected_modules = ["hapi.finance"]
|
||||
allowed_importers = ["hapi.app", "hapi.cli"]
|
||||
ignore_imports = ["hapi.** -> hapi.finance.service"]
|
||||
unmatched_ignore_imports_alerting = "none"
|
||||
|
||||
[[tool.importlinter.contracts]]
|
||||
name = "Fitness is reachable from other domains only through its service"
|
||||
type = "protected"
|
||||
protected_modules = ["hapi.fitness"]
|
||||
allowed_importers = ["hapi.app", "hapi.cli"]
|
||||
ignore_imports = ["hapi.** -> hapi.fitness.service"]
|
||||
unmatched_ignore_imports_alerting = "none"
|
||||
|
||||
[[tool.importlinter.contracts]]
|
||||
name = "Maintenance is reachable from other domains only through its service"
|
||||
type = "protected"
|
||||
protected_modules = ["hapi.maintenance"]
|
||||
allowed_importers = ["hapi.app", "hapi.cli"]
|
||||
ignore_imports = ["hapi.** -> hapi.maintenance.service"]
|
||||
unmatched_ignore_imports_alerting = "none"
|
||||
|
||||
[[tool.importlinter.contracts]]
|
||||
name = "Smart home is reachable from other domains only through its service"
|
||||
type = "protected"
|
||||
protected_modules = ["hapi.smart_home"]
|
||||
allowed_importers = ["hapi.app", "hapi.cli"]
|
||||
ignore_imports = ["hapi.** -> hapi.smart_home.service"]
|
||||
unmatched_ignore_imports_alerting = "none"
|
||||
|
||||
[[tool.importlinter.contracts]]
|
||||
name = "Bots talk to hAPI over HTTP only"
|
||||
type = "forbidden"
|
||||
source_modules = ["bots"]
|
||||
forbidden_modules = ["hapi"]
|
||||
Reference in new issue
Block a user