annex4ac


Nameannex4ac JSON
Version 0.8.0 PyPI version JSON
download
home_pageNone
SummaryAnnex IV-as-Code CLI: generate & validate EU AI Act Annex IV
upload_time2025-07-17 03:46:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords ai act compliance cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Annex IV‑as‑Code (annex4ac)

Generate and validate EU AI Act Annex IV technical documentation straight from your CI. 

100% local by default.

SaaS/PDF unlocks with a licence key .

---

## ✨ Features

* **Always up‑to‑date** – every run pulls the latest Annex IV HTML from the official AI Act Explorer.
* **Schema‑first** – YAML scaffold mirrors the **9 numbered sections** adopted in the July 2024 Official Journal.
* **Fail‑fast CI** – `annex4ac validate` exits 1 when a mandatory field is missing, so a GitHub Action can block the PR.
* **Zero binaries** – ReportLab renders the PDF; no LaTeX, no system packages.
* **Freemium** – `fetch-schema` & `validate` are free; `generate` (PDF) requires `ANNEX4AC_LICENSE`.
* **Built-in rule engine** – business-logic validation runs locally via pure Python.

---

## 🛠 Requirements

- Python 3.9+
- [reportlab](https://www.reportlab.com/documentation) (PDF, Pro)
- [pydantic](https://docs.pydantic.dev) (schema validation)
- [typer](https://typer.tiangolo.com) (CLI)
- [pyyaml](https://pyyaml.org/) (YAML)

---

## 🚀 Quick‑start

```bash
# 1 Install (Python 3.9+)
pip install annex4ac

# 2 Pull the latest Annex IV layout
annex4ac fetch-schema annex_template.yaml

# 3 Fill in the YAML → validate
cp annex_template.yaml my_annex.yaml
$EDITOR my_annex.yaml
annex4ac validate -i my_annex.yaml   # "Validation OK!" or exit 1

# 4 (Pro) Generate the PDF
echo "ANNEX4AC_LICENSE=your_key" >> ~/.bashrc
annex4ac generate -i my_annex.yaml -o docs/annex_iv.pdf
```

> **Hint :** You only need to edit the YAML once per model version—CI keeps it green.

---

## 🗂 Required YAML fields (June 2024 format)

| Key                      | Annex IV § |
| ------------------------ | ---------- |
| `risk_level`             | —          | "high", "limited", "minimal" — determines required sections |
| `use_cases`              | —          | List of tags (Annex III) for auto high-risk. Acceptable values: employment_screening, biometric_id, critical_infrastructure, education_scoring, justice_decision, migration_control |
| `system_overview`        |  1         |
| `development_process`    |  2         |
| `system_monitoring`      |  3         |
| `performance_metrics`    |  4         |
| `risk_management`        |  5         |
| `changes_and_versions`   |  6         |
| `standards_applied`      |  7         |
| `compliance_declaration` |  8         |
| `post_market_plan`       |  9         |
| `enterprise_size`        | —          | `"sme"`, `"mid"`, `"large"` – determines whether Annex IV omissions are treated as errors (`deny`) or as recommendations (`warn`). |

---

## 🛠 Commands

| Command        | What it does                                                                  |
| -------------- | ----------------------------------------------------------------------------- |
| `fetch-schema` | Download current Annex IV HTML, convert to YAML scaffold `annex_schema.yaml`. |
| `validate`     | Validate your YAML against the Pydantic schema and built-in Python rules. Exits 1 on error. Supports `--sarif` for GitHub annotations.             |
| `generate`     | Render PDF with pure‑Python **ReportLab** (Pro tier).                         |

Run `annex4ac --help` for full CLI.

---

## 🏷️ Schema version in PDF

Each PDF now displays the Annex IV schema version stamp (e.g., v20240613) and the document generation date.

---

## 🔑 Pro-licence & JWT

To generate PDF in Pro mode, a license is required (JWT, RSA signature). The ANNEX4AC_LICENSE key can be checked offline, the public key is stored in the package.

---

## 🛡️ Rule-based validation (Python)

- **High-risk systems**: All 9 sections of Annex IV are mandatory (Art. 11 §1).
- **Limited/minimal risk**: Annex IV is optional but recommended for transparency (Art. 52).
- For high-risk (`risk_level: high`), post_market_plan is required.
- If use_cases contains a high-risk tag (Annex III), risk_level must be high (auto high-risk).
- SARIF report now supports coordinates (line/col) for integration with GitHub Code Scanning.
- **Auto-detection**: Systems with Annex III use_cases are automatically classified as high-risk.

---

## 🐙 GitHub Action example

```yaml
name: Annex IV gate
on: [pull_request]

jobs:
  ai-act-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'
      - run: pip install annex4ac
      - run: annex4ac validate -i spec/model.yaml
```

Add `ANNEX4AC_LICENSE` as a secret to use PDF export in CI.

---

## 📄 Offline cache

If Annex IV is temporarily unavailable online, use:

```bash
annex4ac fetch-schema --offline
```

This will load the last saved schema from `~/.cache/annex4ac/` (the cache is updated automatically every 14 days).

---

## ⚙️ Local development

```bash
git clone https://github.com/your‑org/annex4ac
cd annex4ac
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
pytest                     # unit tests
python annex4ac.py --help
```

---

## 🔑 Licensing & pricing

| Tier       | Price           | Features                                                     |
| ---------- | --------------- | ------------------------------------------------------------ |
| Community  | **Free**        | `fetch-schema`, `validate`, unlimited public repos           |
| Pro        | **€15 / month** | PDF generation, version history (future SaaS), email support |
| Enterprise | Custom          | Self‑hosted Docker, SLA 99.9 %, custom sections              |

Pay once, use anywhere – CLI, GitHub Action, future REST API.

---

## 📚 References

* Annex IV HTML – [https://artificialintelligenceact.eu/annex/4/](https://artificialintelligenceact.eu/annex/4/)
* Official Journal PDF – [https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=OJ\:L\_202401689](https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=OJ:L_202401689)
* ReportLab docs – [https://www.reportlab.com/documentation](https://www.reportlab.com/documentation)
* Typer docs – [https://typer.tiangolo.com](https://typer.tiangolo.com)
* Pydantic docs – [https://docs.pydantic.dev](https://docs.pydantic.dev)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "annex4ac",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "AI Act, compliance, CLI",
    "author": null,
    "author_email": "Aleksandr Racionaluss <prihodko02bk@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5b/99/d3bccf20793228b06d743d8c335b5da4c9f82108af95b370cf2f7e9c4ec3/annex4ac-0.8.0.tar.gz",
    "platform": null,
    "description": "# Annex\u202fIV\u2011as\u2011Code\u00a0(annex4ac)\r\n\r\nGenerate and validate EU\u00a0AI\u00a0Act Annex\u202fIV technical documentation straight from your CI. \r\n\r\n100% local by default.\r\n\r\nSaaS/PDF unlocks with a licence key .\r\n\r\n---\r\n\r\n## \u2728 Features\r\n\r\n* **Always up\u2011to\u2011date** \u2013 every run pulls the latest Annex\u202fIV HTML from the official AI\u00a0Act Explorer.\r\n* **Schema\u2011first** \u2013 YAML scaffold mirrors the **9 numbered sections** adopted in the July\u00a02024 Official\u00a0Journal.\r\n* **Fail\u2011fast CI** \u2013 `annex4ac validate` exits\u202f1 when a mandatory field is missing, so a GitHub Action can block the PR.\r\n* **Zero binaries** \u2013 ReportLab renders the PDF; no LaTeX, no system packages.\r\n* **Freemium** \u2013 `fetch-schema` & `validate` are free; `generate` (PDF) requires `ANNEX4AC_LICENSE`.\r\n* **Built-in rule engine** \u2013 business-logic validation runs locally via pure Python.\r\n\r\n---\r\n\r\n## \ud83d\udee0 Requirements\r\n\r\n- Python 3.9+\r\n- [reportlab](https://www.reportlab.com/documentation) (PDF, Pro)\r\n- [pydantic](https://docs.pydantic.dev) (schema validation)\r\n- [typer](https://typer.tiangolo.com) (CLI)\r\n- [pyyaml](https://pyyaml.org/) (YAML)\r\n\r\n---\r\n\r\n## \ud83d\ude80 Quick\u2011start\r\n\r\n```bash\r\n# 1\u00a0Install (Python\u00a03.9+)\r\npip install annex4ac\r\n\r\n# 2\u00a0Pull the latest Annex\u202fIV layout\r\nannex4ac fetch-schema annex_template.yaml\r\n\r\n# 3\u00a0Fill in the YAML \u2192 validate\r\ncp annex_template.yaml my_annex.yaml\r\n$EDITOR my_annex.yaml\r\nannex4ac validate -i my_annex.yaml   # \"Validation OK!\" or exit\u00a01\r\n\r\n# 4\u00a0(Pro) Generate the PDF\r\necho \"ANNEX4AC_LICENSE=your_key\" >> ~/.bashrc\r\nannex4ac generate -i my_annex.yaml -o docs/annex_iv.pdf\r\n```\r\n\r\n> **Hint\u202f:** You only need to edit the YAML once per model version\u2014CI keeps it green.\r\n\r\n---\r\n\r\n## \ud83d\uddc2 Required YAML fields (June\u00a02024 format)\r\n\r\n| Key                      | Annex\u00a0IV\u00a0\u00a7 |\r\n| ------------------------ | ---------- |\r\n| `risk_level`             | \u2014          | \"high\", \"limited\", \"minimal\" \u2014 determines required sections |\r\n| `use_cases`              | \u2014          | List of tags (Annex III) for auto high-risk. Acceptable values: employment_screening, biometric_id, critical_infrastructure, education_scoring, justice_decision, migration_control |\r\n| `system_overview`        | \u00a01         |\r\n| `development_process`    | \u00a02         |\r\n| `system_monitoring`      | \u00a03         |\r\n| `performance_metrics`    | \u00a04         |\r\n| `risk_management`        | \u00a05         |\r\n| `changes_and_versions`   | \u00a06         |\r\n| `standards_applied`      | \u00a07         |\r\n| `compliance_declaration` | \u00a08         |\r\n| `post_market_plan`       | \u00a09         |\r\n| `enterprise_size`        | \u2014          | `\"sme\"`, `\"mid\"`, `\"large\"` \u2013 determines whether Annex\u202fIV omissions are treated as errors (`deny`) or as recommendations (`warn`). |\r\n\r\n---\r\n\r\n## \ud83d\udee0 Commands\r\n\r\n| Command        | What it does                                                                  |\r\n| -------------- | ----------------------------------------------------------------------------- |\r\n| `fetch-schema` | Download current Annex\u00a0IV HTML, convert to YAML scaffold `annex_schema.yaml`. |\r\n| `validate`     | Validate your YAML against the Pydantic schema and built-in Python rules. Exits\u202f1 on error. Supports `--sarif` for GitHub annotations.             |\r\n| `generate`     | Render PDF with pure\u2011Python **ReportLab** (Pro tier).                         |\r\n\r\nRun `annex4ac --help` for full CLI.\r\n\r\n---\r\n\r\n## \ud83c\udff7\ufe0f Schema version in PDF\r\n\r\nEach PDF now displays the Annex IV schema version stamp (e.g., v20240613) and the document generation date.\r\n\r\n---\r\n\r\n## \ud83d\udd11 Pro-licence & JWT\r\n\r\nTo generate PDF in Pro mode, a license is required (JWT, RSA signature). The ANNEX4AC_LICENSE key can be checked offline, the public key is stored in the package.\r\n\r\n---\r\n\r\n## \ud83d\udee1\ufe0f Rule-based validation (Python)\r\n\r\n- **High-risk systems**: All 9 sections of Annex IV are mandatory (Art. 11 \u00a71).\r\n- **Limited/minimal risk**: Annex IV is optional but recommended for transparency (Art. 52).\r\n- For high-risk (`risk_level: high`), post_market_plan is required.\r\n- If use_cases contains a high-risk tag (Annex III), risk_level must be high (auto high-risk).\r\n- SARIF report now supports coordinates (line/col) for integration with GitHub Code Scanning.\r\n- **Auto-detection**: Systems with Annex III use_cases are automatically classified as high-risk.\r\n\r\n---\r\n\r\n## \ud83d\udc19 GitHub\u00a0Action example\r\n\r\n```yaml\r\nname: Annex\u00a0IV gate\r\non: [pull_request]\r\n\r\njobs:\r\n  ai-act-check:\r\n    runs-on: ubuntu-latest\r\n    steps:\r\n      - uses: actions/checkout@v4\r\n      - uses: actions/setup-python@v5\r\n        with:\r\n          python-version: '3.11'\r\n      - run: pip install annex4ac\r\n      - run: annex4ac validate -i spec/model.yaml\r\n```\r\n\r\nAdd `ANNEX4AC_LICENSE` as a secret to use PDF export in CI.\r\n\r\n---\r\n\r\n## \ud83d\udcc4 Offline cache\r\n\r\nIf Annex IV is temporarily unavailable online, use:\r\n\r\n```bash\r\nannex4ac fetch-schema --offline\r\n```\r\n\r\nThis will load the last saved schema from `~/.cache/annex4ac/` (the cache is updated automatically every 14 days).\r\n\r\n---\r\n\r\n## \u2699\ufe0f Local development\r\n\r\n```bash\r\ngit clone https://github.com/your\u2011org/annex4ac\r\ncd annex4ac\r\npython -m venv .venv && source .venv/bin/activate\r\npip install -r requirements.txt\r\npytest                     # unit tests\r\npython annex4ac.py --help\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udd11 Licensing & pricing\r\n\r\n| Tier       | Price           | Features                                                     |\r\n| ---------- | --------------- | ------------------------------------------------------------ |\r\n| Community  | **Free**        | `fetch-schema`, `validate`, unlimited public repos           |\r\n| Pro        | **\u20ac15\u00a0/\u00a0month** | PDF generation, version history (future SaaS), email support |\r\n| Enterprise | Custom          | Self\u2011hosted Docker, SLA\u00a099.9\u202f%, custom sections              |\r\n\r\nPay once, use anywhere\u00a0\u2013 CLI, GitHub\u00a0Action, future REST API.\r\n\r\n---\r\n\r\n## \ud83d\udcda References\r\n\r\n* Annex\u00a0IV HTML \u2013 [https://artificialintelligenceact.eu/annex/4/](https://artificialintelligenceact.eu/annex/4/)\r\n* Official\u00a0Journal PDF \u2013 [https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=OJ\\:L\\_202401689](https://eur-lex.europa.eu/legal-content/EN/TXT/PDF/?uri=OJ:L_202401689)\r\n* ReportLab docs \u2013 [https://www.reportlab.com/documentation](https://www.reportlab.com/documentation)\r\n* Typer docs \u2013 [https://typer.tiangolo.com](https://typer.tiangolo.com)\r\n* Pydantic docs \u2013 [https://docs.pydantic.dev](https://docs.pydantic.dev)\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Annex IV-as-Code CLI: generate & validate EU AI Act Annex IV",
    "version": "0.8.0",
    "project_urls": null,
    "split_keywords": [
        "ai act",
        " compliance",
        " cli"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c08144c782606dd531d7b1087087dfd8cad96ede8a118f424d92b74bf783bcc9",
                "md5": "598f610cbc3c579743470aff8029ab8f",
                "sha256": "76277f9f6e952a398e15f60cad29bf0f0198c8589fdbec803c55a13b5f16f3b4"
            },
            "downloads": -1,
            "filename": "annex4ac-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "598f610cbc3c579743470aff8029ab8f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 4218,
            "upload_time": "2025-07-17T03:46:23",
            "upload_time_iso_8601": "2025-07-17T03:46:23.954286Z",
            "url": "https://files.pythonhosted.org/packages/c0/81/44c782606dd531d7b1087087dfd8cad96ede8a118f424d92b74bf783bcc9/annex4ac-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5b99d3bccf20793228b06d743d8c335b5da4c9f82108af95b370cf2f7e9c4ec3",
                "md5": "6c326b30d7d8781efc3e74f35972df6c",
                "sha256": "1b82e50548b3eb91b9484ffd7eeb7ac99f7412d8bf2e671eae5cf0690176d087"
            },
            "downloads": -1,
            "filename": "annex4ac-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6c326b30d7d8781efc3e74f35972df6c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12280,
            "upload_time": "2025-07-17T03:46:25",
            "upload_time_iso_8601": "2025-07-17T03:46:25.320450Z",
            "url": "https://files.pythonhosted.org/packages/5b/99/d3bccf20793228b06d743d8c335b5da4c9f82108af95b370cf2f7e9c4ec3/annex4ac-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-17 03:46:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "annex4ac"
}
        
Elapsed time: 0.43369s