- Introduce StorageAdapter protocol and InMemoryAdapter (thread-safe, in-memory) in engine/adapter.py to decouple storage from sync logic - Refactor SyncEngine to accept a StorageAdapter, replacing the previous stub that returned an empty list - Wire server to use SyncEngine + InMemoryAdapter, removing hardcoded SYNC_OPERATIONS fixtures - Add tests for engine, adapter, generator, and types (tests/) - Add pre-commit config (.pre-commit-config.yaml) with linting/formatting hooks - Update pyproject.toml and uv.lock with new dev dependencies - Clean up type annotations and CLI help strings across generator, server, and utils
99 lines
2.2 KiB
TOML
99 lines
2.2 KiB
TOML
[project]
|
|
name = "sync-protocol"
|
|
version = "0.1.0"
|
|
description = "Add your description here"
|
|
readme = "README.md"
|
|
authors = [
|
|
{ name = "Alireza Rabie", email = "alireza@aazerra.dev" }
|
|
]
|
|
requires-python = ">=3.12"
|
|
dependencies = [
|
|
"click>=8.4.2",
|
|
"jinja2>=3.1.6",
|
|
"pydantic>=2.13.4",
|
|
"pydantic-settings>=2.15.0",
|
|
]
|
|
|
|
[project.scripts]
|
|
schema= "generator.main:cli"
|
|
sync-server = "server.main:main"
|
|
sync-client = "client.main:main"
|
|
|
|
[build-system]
|
|
requires = ["hatchling"]
|
|
build-backend = "hatchling.build"
|
|
|
|
[tool.hatch.build.targets.wheel]
|
|
packages = ["src/generator"]
|
|
|
|
[tool.pytest.ini_options]
|
|
pythonpath = ["src"]
|
|
testpaths = ["tests"]
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Black
|
|
# ---------------------------------------------------------------------------
|
|
|
|
[tool.black]
|
|
line-length = 88
|
|
target-version = ["py312"]
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Ruff
|
|
# ---------------------------------------------------------------------------
|
|
|
|
[tool.ruff]
|
|
line-length = 88
|
|
target-version = "py312"
|
|
src = ["src"]
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # pyflakes
|
|
"I", # isort
|
|
"B", # flake8-bugbear
|
|
"UP", # pyupgrade
|
|
"C4", # flake8-comprehensions
|
|
"SIM", # flake8-simplify
|
|
"ANN", # flake8-annotations
|
|
"RUF", # ruff-specific rules
|
|
]
|
|
ignore = [
|
|
"ANN401", # allow Any in some places
|
|
]
|
|
|
|
[tool.ruff.lint.isort]
|
|
known-first-party = ["engine", "server", "client", "generator", "utils"]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"tests/**" = ["ANN"] # don't require annotations in tests
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Mypy
|
|
# ---------------------------------------------------------------------------
|
|
|
|
[tool.mypy]
|
|
python_version = "3.12"
|
|
mypy_path = "src"
|
|
strict = true
|
|
# Pydantic plugin for correct model field inference
|
|
plugins = ["pydantic.mypy"]
|
|
|
|
[tool.pydantic-mypy]
|
|
init_forbid_extra = true
|
|
warn_required_dynamic_aliases = true
|
|
|
|
[dependency-groups]
|
|
dev = [
|
|
"black>=26.5.1",
|
|
"mypy>=2.3.1",
|
|
"pre-commit>=4.6.2",
|
|
"rope>=1.14.0",
|
|
"ruff>=0.16.4",
|
|
]
|
|
test = [
|
|
"pytest>=9.1.1",
|
|
]
|