feat(api): implement notebook management CRUD endpoints

Implement Sprint 1: Notebook Management CRUD

- Add NotebookService with full CRUD operations
- Add POST /api/v1/notebooks (create notebook)
- Add GET /api/v1/notebooks (list with pagination)
- Add GET /api/v1/notebooks/{id} (get by ID)
- Add PATCH /api/v1/notebooks/{id} (partial update)
- Add DELETE /api/v1/notebooks/{id} (delete)
- Add Pydantic models for requests/responses
- Add custom exceptions (ValidationError, NotFoundError, NotebookLMError)
- Add comprehensive unit tests (31 tests, 97% coverage)
- Add API integration tests (26 tests)
- Fix router prefix duplication
- Fix JSON serialization in error responses

BREAKING CHANGE: None
This commit is contained in:
Luca Sacchi Ricciardi
2026-04-06 01:13:13 +02:00
commit 4b7a419a98
65 changed files with 10507 additions and 0 deletions

150
pyproject.toml Normal file
View File

@@ -0,0 +1,150 @@
[project]
name = "notebooklm-agent"
version = "0.1.0"
description = "API and webhook interface for Google NotebookLM automation with AI agent integration"
dynamic = ["readme"]
requires-python = ">=3.10"
license = {text = "MIT"}
authors = [
{name = "NotebookLM Agent Team", email = "team@example.com"}
]
keywords = ["notebooklm", "api", "webhook", "ai", "agent", "automation"]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
]
dependencies = [
"fastapi>=0.100.0",
"uvicorn[standard]>=0.23.0",
"httpx>=0.27.0",
"pydantic>=2.0.0",
"pydantic-settings>=2.0.0",
"notebooklm-py>=0.3.4",
"python-multipart>=0.0.6",
"python-jose[cryptography]>=3.3.0",
"passlib[bcrypt]>=1.7.4",
"structlog>=24.1.0",
"tenacity>=8.2.0",
"celery>=5.3.0",
"redis>=5.0.0",
]
[project.urls]
Homepage = "https://github.com/example/notebooklm-agent"
Repository = "https://github.com/example/notebooklm-agent"
Documentation = "https://github.com/example/notebooklm-agent#readme"
Issues = "https://github.com/example/notebooklm-agent/issues"
[project.optional-dependencies]
browser = ["playwright>=1.40.0"]
dev = [
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"pytest-httpx>=0.30.0",
"pytest-cov>=4.0.0",
"pytest-rerunfailures>=14.0",
"pytest-timeout>=2.3.0",
"python-dotenv>=1.0.0",
"mypy>=1.0.0",
"pre-commit>=4.5.1",
"ruff==0.8.6",
"vcrpy>=6.0.0",
"httpx>=0.27.0",
"respx>=0.21.0",
]
all = ["notebooklm-agent[browser,dev]"]
[project.scripts]
notebooklm-agent = "notebooklm_agent.cli:main"
[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"
[tool.hatch.metadata.hooks.fancy-pypi-readme]
content-type = "text/markdown"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "README.md"
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
path = "CHANGELOG.md"
[tool.hatch.build.targets.wheel]
packages = ["src/notebooklm_agent"]
force-include = {"SKILL.md" = "notebooklm_agent/data/SKILL.md", "AGENTS.md" = "notebooklm_agent/data/AGENTS.md"}
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
addopts = "--ignore=tests/e2e"
timeout = 60
markers = [
"e2e: end-to-end tests requiring authentication (run with pytest tests/e2e -m e2e)",
"integration: integration tests with mocked external APIs",
"unit: pure unit tests",
"slow: slow tests to run selectively",
]
[tool.coverage.run]
source = ["src/notebooklm_agent"]
branch = true
[tool.coverage.report]
show_missing = true
fail_under = 90
[tool.mypy]
python_version = "3.10"
warn_return_any = false
warn_unused_ignores = true
disallow_untyped_defs = false
check_untyped_defs = true
ignore_missing_imports = true
files = ["src/notebooklm_agent"]
exclude = ["tests/"]
[[tool.mypy.overrides]]
module = "notebooklm_agent.api.*"
warn_return_any = false
strict_optional = true
[tool.ruff]
target-version = "py310"
line-length = 100
src = ["src", "tests"]
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"SIM", # flake8-simplify
]
ignore = [
"E501", # line too long (handled by formatter)
"B008", # function call in default argument (FastAPI uses this)
"SIM102", # nested ifs - kept for readability
"SIM105", # contextlib.suppress - explicit try/except clearer
]
per-file-ignores = {"src/notebooklm_agent/__init__.py" = ["E402"]}
[tool.ruff.lint.isort]
known-first-party = ["notebooklm_agent"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"