feat(root): modernize API server,CLI and data loading
- Switch to async lifespans, eager in‑memory caching of calendar data, and ORJSON responses for reduced latency. - Add structured logging and GZIP middleware, enforce year bounds and directory existence. - Replace json module with orjson, use pathlib and TypedDict aliases, and implement typed argument parsing with explicit error handling. - Remove unused test.py and refactor scraper CLI to accept argv via function injection, simplify input mode logic. - Preserve backward defaults (produce both single JSON and directory output) while exposing explicit flags via argparse. This refactor improves scalability on low‑resources servers, adds robustness checks, and clarifies the command‑line interface for future extensions.
This commit is contained in:
7 files changed
+521
-257
No files matched your search
+24
-7
@@ -1,20 +1,37 @@
|
||||
[project]
|
||||
name = "nepali-calendar-api"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
description = "A Nepali calendar dataset/library containing Nepali dates, tithi, festivals, public holidays, and auspicious dates for marriage and bratabandha ceremonies."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"aiohttp>=3.13.3",
|
||||
"beautifulsoup4>=4.14.3",
|
||||
"colorama>=0.4.6",
|
||||
"fastapi>=0.115.11",
|
||||
"uvicorn>=0.34.0",
|
||||
"orjson>=3.10.0",
|
||||
]
|
||||
authors = [
|
||||
{ name = "Sankalp Tharu", email = 'sankalptharu50028@gmail.com' },
|
||||
|
||||
[project.optional-dependencies]
|
||||
scraper = [
|
||||
"aiohttp>=3.13.3",
|
||||
"beautifulsoup4>=4.14.3",
|
||||
]
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"ruff>=0.14.6",
|
||||
"httpx>=0.27.0",
|
||||
"pytest>=8.0.0",
|
||||
]
|
||||
|
||||
authors = [
|
||||
{ name = "Sankalp Tharu", email = "sankalptharu50028@gmail.com" },
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 100
|
||||
target-version = "py313"
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = ["E", "F", "I", "B", "UP", "SIM", "RUF"]
|
||||
ignore = ["E501"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ["tests"]
|
||||
Reference in new issue
Block a user