doctools-m8 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- doctools_m8-0.1.0/.codacy.yml +27 -0
- doctools_m8-0.1.0/.gitattributes +1 -0
- doctools_m8-0.1.0/.github/FUNDING.yml +13 -0
- doctools_m8-0.1.0/.github/dependabot.yml +18 -0
- doctools_m8-0.1.0/.github/workflows/CI.yaml +117 -0
- doctools_m8-0.1.0/.github/workflows/PiPy.yml +79 -0
- doctools_m8-0.1.0/.gitignore +218 -0
- doctools_m8-0.1.0/.gitleaks.toml +15 -0
- doctools_m8-0.1.0/.markdownlint.yaml +33 -0
- doctools_m8-0.1.0/AGENTS.md +7 -0
- doctools_m8-0.1.0/CHANGELOG.md +17 -0
- doctools_m8-0.1.0/CLAUDE.md +7 -0
- doctools_m8-0.1.0/LICENSE +201 -0
- doctools_m8-0.1.0/PKG-INFO +77 -0
- doctools_m8-0.1.0/README.md +41 -0
- doctools_m8-0.1.0/REPOSITORY_CONTEXT.md +40 -0
- doctools_m8-0.1.0/SECURITY.md +24 -0
- doctools_m8-0.1.0/doctools_m8/__init__.py +5 -0
- doctools_m8-0.1.0/doctools_m8/py.typed +0 -0
- doctools_m8-0.1.0/pyproject.toml +72 -0
- doctools_m8-0.1.0/tests/test_ci_policy.py +136 -0
- doctools_m8-0.1.0/tests/test_package.py +64 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
engines:
|
|
2
|
+
bandit:
|
|
3
|
+
enabled: true
|
|
4
|
+
ruff:
|
|
5
|
+
enabled: true
|
|
6
|
+
markdownlint:
|
|
7
|
+
enabled: true
|
|
8
|
+
pylint:
|
|
9
|
+
enabled: false
|
|
10
|
+
prospector:
|
|
11
|
+
enabled: false
|
|
12
|
+
pydocstyle:
|
|
13
|
+
enabled: false
|
|
14
|
+
pycodestyle:
|
|
15
|
+
enabled: false
|
|
16
|
+
pyflakes:
|
|
17
|
+
enabled: false
|
|
18
|
+
|
|
19
|
+
exclude_paths:
|
|
20
|
+
- "tests/**"
|
|
21
|
+
- "dist/**"
|
|
22
|
+
- "*.egg-info/**"
|
|
23
|
+
- ".pytest_cache/**"
|
|
24
|
+
- "**/__pycache__/**"
|
|
25
|
+
- "AGENTS.md"
|
|
26
|
+
- "CLAUDE.md"
|
|
27
|
+
- "REPOSITORY_CONTEXT.md"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
4
|
+
patreon: # Replace with a single Patreon username
|
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
|
6
|
+
ko_fi: eliserra
|
|
7
|
+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
|
11
|
+
otechie: # Replace with a single Otechie username
|
|
12
|
+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
|
13
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
|
|
3
|
+
updates:
|
|
4
|
+
# GitHub Actions — keep workflow action SHAs current
|
|
5
|
+
- package-ecosystem: "github-actions"
|
|
6
|
+
directory: "/"
|
|
7
|
+
schedule:
|
|
8
|
+
interval: "monthly"
|
|
9
|
+
commit-message:
|
|
10
|
+
prefix: "ci"
|
|
11
|
+
|
|
12
|
+
# Python — track package dependencies
|
|
13
|
+
- package-ecosystem: "pip"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "monthly"
|
|
17
|
+
commit-message:
|
|
18
|
+
prefix: "deps"
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: ["main"]
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
lint:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
20
|
+
|
|
21
|
+
- name: Set up Python
|
|
22
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.14"
|
|
25
|
+
cache: "pip"
|
|
26
|
+
|
|
27
|
+
- name: Install dev dependencies
|
|
28
|
+
run: pip install -e ".[dev,test]"
|
|
29
|
+
|
|
30
|
+
- name: Check formatting
|
|
31
|
+
run: ruff format --check .
|
|
32
|
+
|
|
33
|
+
- name: Lint
|
|
34
|
+
run: ruff check .
|
|
35
|
+
|
|
36
|
+
typecheck:
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
40
|
+
|
|
41
|
+
- name: Set up Python
|
|
42
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
43
|
+
with:
|
|
44
|
+
python-version: "3.14"
|
|
45
|
+
cache: "pip"
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies
|
|
48
|
+
run: pip install -e ".[dev,test]"
|
|
49
|
+
|
|
50
|
+
- name: Type check
|
|
51
|
+
run: mypy doctools_m8
|
|
52
|
+
|
|
53
|
+
security:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
57
|
+
|
|
58
|
+
- name: Set up Python
|
|
59
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
60
|
+
with:
|
|
61
|
+
python-version: "3.14"
|
|
62
|
+
|
|
63
|
+
- name: Install bandit
|
|
64
|
+
run: pip install bandit
|
|
65
|
+
|
|
66
|
+
- name: Run bandit (grade A — no MEDIUM/HIGH issues)
|
|
67
|
+
run: bandit -r doctools_m8 --severity-level medium -f json -o bandit-report.json
|
|
68
|
+
|
|
69
|
+
- name: Audit dependencies
|
|
70
|
+
run: |
|
|
71
|
+
pip install pip-audit
|
|
72
|
+
pip install -e .
|
|
73
|
+
pip-audit
|
|
74
|
+
|
|
75
|
+
- name: Upload bandit report
|
|
76
|
+
if: always()
|
|
77
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
78
|
+
with:
|
|
79
|
+
name: bandit-security-report
|
|
80
|
+
path: bandit-report.json
|
|
81
|
+
|
|
82
|
+
test:
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
strategy:
|
|
85
|
+
fail-fast: false
|
|
86
|
+
matrix:
|
|
87
|
+
python-version: ["3.12", "3.13", "3.14"]
|
|
88
|
+
|
|
89
|
+
steps:
|
|
90
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
91
|
+
|
|
92
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
93
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
94
|
+
with:
|
|
95
|
+
python-version: ${{ matrix.python-version }}
|
|
96
|
+
cache: "pip"
|
|
97
|
+
|
|
98
|
+
- name: Install dependencies
|
|
99
|
+
run: pip install -e ".[test,dev,pdf]" build
|
|
100
|
+
|
|
101
|
+
- name: Run tests
|
|
102
|
+
run: pytest --cov-fail-under=100
|
|
103
|
+
|
|
104
|
+
- name: Upload coverage to Codecov
|
|
105
|
+
if: matrix.python-version == '3.12' && github.actor != 'dependabot[bot]'
|
|
106
|
+
uses: codecov/codecov-action@0b35c9ecc4f0529d0eb674914510c22f85b196b4 # v7.1.0
|
|
107
|
+
with:
|
|
108
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
109
|
+
files: coverage.xml
|
|
110
|
+
verbose: true
|
|
111
|
+
|
|
112
|
+
- name: Upload coverage to Codacy
|
|
113
|
+
if: matrix.python-version == '3.12' && github.actor != 'dependabot[bot]'
|
|
114
|
+
uses: codacy/codacy-coverage-reporter-action@89d6c85cfafaec52c72b6c5e8b2878d33104c699 # v1
|
|
115
|
+
with:
|
|
116
|
+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
|
117
|
+
coverage-reports: coverage.xml
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
name: Upload Python Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
release-build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
16
|
+
|
|
17
|
+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.x"
|
|
20
|
+
|
|
21
|
+
- name: Build release distributions
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install build
|
|
24
|
+
python -m build
|
|
25
|
+
|
|
26
|
+
- name: Upload distributions
|
|
27
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
28
|
+
with:
|
|
29
|
+
name: release-dists
|
|
30
|
+
path: dist/
|
|
31
|
+
|
|
32
|
+
pypi-publish:
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
needs:
|
|
35
|
+
- release-build
|
|
36
|
+
permissions:
|
|
37
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
38
|
+
id-token: write
|
|
39
|
+
|
|
40
|
+
# Dedicated environments with protections for publishing are strongly recommended.
|
|
41
|
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
|
|
42
|
+
environment:
|
|
43
|
+
name: pypi
|
|
44
|
+
url: https://pypi.org/project/doctools-m8/${{ github.event.release.name }}
|
|
45
|
+
|
|
46
|
+
steps:
|
|
47
|
+
- name: Retrieve release distributions
|
|
48
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
49
|
+
with:
|
|
50
|
+
name: release-dists
|
|
51
|
+
path: dist/
|
|
52
|
+
|
|
53
|
+
- name: Publish release distributions to PyPI
|
|
54
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # release/v1
|
|
55
|
+
|
|
56
|
+
sbom:
|
|
57
|
+
name: Generate & attach SBOM
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
needs:
|
|
60
|
+
- release-build
|
|
61
|
+
permissions:
|
|
62
|
+
contents: write
|
|
63
|
+
id-token: write
|
|
64
|
+
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
67
|
+
|
|
68
|
+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
69
|
+
with:
|
|
70
|
+
python-version: "3.x"
|
|
71
|
+
|
|
72
|
+
- name: Install package
|
|
73
|
+
run: pip install -e ".[pdf]"
|
|
74
|
+
|
|
75
|
+
- uses: anchore/sbom-action@3ad7283483fc7af8ff2b4ea19663c2d5ca935e26 # v0.24.2
|
|
76
|
+
with:
|
|
77
|
+
artifact-name: doctools-m8-${{ github.event.release.tag_name }}.sbom.spdx.json
|
|
78
|
+
format: spdx-json
|
|
79
|
+
upload-release-assets: true
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
title = "doctools-m8 gitleaks config"
|
|
2
|
+
|
|
3
|
+
[extend]
|
|
4
|
+
useDefault = true
|
|
5
|
+
|
|
6
|
+
[allowlist]
|
|
7
|
+
description = "Project-wide allowlist"
|
|
8
|
+
paths = [
|
|
9
|
+
# Test fixtures may contain deterministic low-entropy test values
|
|
10
|
+
'''tests/''',
|
|
11
|
+
]
|
|
12
|
+
# Add SHAs of any prior accidental secret commits here after rotation:
|
|
13
|
+
# commits = [
|
|
14
|
+
# "abc123def456", # description of what was rotated and when
|
|
15
|
+
# ]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
# markdownlint configuration, also consumed by Codacy's markdownlint engine when
|
|
3
|
+
# the repository is set to use its own configuration files.
|
|
4
|
+
#
|
|
5
|
+
# Scope note: a config file supplies markdownlint's *defaults* for every rule it
|
|
6
|
+
# does not mention, so this file deliberately restates the rule this repository
|
|
7
|
+
# already does not enforce (MD013).
|
|
8
|
+
#
|
|
9
|
+
# Fleet baseline (A34): every repo with a CHANGELOG.md carries this MD024
|
|
10
|
+
# override, worded identically, so Codacy's markdownlint engine does not fail
|
|
11
|
+
# on the Keep a Changelog format. See fastapi-m8's `.markdownlint.yaml` for the
|
|
12
|
+
# canonical rationale text this is copied from.
|
|
13
|
+
|
|
14
|
+
# MD024/no-duplicate-heading — restrict to sibling headings.
|
|
15
|
+
#
|
|
16
|
+
# CHANGELOG.md follows Keep a Changelog, where every release section repeats the
|
|
17
|
+
# same subsection names (### Added / ### Changed / ### Fixed …). Under the
|
|
18
|
+
# default setting that makes each release after the first a stack of
|
|
19
|
+
# duplicate-heading errors, purely as a function of how many releases the file
|
|
20
|
+
# records. The duplication is the format, not a defect, and renaming the
|
|
21
|
+
# sections to be unique would break the convention every reader relies on.
|
|
22
|
+
#
|
|
23
|
+
# siblings_only flags a duplicate only when it shares a parent heading, so
|
|
24
|
+
# "### Added" under two different `## [x.y.z]` releases both pass, while two
|
|
25
|
+
# "### Added" blocks inside one release — a real editing mistake — still fail.
|
|
26
|
+
MD024:
|
|
27
|
+
siblings_only: true
|
|
28
|
+
|
|
29
|
+
# MD013/line-length — off (A34, 2026-08-15: was previously omitted from this
|
|
30
|
+
# file, leaving README.md's 5 over-80-column lines failing Codacy). README.md
|
|
31
|
+
# wraps prose for readability rather than to a fixed column. Python line length
|
|
32
|
+
# is enforced separately, by ruff.
|
|
33
|
+
MD013: false
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project adheres
|
|
5
|
+
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-10-18
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Repository scaffold: hatchling packaging, empty `doctools_m8` package with
|
|
12
|
+
`__version__`, ruff / mypy strict / bandit / pip-audit / pytest (100%
|
|
13
|
+
coverage) CI, PyPI Trusted Publishing release workflow with an SPDX SBOM
|
|
14
|
+
attached to the GitHub Release, Dependabot, Codacy and gitleaks
|
|
15
|
+
configuration. Licensed Apache-2.0. Core dependencies are `pydantic` only;
|
|
16
|
+
`pdf`, `sandbox`, `provenance` and `docling` extras are declared as
|
|
17
|
+
placeholders for later waves.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: doctools-m8
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Media-neutral document toolkit: models, revisions, the versioned artifact envelope, the PDF/plain-text parsers, the parser sandbox supervisor and the provenance verifier.
|
|
5
|
+
Author-email: Eli Serra <e.serra173@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Keywords: chunking,documents,ocr,pdf,provenance,sandbox
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
15
|
+
Classifier: Typing :: Typed
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Requires-Dist: pydantic>=2
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: bandit>=1.8.0; extra == 'dev'
|
|
20
|
+
Requires-Dist: mypy>=1.14.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: ruff>=0.9.0; extra == 'dev'
|
|
22
|
+
Provides-Extra: docling
|
|
23
|
+
Provides-Extra: pdf
|
|
24
|
+
Requires-Dist: pypdfium2>=4; extra == 'pdf'
|
|
25
|
+
Provides-Extra: provenance
|
|
26
|
+
Requires-Dist: ai-sdk-m8[jobcontext]; extra == 'provenance'
|
|
27
|
+
Provides-Extra: sandbox
|
|
28
|
+
Requires-Dist: ai-sdk-m8[jobcontext]; extra == 'sandbox'
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: coverage>=7.0; extra == 'test'
|
|
31
|
+
Requires-Dist: pytest-cov>=6.0; extra == 'test'
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
33
|
+
Requires-Dist: pyyaml>=6.0; extra == 'test'
|
|
34
|
+
Requires-Dist: types-pyyaml; extra == 'test'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# doctools-m8
|
|
38
|
+
|
|
39
|
+
Media-neutral document toolkit: models and protocols, revision identities,
|
|
40
|
+
the versioned and integrity-checked artifact envelope with a bounded
|
|
41
|
+
incremental reader, the PDF and plain-text parsers, the parser sandbox
|
|
42
|
+
supervisor (invocations, private execution tree, attestation) and the
|
|
43
|
+
provenance verifier for the sandbox-attestation and gateway-receipt chain.
|
|
44
|
+
|
|
45
|
+
> Status: scaffold. The package imports and exposes `__version__` only; the
|
|
46
|
+
> models, envelope, parsers, sandbox supervisor and verifier land in later
|
|
47
|
+
> releases.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install doctools-m8
|
|
53
|
+
# PDF parsing
|
|
54
|
+
pip install "doctools-m8[pdf]"
|
|
55
|
+
# the parser sandbox supervisor
|
|
56
|
+
pip install "doctools-m8[sandbox]"
|
|
57
|
+
# the provenance verifier
|
|
58
|
+
pip install "doctools-m8[provenance]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The core package depends on Pydantic v2 only, and `media-service-m8` installs
|
|
62
|
+
only the core. No network, database, credential or media dependency is
|
|
63
|
+
carried anywhere in this package.
|
|
64
|
+
|
|
65
|
+
## Development
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install -e ".[test,dev,pdf]"
|
|
69
|
+
ruff format --check . && ruff check .
|
|
70
|
+
mypy doctools_m8
|
|
71
|
+
bandit -r doctools_m8 --severity-level medium
|
|
72
|
+
pytest --cov-fail-under=100
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# doctools-m8
|
|
2
|
+
|
|
3
|
+
Media-neutral document toolkit: models and protocols, revision identities,
|
|
4
|
+
the versioned and integrity-checked artifact envelope with a bounded
|
|
5
|
+
incremental reader, the PDF and plain-text parsers, the parser sandbox
|
|
6
|
+
supervisor (invocations, private execution tree, attestation) and the
|
|
7
|
+
provenance verifier for the sandbox-attestation and gateway-receipt chain.
|
|
8
|
+
|
|
9
|
+
> Status: scaffold. The package imports and exposes `__version__` only; the
|
|
10
|
+
> models, envelope, parsers, sandbox supervisor and verifier land in later
|
|
11
|
+
> releases.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install doctools-m8
|
|
17
|
+
# PDF parsing
|
|
18
|
+
pip install "doctools-m8[pdf]"
|
|
19
|
+
# the parser sandbox supervisor
|
|
20
|
+
pip install "doctools-m8[sandbox]"
|
|
21
|
+
# the provenance verifier
|
|
22
|
+
pip install "doctools-m8[provenance]"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The core package depends on Pydantic v2 only, and `media-service-m8` installs
|
|
26
|
+
only the core. No network, database, credential or media dependency is
|
|
27
|
+
carried anywhere in this package.
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install -e ".[test,dev,pdf]"
|
|
33
|
+
ruff format --check . && ruff check .
|
|
34
|
+
mypy doctools_m8
|
|
35
|
+
bandit -r doctools_m8 --severity-level medium
|
|
36
|
+
pytest --cov-fail-under=100
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## License
|
|
40
|
+
|
|
41
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# doctools-m8
|
|
2
|
+
|
|
3
|
+
## Layer
|
|
4
|
+
|
|
5
|
+
Platform (document-processing library).
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
Provide a media-neutral document toolkit: document models and protocols,
|
|
10
|
+
revision identities, a versioned and integrity-checked artifact envelope with a
|
|
11
|
+
bounded incremental reader, PDF and plain-text parsers, the parser sandbox
|
|
12
|
+
supervisor, the provenance verifier, and planning for OCR, chunking, and
|
|
13
|
+
extraction.
|
|
14
|
+
|
|
15
|
+
The package is published to PyPI as `doctools-m8` and imported as
|
|
16
|
+
`doctools_m8`. It is licensed under Apache-2.0.
|
|
17
|
+
|
|
18
|
+
## Repository boundaries
|
|
19
|
+
|
|
20
|
+
- The core is pure Python with Pydantic v2 as its only dependency. Native and
|
|
21
|
+
optional parsers live behind extras (`pdf`, `sandbox`, `provenance`,
|
|
22
|
+
`docling`).
|
|
23
|
+
- The `sandbox` and `provenance` extras use `ai-sdk-m8[jobcontext]` for signing
|
|
24
|
+
and verification. This library implements no cryptography of its own.
|
|
25
|
+
- No network, database, credential, object-storage, or media-service
|
|
26
|
+
dependency anywhere. PostgreSQL, pgvector, Vault, media ACLs, and network
|
|
27
|
+
access are out of scope.
|
|
28
|
+
- Where the sandbox runs and where the verifier is called belong to the
|
|
29
|
+
consuming service; this library owns their semantics only.
|
|
30
|
+
|
|
31
|
+
These are repository architecture constraints. If a requested change appears to
|
|
32
|
+
break one, record the decision in the workspace context when that optional
|
|
33
|
+
enhancement is available and confirm the exception before proceeding.
|
|
34
|
+
|
|
35
|
+
## Standalone authority
|
|
36
|
+
|
|
37
|
+
This file, `pyproject.toml`, repository documentation, and existing CI are the
|
|
38
|
+
authoritative local context. A verified nearest workspace may optionally add
|
|
39
|
+
launcher-selected policies and tasks; its absence is a successful standalone
|
|
40
|
+
condition and does not make a parent workspace necessary.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
`doctools-m8` is a media-neutral document toolkit. The core package holds no
|
|
4
|
+
network, database or credential dependency; it never calls out and reads no
|
|
5
|
+
settings or environment variables. The `[sandbox]` extra runs untrusted parser
|
|
6
|
+
output inside a supervised, custody-tracked process boundary — see the
|
|
7
|
+
project's sandbox invocation contract for its isolation guarantees.
|
|
8
|
+
|
|
9
|
+
## Supply chain
|
|
10
|
+
|
|
11
|
+
- Releases are published to PyPI only through Trusted Publishing (OIDC); no
|
|
12
|
+
upload token is stored anywhere.
|
|
13
|
+
- Every release attaches a Software Package Data Exchange (SPDX) JSON software
|
|
14
|
+
bill of materials (SBOM) to its GitHub Release.
|
|
15
|
+
- CI actions are pinned by full Secure Hash Algorithm (SHA) commit hash and
|
|
16
|
+
run with read-only default permissions.
|
|
17
|
+
- `pip-audit` and `bandit` run on every pull request.
|
|
18
|
+
|
|
19
|
+
## Reporting a vulnerability
|
|
20
|
+
|
|
21
|
+
Report security vulnerabilities privately through GitHub's **Security** tab on
|
|
22
|
+
this repository — **"Report a vulnerability"** — which opens a private
|
|
23
|
+
security advisory visible only to the maintainers. Do not open a public GitHub
|
|
24
|
+
issue for vulnerabilities. Expected response within 48 h.
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "doctools-m8"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Media-neutral document toolkit: models, revisions, the versioned artifact envelope, the PDF/plain-text parsers, the parser sandbox supervisor and the provenance verifier."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "Apache-2.0"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "Eli Serra", email = "e.serra173@gmail.com" }]
|
|
13
|
+
requires-python = ">=3.12"
|
|
14
|
+
keywords = ["documents", "pdf", "sandbox", "provenance", "ocr", "chunking"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Topic :: Software Development :: Libraries",
|
|
22
|
+
"Typing :: Typed",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
dependencies = [
|
|
26
|
+
"pydantic>=2",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
# PdfiumParser / inspect().
|
|
31
|
+
pdf = ["pypdfium2>=4"]
|
|
32
|
+
# The parser sandbox supervisor: the C-03 signed-object implementation.
|
|
33
|
+
sandbox = ["ai-sdk-m8[jobcontext]"]
|
|
34
|
+
# T42a's provenance verifier: the same signed-object implementation.
|
|
35
|
+
provenance = ["ai-sdk-m8[jobcontext]"]
|
|
36
|
+
# Optional Docling parser (placeholder until T65).
|
|
37
|
+
docling = []
|
|
38
|
+
test = ["pytest>=8.0", "pytest-cov>=6.0", "coverage>=7.0", "pyyaml>=6.0",
|
|
39
|
+
"types-PyYAML"]
|
|
40
|
+
dev = ["ruff>=0.9.0", "mypy>=1.14.0", "bandit>=1.8.0"]
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["doctools_m8"]
|
|
44
|
+
|
|
45
|
+
[tool.ruff]
|
|
46
|
+
line-length = 88
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = ["E", "F", "I", "W", "UP", "C90", "D"]
|
|
50
|
+
ignore = [
|
|
51
|
+
"E501",
|
|
52
|
+
"D100", "D104", "D105", "D107",
|
|
53
|
+
"D203", "D211", "D212", "D215",
|
|
54
|
+
"D301", "D401", "D403", "D404", "D415", "D416", "D417",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[tool.ruff.lint.mccabe]
|
|
58
|
+
max-complexity = 10
|
|
59
|
+
|
|
60
|
+
[tool.ruff.lint.per-file-ignores]
|
|
61
|
+
"tests/**" = ["D"]
|
|
62
|
+
|
|
63
|
+
[tool.ruff.lint.isort]
|
|
64
|
+
known-first-party = ["doctools_m8"]
|
|
65
|
+
|
|
66
|
+
[tool.mypy]
|
|
67
|
+
python_version = "3.12"
|
|
68
|
+
strict = true
|
|
69
|
+
|
|
70
|
+
[tool.pytest.ini_options]
|
|
71
|
+
testpaths = ["tests"]
|
|
72
|
+
addopts = "--cov=doctools_m8 --cov-report=xml --cov-report=term-missing"
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""CI, release-workflow, licensing and static template policy checks."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
import yaml
|
|
10
|
+
|
|
11
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
12
|
+
WORKFLOWS = ROOT / ".github" / "workflows"
|
|
13
|
+
PIPY = WORKFLOWS / "PiPy.yml"
|
|
14
|
+
_USES = re.compile(r"uses:\s+([\w.-]+/[\w.-]+)@(\S+)")
|
|
15
|
+
_SHA = re.compile(r"^[0-9a-f]{40}$")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _load(path: Path) -> dict[str, Any]:
|
|
19
|
+
data: dict[str, Any] = yaml.safe_load(path.read_text(encoding="utf-8"))
|
|
20
|
+
return data
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_every_action_is_pinned_by_full_sha() -> None:
|
|
24
|
+
"""Third-party actions are pinned to a 40-hex commit SHA."""
|
|
25
|
+
refs = [m for p in WORKFLOWS.glob("*") for m in _USES.findall(p.read_text())]
|
|
26
|
+
assert refs
|
|
27
|
+
assert all(_SHA.match(ref) for _, ref in refs)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_workflows_default_to_read_only_permissions() -> None:
|
|
31
|
+
"""Every workflow declares workflow-level ``contents: read``."""
|
|
32
|
+
for path in WORKFLOWS.glob("*"):
|
|
33
|
+
assert _load(path)["permissions"] == {"contents": "read"}, path.name
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_release_workflow_has_no_pypi_token() -> None:
|
|
37
|
+
"""Trusted Publishing only: no token input anywhere."""
|
|
38
|
+
text = PIPY.read_text(encoding="utf-8")
|
|
39
|
+
assert "PYPI_API_TOKEN" not in text
|
|
40
|
+
assert "password:" not in text
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_release_publish_job_uses_oidc_and_environment() -> None:
|
|
44
|
+
"""Only the publish job gets ``id-token: write`` and a named environment."""
|
|
45
|
+
jobs = _load(PIPY)["jobs"]
|
|
46
|
+
assert jobs["pypi-publish"]["permissions"]["id-token"] == "write"
|
|
47
|
+
assert jobs["pypi-publish"]["environment"]["name"] == "pypi"
|
|
48
|
+
assert "id-token" not in jobs["release-build"].get("permissions", {})
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def test_release_workflow_triggers_on_published_release_only() -> None:
|
|
52
|
+
"""The release workflow runs on ``release: published`` and nothing else."""
|
|
53
|
+
wf: dict[Any, Any] = _load(PIPY)
|
|
54
|
+
triggers = wf.get("on") or wf.get(True)
|
|
55
|
+
assert triggers == {"release": {"types": ["published"]}}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_release_workflow_attaches_spdx_sbom() -> None:
|
|
59
|
+
"""An SPDX JSON SBOM is attached to the release."""
|
|
60
|
+
text = PIPY.read_text(encoding="utf-8")
|
|
61
|
+
assert "anchore/sbom-action" in text
|
|
62
|
+
assert "format: spdx-json" in text
|
|
63
|
+
assert "upload-release-assets: true" in text
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def test_markdownlint_keeps_md024_siblings_only() -> None:
|
|
67
|
+
"""The fleet MD024 override is present."""
|
|
68
|
+
cfg = _load(ROOT / ".markdownlint.yaml")
|
|
69
|
+
assert cfg["MD024"] == {"siblings_only": True}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_license_is_unmodified_apache_two_oh() -> None:
|
|
73
|
+
"""LICENSE is the stock Apache-2.0 text, no MIT remnant anywhere."""
|
|
74
|
+
text = (ROOT / "LICENSE").read_text(encoding="utf-8")
|
|
75
|
+
assert "Apache License" in text
|
|
76
|
+
assert "Version 2.0, January 2004" in text
|
|
77
|
+
assert "MIT" not in text
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_pyproject_declares_spdx_apache_license() -> None:
|
|
81
|
+
"""``pyproject.toml`` uses the SPDX expression, not a classifier (PEP 639)."""
|
|
82
|
+
text = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
|
|
83
|
+
assert 'license = "Apache-2.0"' in text
|
|
84
|
+
assert 'license-files = ["LICENSE"]' in text
|
|
85
|
+
assert "License ::" not in text
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def test_built_wheel_carries_apache_license_metadata(tmp_path: Path) -> None:
|
|
89
|
+
"""The built wheel's METADATA names the SPDX license and license file."""
|
|
90
|
+
subprocess.run(
|
|
91
|
+
[sys.executable, "-m", "build", "--wheel", "--outdir", str(tmp_path)],
|
|
92
|
+
cwd=ROOT,
|
|
93
|
+
check=True,
|
|
94
|
+
)
|
|
95
|
+
wheel = next(tmp_path.glob("*.whl"))
|
|
96
|
+
result = subprocess.run(
|
|
97
|
+
[sys.executable, "-m", "zipfile", "-e", str(wheel), str(tmp_path / "unpacked")],
|
|
98
|
+
check=True,
|
|
99
|
+
)
|
|
100
|
+
del result
|
|
101
|
+
metadata_dir = next((tmp_path / "unpacked").glob("*.dist-info"))
|
|
102
|
+
metadata = (metadata_dir / "METADATA").read_text(encoding="utf-8")
|
|
103
|
+
assert "License-Expression: Apache-2.0" in metadata
|
|
104
|
+
assert "License-File: LICENSE" in metadata
|
|
105
|
+
assert "MIT" not in metadata
|
|
106
|
+
assert (metadata_dir / "licenses" / "LICENSE").exists()
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_no_notice_file_present() -> None:
|
|
110
|
+
"""No third-party code is vendored, so no NOTICE file is carried."""
|
|
111
|
+
assert not (ROOT / "NOTICE").exists()
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def test_tracked_text_files_follow_template_rules() -> None:
|
|
115
|
+
"""UTF-8 without BOM, LF, final newline, no workspace paths."""
|
|
116
|
+
paths = [
|
|
117
|
+
*ROOT.glob("*.md"),
|
|
118
|
+
*ROOT.glob("*.toml"),
|
|
119
|
+
*ROOT.glob("*.yml"),
|
|
120
|
+
*ROOT.glob("*.yaml"),
|
|
121
|
+
*WORKFLOWS.glob("*"),
|
|
122
|
+
*(ROOT / ".github").glob("*.yml"),
|
|
123
|
+
*ROOT.glob(".*.yml"),
|
|
124
|
+
*ROOT.glob(".*.yaml"),
|
|
125
|
+
*ROOT.glob(".*.toml"),
|
|
126
|
+
]
|
|
127
|
+
forbidden = ("/workspace", "fa-workspace", "E:\\Dev", ".workspace/")
|
|
128
|
+
for path in paths:
|
|
129
|
+
raw = path.read_bytes()
|
|
130
|
+
assert not raw.startswith(b"\xef\xbb\xbf"), path
|
|
131
|
+
assert b"\r" not in raw, path
|
|
132
|
+
assert raw.endswith(b"\n"), path
|
|
133
|
+
text = raw.decode("utf-8")
|
|
134
|
+
if path.name in {"AGENTS.md", "CLAUDE.md", "REPOSITORY_CONTEXT.md"}:
|
|
135
|
+
continue
|
|
136
|
+
assert not any(f in text for f in forbidden), path
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Package import, version parity and core-dependency boundary checks."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import subprocess
|
|
5
|
+
import sys
|
|
6
|
+
import tomllib
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
import doctools_m8
|
|
10
|
+
|
|
11
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_package_imports_and_exposes_version() -> None:
|
|
15
|
+
"""The empty package imports and exports only ``__version__``."""
|
|
16
|
+
assert doctools_m8.__all__ == ["__version__"]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_version_matches_pyproject() -> None:
|
|
20
|
+
"""``__version__`` equals the pyproject literal."""
|
|
21
|
+
data = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))
|
|
22
|
+
assert data["project"]["version"] == doctools_m8.__version__
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_changelog_has_current_version_heading() -> None:
|
|
26
|
+
"""CHANGELOG.md carries a Keep a Changelog heading for the version."""
|
|
27
|
+
text = (ROOT / "CHANGELOG.md").read_text(encoding="utf-8")
|
|
28
|
+
pattern = (
|
|
29
|
+
rf"^## \[{re.escape(doctools_m8.__version__)}\] - \d{{4}}-\d{{2}}-\d{{2}}$"
|
|
30
|
+
)
|
|
31
|
+
assert re.search(pattern, text, re.MULTILINE)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_core_dependencies_are_pydantic_only() -> None:
|
|
35
|
+
"""The core wheel depends on pydantic alone."""
|
|
36
|
+
data = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))
|
|
37
|
+
names = {re.split(r"[<>=!~ ]", d)[0] for d in data["project"]["dependencies"]}
|
|
38
|
+
assert names == {"pydantic"}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_extras_match_the_scaffold_contract() -> None:
|
|
42
|
+
"""Each extra carries exactly the dependency set T7 ratifies."""
|
|
43
|
+
data = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))
|
|
44
|
+
extras = data["project"]["optional-dependencies"]
|
|
45
|
+
|
|
46
|
+
def names(extra: str) -> set[str]:
|
|
47
|
+
return {re.split(r"[<>=!~ ]", d)[0] for d in extras[extra]}
|
|
48
|
+
|
|
49
|
+
assert names("pdf") == {"pypdfium2"}
|
|
50
|
+
assert extras["sandbox"] == ["ai-sdk-m8[jobcontext]"]
|
|
51
|
+
assert extras["provenance"] == ["ai-sdk-m8[jobcontext]"]
|
|
52
|
+
assert extras["docling"] == []
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_core_wheel_has_no_native_dependency_or_optional_import() -> None:
|
|
56
|
+
"""A clean interpreter can import the core package without extras
|
|
57
|
+
installed, and it never imports ``cryptography`` or ``ai_sdk_m8``."""
|
|
58
|
+
script = (
|
|
59
|
+
"import sys, doctools_m8 # noqa: F401\n"
|
|
60
|
+
"assert 'cryptography' not in sys.modules\n"
|
|
61
|
+
"assert 'ai_sdk_m8' not in sys.modules\n"
|
|
62
|
+
"assert 'pypdfium2' not in sys.modules\n"
|
|
63
|
+
)
|
|
64
|
+
subprocess.run([sys.executable, "-I", "-c", script], cwd=ROOT, check=True)
|