refactor: migrate to pyproject.toml and update CLI entry point

• Move dependencies from requirements.txt to pyproject.toml with static
listing
 • Add project.scripts entry for docai CLI app
 • Update main.py to use docai.cli:app instead of main.py
 • Remove obsolete main.py and requirements.txt files

This modernizes packaging and simplifies the CLI setup.
This commit is contained in:
2025-12-01 16:18:15 -03:00
parent 1ed786e7ad
commit cb3ea98890
4 changed files with 21 additions and 19 deletions

View File

@@ -5,10 +5,23 @@ build-backend = "hatchling.build"
[project]
name = "docai"
version = "0.0.0"
dynamic = ["dependencies"]
requires-python = ">=3.12,<3.14"
dependencies = [
"rich>=14.2",
"typer>=0.20.0",
"langchain>=1.1",
"langchain-openai>=1.1",
"xdg-base-dirs>=6.0.2",
"in_place>=1.0.1",
"tree-sitter>=0.25.2",
"tree-sitter-python>=0.25.0",
"tree-sitter-c>=0.24.1",
"tree-sitter-cpp>=0.23.4",
]
dynamic = []
[tool.hatch.dependencies]
path = "requirements.txt"
[project.scripts]
docai = "docai.cli:app"
[tool.hatch.build.targets.wheel]
packages = ["src/docai"]

View File

@@ -1,10 +0,0 @@
rich>=14.2
typer>=0.20.0
langchain>=1.1
langchain-openai>=1.1
xdg-base-dirs>=6.0.2
in_place>=1.0.1
tree-sitter>=0.25.2
tree-sitter-python>=0.25.0
tree-sitter-c>=0.24.1
tree-sitter-cpp>=0.23.4

View File

@@ -1,11 +1,8 @@
import sys
from pathlib import Path
# Add 'src/' to sys.path manually
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from docai.main import main
import typer
typer.run(main)
from docai.cli import app
app()

View File

@@ -18,7 +18,9 @@ CONFIG_PATHS = [
Path().absolute() / "config.toml",
]
app = typer.Typer(help="DocAI - Generative Documentation")
@app.command()
def main(
files: list[Path],
config: Path | None = typer.Option(None),
@@ -79,4 +81,4 @@ def main(
if __name__ == "__main__":
typer.run(main)
app()