- pyproject.toml met wetgit package, pytest/ruff/black/mypy config - BWB XML → Markdown parser (src/wetgit/pipeline/bwb_parser.py) - Getest op ~400 regelingen over alle BWB-types - 20 edge cases gevonden en opgelost: - <boek>, <deel>, <kop> structuren - <regeling-tekst>, <circulaire-tekst> containers - <bijlage>, <enig-artikel>, <sub-paragraaf>, <divisie> - CALS <table> → Markdown tabellen - <nadruk>, <sup>, <sub> inline formatting - <redactie>, <tussenkop>, <gereserveerd>, <vervallen> - Nix flake devshell met alle dependencies - CLI entrypoint (wetgit) - Domain models (Regeling, Artikel) Sluit #4, sluit #5
116 lines
3.2 KiB
Nix
116 lines
3.2 KiB
Nix
{
|
|
description = "WetGit - Nederlandse wetgeving als code";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
# Python 3.13 (zelfde versie als ansible gebruikt, voorkomt PATH-conflicten)
|
|
pythonEnv = pkgs.python313.withPackages (ps: with ps; [
|
|
# Conversie-pipeline (PRD: Technische Stack)
|
|
lxml # BWB XML-parsing met XPath/XSLT
|
|
pygit2 # Git-operaties via libgit2 (performanter dan GitPython)
|
|
pyyaml # YAML frontmatter generatie
|
|
python-frontmatter # Markdown + YAML frontmatter parsing
|
|
|
|
# API-laag (PRD: FastAPI)
|
|
fastapi
|
|
uvicorn # ASGI server
|
|
httpx # Async HTTP client (SRU-API, EUR-Lex)
|
|
pydantic # Data validatie
|
|
|
|
# Achtergrondtaken (PRD: Celery + Redis)
|
|
celery
|
|
redis # Python Redis client
|
|
|
|
# CLI-tool (PRD: wetgit CLI)
|
|
click
|
|
rich # Terminal formatting
|
|
|
|
# Testing
|
|
pytest
|
|
pytest-cov
|
|
pytest-asyncio
|
|
|
|
# Development tools
|
|
black
|
|
ruff
|
|
mypy
|
|
pip
|
|
setuptools
|
|
wheel
|
|
build
|
|
|
|
# Typing stubs
|
|
types-requests
|
|
types-pyyaml
|
|
]);
|
|
|
|
in {
|
|
devShells.default = pkgs.mkShell {
|
|
name = "wetgit";
|
|
|
|
buildInputs = with pkgs; [
|
|
# Python environment
|
|
pythonEnv
|
|
|
|
# Dependency management
|
|
uv
|
|
|
|
# Ansible (infrastructuur provisioning Hetzner)
|
|
ansible
|
|
ansible-lint
|
|
|
|
# Hetzner Cloud CLI
|
|
hcloud
|
|
|
|
# Redis server (lokale development)
|
|
redis
|
|
|
|
# Git & tools
|
|
git
|
|
jq
|
|
yq-go
|
|
curl
|
|
|
|
# Native dependencies voor pygit2
|
|
libgit2
|
|
];
|
|
|
|
shellHook = ''
|
|
echo "WetGit - Nederlandse wetgeving als code"
|
|
echo ""
|
|
echo "Python: $(python --version)"
|
|
echo "Ansible: $(ansible --version 2>/dev/null | head -1)"
|
|
echo "hcloud: $(hcloud version 2>/dev/null)"
|
|
echo ""
|
|
echo "Pipeline tools: lxml, pygit2, fastapi"
|
|
echo "Infra tools: ansible, hcloud"
|
|
echo ""
|
|
|
|
# Laad .env als die bestaat (API keys, Hetzner token)
|
|
if [ -f .env ]; then
|
|
set -a
|
|
source .env
|
|
set +a
|
|
echo "Loaded environment from .env"
|
|
echo ""
|
|
fi
|
|
|
|
# Venv voor PyPI-only packages (agentmail etc.)
|
|
if [ ! -d .venv ]; then
|
|
uv venv .venv --python python3.13 --seed
|
|
uv pip install --python .venv/bin/python agentmail
|
|
echo "Created .venv and installed PyPI dependencies"
|
|
fi
|
|
source .venv/bin/activate
|
|
'';
|
|
};
|
|
});
|
|
}
|