model-ledger 0.5.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.
Files changed (127) hide show
  1. model_ledger-0.5.0/.github/ISSUE_TEMPLATE/bug-report.md +20 -0
  2. model_ledger-0.5.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  3. model_ledger-0.5.0/.github/workflows/gitleaks.yml +23 -0
  4. model_ledger-0.5.0/.github/workflows/release.yml +55 -0
  5. model_ledger-0.5.0/.gitignore +30 -0
  6. model_ledger-0.5.0/.gitleaks.toml +46 -0
  7. model_ledger-0.5.0/.pre-commit-config.yaml +7 -0
  8. model_ledger-0.5.0/CHANGELOG.md +67 -0
  9. model_ledger-0.5.0/CLAUDE.md +60 -0
  10. model_ledger-0.5.0/CODEOWNERS +2 -0
  11. model_ledger-0.5.0/CONTRIBUTING.md +53 -0
  12. model_ledger-0.5.0/GOVERNANCE.md +1 -0
  13. model_ledger-0.5.0/LICENSE +191 -0
  14. model_ledger-0.5.0/PKG-INFO +316 -0
  15. model_ledger-0.5.0/README.md +261 -0
  16. model_ledger-0.5.0/docs/plans/2026-04-01-v040-datanode-graph.md +713 -0
  17. model_ledger-0.5.0/docs/technical-design.md +179 -0
  18. model_ledger-0.5.0/docs/what-and-why.md +157 -0
  19. model_ledger-0.5.0/pyproject.toml +108 -0
  20. model_ledger-0.5.0/renovate.json +4 -0
  21. model_ledger-0.5.0/src/model_ledger/__init__.py +125 -0
  22. model_ledger-0.5.0/src/model_ledger/adapters/__init__.py +1 -0
  23. model_ledger-0.5.0/src/model_ledger/adapters/cron.py +72 -0
  24. model_ledger-0.5.0/src/model_ledger/adapters/sql.py +164 -0
  25. model_ledger-0.5.0/src/model_ledger/adapters/tables.py +91 -0
  26. model_ledger-0.5.0/src/model_ledger/backends/__init__.py +0 -0
  27. model_ledger-0.5.0/src/model_ledger/backends/ledger_memory.py +97 -0
  28. model_ledger-0.5.0/src/model_ledger/backends/ledger_protocol.py +31 -0
  29. model_ledger-0.5.0/src/model_ledger/backends/memory.py +91 -0
  30. model_ledger-0.5.0/src/model_ledger/backends/protocol.py +20 -0
  31. model_ledger-0.5.0/src/model_ledger/backends/snowflake.py +399 -0
  32. model_ledger-0.5.0/src/model_ledger/backends/sqlite.py +110 -0
  33. model_ledger-0.5.0/src/model_ledger/backends/sqlite_ledger.py +222 -0
  34. model_ledger-0.5.0/src/model_ledger/cli/__init__.py +3 -0
  35. model_ledger-0.5.0/src/model_ledger/cli/app.py +354 -0
  36. model_ledger-0.5.0/src/model_ledger/connectors/__init__.py +12 -0
  37. model_ledger-0.5.0/src/model_ledger/connectors/github.py +111 -0
  38. model_ledger-0.5.0/src/model_ledger/connectors/rest.py +138 -0
  39. model_ledger-0.5.0/src/model_ledger/connectors/sql.py +231 -0
  40. model_ledger-0.5.0/src/model_ledger/core/__init__.py +0 -0
  41. model_ledger-0.5.0/src/model_ledger/core/enums.py +43 -0
  42. model_ledger-0.5.0/src/model_ledger/core/exceptions.py +50 -0
  43. model_ledger-0.5.0/src/model_ledger/core/ledger_models.py +75 -0
  44. model_ledger-0.5.0/src/model_ledger/core/models.py +280 -0
  45. model_ledger-0.5.0/src/model_ledger/core/observations.py +71 -0
  46. model_ledger-0.5.0/src/model_ledger/datasets/__init__.py +23 -0
  47. model_ledger-0.5.0/src/model_ledger/datasets/samples.py +286 -0
  48. model_ledger-0.5.0/src/model_ledger/export/__init__.py +3 -0
  49. model_ledger-0.5.0/src/model_ledger/export/audit_pack.py +378 -0
  50. model_ledger-0.5.0/src/model_ledger/export/templates.py +252 -0
  51. model_ledger-0.5.0/src/model_ledger/graph/__init__.py +4 -0
  52. model_ledger-0.5.0/src/model_ledger/graph/models.py +64 -0
  53. model_ledger-0.5.0/src/model_ledger/graph/protocol.py +9 -0
  54. model_ledger-0.5.0/src/model_ledger/introspect/__init__.py +22 -0
  55. model_ledger-0.5.0/src/model_ledger/introspect/lightgbm.py +56 -0
  56. model_ledger-0.5.0/src/model_ledger/introspect/models.py +58 -0
  57. model_ledger-0.5.0/src/model_ledger/introspect/protocol.py +17 -0
  58. model_ledger-0.5.0/src/model_ledger/introspect/registry.py +78 -0
  59. model_ledger-0.5.0/src/model_ledger/introspect/sklearn.py +76 -0
  60. model_ledger-0.5.0/src/model_ledger/introspect/xgboost.py +52 -0
  61. model_ledger-0.5.0/src/model_ledger/py.typed +0 -0
  62. model_ledger-0.5.0/src/model_ledger/scanner/__init__.py +23 -0
  63. model_ledger-0.5.0/src/model_ledger/scanner/connection.py +18 -0
  64. model_ledger-0.5.0/src/model_ledger/scanner/orchestrator.py +164 -0
  65. model_ledger-0.5.0/src/model_ledger/scanner/protocol.py +39 -0
  66. model_ledger-0.5.0/src/model_ledger/scanner/registry.py +59 -0
  67. model_ledger-0.5.0/src/model_ledger/scanner/report.py +26 -0
  68. model_ledger-0.5.0/src/model_ledger/sdk/__init__.py +0 -0
  69. model_ledger-0.5.0/src/model_ledger/sdk/draft_version.py +183 -0
  70. model_ledger-0.5.0/src/model_ledger/sdk/feedback.py +38 -0
  71. model_ledger-0.5.0/src/model_ledger/sdk/inventory.py +189 -0
  72. model_ledger-0.5.0/src/model_ledger/sdk/ledger.py +524 -0
  73. model_ledger-0.5.0/src/model_ledger/validate/__init__.py +0 -0
  74. model_ledger-0.5.0/src/model_ledger/validate/engine.py +74 -0
  75. model_ledger-0.5.0/src/model_ledger/validate/profiles/__init__.py +0 -0
  76. model_ledger-0.5.0/src/model_ledger/validate/profiles/eu_ai_act.py +177 -0
  77. model_ledger-0.5.0/src/model_ledger/validate/profiles/nist_ai_rmf.py +225 -0
  78. model_ledger-0.5.0/src/model_ledger/validate/profiles/sr_11_7.py +109 -0
  79. model_ledger-0.5.0/tests/__init__.py +0 -0
  80. model_ledger-0.5.0/tests/test_adapters/__init__.py +0 -0
  81. model_ledger-0.5.0/tests/test_adapters/test_sql.py +82 -0
  82. model_ledger-0.5.0/tests/test_adapters/test_tables.py +57 -0
  83. model_ledger-0.5.0/tests/test_backends/__init__.py +0 -0
  84. model_ledger-0.5.0/tests/test_backends/test_ledger_memory.py +194 -0
  85. model_ledger-0.5.0/tests/test_backends/test_snowflake_ledger.py +215 -0
  86. model_ledger-0.5.0/tests/test_backends/test_sqlite_ledger.py +175 -0
  87. model_ledger-0.5.0/tests/test_cli/__init__.py +0 -0
  88. model_ledger-0.5.0/tests/test_cli/test_app.py +84 -0
  89. model_ledger-0.5.0/tests/test_connectors/__init__.py +0 -0
  90. model_ledger-0.5.0/tests/test_connectors/test_github_connector.py +112 -0
  91. model_ledger-0.5.0/tests/test_connectors/test_rest_connector.py +99 -0
  92. model_ledger-0.5.0/tests/test_connectors/test_sql_connector.py +243 -0
  93. model_ledger-0.5.0/tests/test_core/__init__.py +0 -0
  94. model_ledger-0.5.0/tests/test_core/test_backends.py +144 -0
  95. model_ledger-0.5.0/tests/test_core/test_enums.py +40 -0
  96. model_ledger-0.5.0/tests/test_core/test_exceptions.py +69 -0
  97. model_ledger-0.5.0/tests/test_core/test_ledger_models.py +122 -0
  98. model_ledger-0.5.0/tests/test_core/test_models.py +203 -0
  99. model_ledger-0.5.0/tests/test_core/test_observation_backend.py +87 -0
  100. model_ledger-0.5.0/tests/test_core/test_observations.py +81 -0
  101. model_ledger-0.5.0/tests/test_datasets.py +84 -0
  102. model_ledger-0.5.0/tests/test_export/__init__.py +0 -0
  103. model_ledger-0.5.0/tests/test_export/test_audit_pack.py +69 -0
  104. model_ledger-0.5.0/tests/test_graph/__init__.py +0 -0
  105. model_ledger-0.5.0/tests/test_graph/test_ledger_graph.py +143 -0
  106. model_ledger-0.5.0/tests/test_graph/test_models.py +70 -0
  107. model_ledger-0.5.0/tests/test_introspect/__init__.py +0 -0
  108. model_ledger-0.5.0/tests/test_introspect/test_lightgbm.py +53 -0
  109. model_ledger-0.5.0/tests/test_introspect/test_models.py +96 -0
  110. model_ledger-0.5.0/tests/test_introspect/test_registry.py +82 -0
  111. model_ledger-0.5.0/tests/test_introspect/test_sklearn.py +71 -0
  112. model_ledger-0.5.0/tests/test_introspect/test_xgboost.py +40 -0
  113. model_ledger-0.5.0/tests/test_scanner/__init__.py +0 -0
  114. model_ledger-0.5.0/tests/test_scanner/test_connection.py +33 -0
  115. model_ledger-0.5.0/tests/test_scanner/test_orchestrator.py +354 -0
  116. model_ledger-0.5.0/tests/test_scanner/test_protocol.py +136 -0
  117. model_ledger-0.5.0/tests/test_scanner/test_registry.py +67 -0
  118. model_ledger-0.5.0/tests/test_sdk/__init__.py +0 -0
  119. model_ledger-0.5.0/tests/test_sdk/test_feedback.py +66 -0
  120. model_ledger-0.5.0/tests/test_sdk/test_groups.py +112 -0
  121. model_ledger-0.5.0/tests/test_sdk/test_inventory.py +243 -0
  122. model_ledger-0.5.0/tests/test_sdk/test_ledger.py +281 -0
  123. model_ledger-0.5.0/tests/test_sdk/test_ledger_constructors.py +53 -0
  124. model_ledger-0.5.0/tests/test_validate/__init__.py +0 -0
  125. model_ledger-0.5.0/tests/test_validate/test_eu_ai_act.py +168 -0
  126. model_ledger-0.5.0/tests/test_validate/test_nist_ai_rmf.py +139 -0
  127. model_ledger-0.5.0/tests/test_validate/test_sr_11_7.py +171 -0
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug in model-ledger
4
+ labels: bug
5
+ assignees: vigneshnarayanaswamy
6
+ ---
7
+
8
+ **Describe the bug**
9
+ A clear and concise description of what the bug is.
10
+
11
+ **To Reproduce**
12
+ Steps or code to reproduce the behavior.
13
+
14
+ **Expected behavior**
15
+ What you expected to happen.
16
+
17
+ **Environment**
18
+ - Python version:
19
+ - model-ledger version:
20
+ - OS:
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Questions & Support
4
+ url: https://discord.gg/block-opensource
5
+ about: Ask questions and get help from the community
@@ -0,0 +1,23 @@
1
+ # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2
+ name: Gitleaks
3
+
4
+ on:
5
+ pull_request:
6
+ push:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ scan:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
14
+ with:
15
+ fetch-depth: 0
16
+
17
+ - name: Install gitleaks
18
+ run: |
19
+ curl -sSfL https://github.com/gitleaks/gitleaks/releases/download/v8.24.3/gitleaks_8.24.3_linux_x64.tar.gz | tar xz
20
+ sudo mv gitleaks /usr/local/bin/
21
+
22
+ - name: Run gitleaks
23
+ run: gitleaks detect --config .gitleaks.toml --verbose
@@ -0,0 +1,55 @@
1
+ # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2
+ name: Release
3
+
4
+ on:
5
+ release:
6
+ types: [published]
7
+
8
+ jobs:
9
+ publish:
10
+ permissions:
11
+ id-token: write
12
+ contents: write
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
16
+
17
+ - name: Pull current version from pyproject.toml
18
+ id: get_version
19
+ run: |
20
+ echo "VERSION=$(grep -m 1 'version =' "pyproject.toml" | awk -F'"' '{print $2}')" >> $GITHUB_ENV
21
+
22
+ - name: Extract tag version
23
+ id: extract_tag
24
+ run: |
25
+ TAG_VERSION=$(echo "${{ github.event.release.tag_name }}" | sed -E 's/v(.*)/\1/')
26
+ echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
27
+
28
+ - name: Confirm tag matches version from pyproject.toml
29
+ id: check_tag
30
+ run: |
31
+ if [ "${{ env.TAG_VERSION }}" != "${{ env.VERSION }}" ]; then
32
+ echo "::error::Tag version (${{ env.TAG_VERSION }}) does not match version in pyproject.toml (${{ env.VERSION }})."
33
+ exit 1
34
+ fi
35
+
36
+ - name: Install the latest version of uv
37
+ uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
38
+ with:
39
+ version: "latest"
40
+ enable-cache: true
41
+
42
+ - name: Install Python
43
+ run: uv python install 3.12
44
+
45
+ - name: Build Package
46
+ run: uv build
47
+
48
+ - name: Upload to GitHub Release
49
+ env:
50
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
+ run: |
52
+ gh release upload ${{ github.event.release.tag_name }} dist/*
53
+
54
+ - name: Publish package to PyPI
55
+ uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
@@ -0,0 +1,30 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .venv/
10
+ venv/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .pytest_cache/
14
+ .coverage
15
+ htmlcov/
16
+ *.db
17
+ *.sqlite
18
+ *.sqlite3
19
+ .env
20
+ .env.local
21
+ .DS_Store
22
+
23
+ # Lock file (contains index URLs from local environment)
24
+ uv.lock
25
+
26
+ # Internal design docs (contain org-specific context)
27
+ docs/superpowers/
28
+
29
+ # Detailed internal blocklist (committed config is .gitleaks.toml)
30
+ .gitleaks-internal.toml
@@ -0,0 +1,46 @@
1
+ # Gitleaks config for OSS boundary enforcement
2
+ # Blocks internal infrastructure patterns from leaking into the public repo.
3
+ # For detailed internal blocklists, see .gitleaks-internal.toml (gitignored).
4
+
5
+ title = "model-ledger OSS boundary rules"
6
+
7
+ # Internal corporate hostnames
8
+ [[rules]]
9
+ id = "internal-hostname"
10
+ description = "Internal corporate hostname"
11
+ regex = '''[a-z0-9.-]+\.sqprod\.co'''
12
+ keywords = ["sqprod"]
13
+
14
+ # Internal Artifactory / PyPI mirror
15
+ [[rules]]
16
+ id = "internal-artifactory"
17
+ description = "Internal Artifactory hostname"
18
+ regex = '''artifactory\.global\.square'''
19
+ keywords = ["artifactory.global"]
20
+
21
+ [[rules]]
22
+ id = "internal-pypi-mirror"
23
+ description = "Internal PyPI mirror"
24
+ regex = '''block-artifacts\.com'''
25
+ keywords = ["block-artifacts"]
26
+
27
+ # Corporate email in source (OK in pyproject.toml authors, git config)
28
+ [[rules]]
29
+ id = "corporate-email"
30
+ description = "Corporate email domain in source files"
31
+ regex = '''@squareup\.com'''
32
+ keywords = ["squareup.com"]
33
+
34
+ # Internal GNS hostname
35
+ [[rules]]
36
+ id = "internal-gns"
37
+ description = "Internal GNS hostname"
38
+ regex = '''gns\.square'''
39
+ keywords = ["gns.square"]
40
+
41
+ # Global allowlist — files where matches are expected
42
+ [allowlist]
43
+ paths = [
44
+ '''\.gitleaks\.toml$''',
45
+ '''\.gitleaks-internal\.toml$''',
46
+ ]
@@ -0,0 +1,7 @@
1
+ repos:
2
+ - repo: https://github.com/gitleaks/gitleaks
3
+ rev: v8.24.3
4
+ hooks:
5
+ - id: gitleaks
6
+ # Runs committed config; for internal blocklist, run manually:
7
+ # gitleaks detect --config .gitleaks-internal.toml
@@ -0,0 +1,67 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ - feat: `register_group()` — register governed model groups with member linking
6
+ - feat: `members()` — list all models that belong to a group
7
+ - feat: `groups()` — find all groups a model belongs to
8
+
9
+ ## v0.5.0
10
+
11
+ - feat: `Ledger.from_sqlite(path)` — persistent SQLite backend, zero dependencies
12
+ - feat: `Ledger.from_snowflake(conn, schema)` — persistent Snowflake backend
13
+ - feat: `sql_connector()` — config-driven SQL-based model discovery
14
+ - feat: `rest_connector()` — config-driven REST API model discovery
15
+ - feat: `github_connector()` — discover models from config files in GitHub repos
16
+ - feat: Connector factories return `SourceConnector` instances for composability
17
+
18
+ ## Unreleased
19
+
20
+ - fix: deduplicate `ModelNotFoundError` — use canonical class from `core.exceptions`
21
+ - test: add coverage for `'value' AS model_name` extraction pattern
22
+
23
+ ## v0.4.8
24
+
25
+ - fix: exclude volatile timestamps from content hash dedup
26
+
27
+ ## v0.4.7
28
+
29
+ - perf: cache nodes from `add()`, skip existing edges in `connect()`
30
+
31
+ ## v0.4.6
32
+
33
+ - perf: skip per-model backend queries when cache is warm, store content hash
34
+
35
+ ## v0.4.5
36
+
37
+ - perf: content-hash dedup and bulk preload in `add()`
38
+
39
+ ## v0.4.4
40
+
41
+ - fix: extract `model_name` from SELECT aliases and add pipeline input ports
42
+
43
+ ## v0.4.3
44
+
45
+ - perf: add name cache to Ledger for zero-cost model lookups
46
+
47
+ ## v0.4.2
48
+
49
+ - perf: bulk load discovered snapshots in `connect()` — 1 query instead of N
50
+
51
+ ## v0.4.1
52
+
53
+ - fix: `DataPort` schema matching must require both sides have the key
54
+
55
+ ## v0.4.0
56
+
57
+ - feat: DataNode graph architecture — `add()`, `connect()`, `trace()`, `upstream()`, `downstream()`
58
+ - feat: `DataPort` with schema discriminators for shared table matching
59
+ - feat: `SourceConnector` protocol for platform-specific discovery
60
+ - feat: SQL adapters — `extract_tables_from_sql`, `extract_write_tables`, `extract_model_name_filters`
61
+
62
+ ## v0.3.0
63
+
64
+ - feat: event-log paradigm — `ModelRef`, `Snapshot`, `Tag`
65
+ - feat: `Ledger` SDK — `register`, `record`, `tag`, `link_dependency`, `dependencies`, `inventory_at`
66
+ - feat: `LedgerBackend` protocol with `InMemoryLedgerBackend`
67
+ - feat: Scanner architecture — `Scanner` protocol, `ModelCandidate`, `InventoryScanner`
@@ -0,0 +1,60 @@
1
+ # model-ledger
2
+
3
+ Open-source model inventory and governance framework. Apache-2.0.
4
+
5
+ ## Build & Test
6
+
7
+ ```bash
8
+ .venv/bin/python -m pytest tests/ -v
9
+ .venv/bin/python -m pytest tests/test_file.py::test_name -v # single test
10
+ .venv/bin/python -m ruff check src/ tests/
11
+ .venv/bin/python -m ruff format src/ tests/
12
+ .venv/bin/python -m mypy src/
13
+ ```
14
+
15
+ ## Architecture
16
+
17
+ ### v0.5.0 (current — production backends + connector factories)
18
+ - `src/model_ledger/backends/sqlite_ledger.py` — SQLiteLedgerBackend (persistent, zero-dep)
19
+ - `src/model_ledger/backends/snowflake.py` — SnowflakeLedgerBackend (upstreamed from Block)
20
+ - `src/model_ledger/connectors/sql.py` — sql_connector() factory
21
+ - `src/model_ledger/connectors/rest.py` — rest_connector() factory
22
+ - `src/model_ledger/connectors/github.py` — github_connector() factory
23
+ - `src/model_ledger/sdk/ledger.py` — Ledger.from_sqlite(), Ledger.from_snowflake()
24
+
25
+ ### v0.4.x (DataNode graph)
26
+ - `src/model_ledger/core/ledger_models.py` — ModelRef, Snapshot, Tag
27
+ - `src/model_ledger/sdk/ledger.py` — Ledger SDK (register, record, tag, add, connect, trace, upstream, downstream)
28
+ - `src/model_ledger/graph/models.py` — DataNode, DataPort (with schema discriminators)
29
+ - `src/model_ledger/graph/protocol.py` — SourceConnector protocol
30
+ - `src/model_ledger/backends/ledger_protocol.py` — LedgerBackend protocol
31
+ - `src/model_ledger/backends/ledger_memory.py` — InMemory backend
32
+ - `src/model_ledger/adapters/sql.py` — SQL parsing (extract_tables, write_tables, model_name_filters)
33
+ - `src/model_ledger/adapters/tables.py` — Table-based pipeline discovery
34
+ - `src/model_ledger/adapters/cron.py` — Cron expression translation
35
+
36
+ ### v0.3.0 (event-log paradigm)
37
+ - `src/model_ledger/scanner/` — Scanner protocol, ModelCandidate, InventoryScanner, ScannerRegistry
38
+
39
+ ### v0.2.0 (legacy — retained for reference)
40
+ - `src/model_ledger/core/models.py` — Model, ModelVersion, ComponentNode
41
+ - `src/model_ledger/sdk/inventory.py` — Inventory, DraftVersion (context manager API)
42
+ - `src/model_ledger/backends/` — InventoryBackend protocol + SQLite/InMemory
43
+ - `src/model_ledger/validate/` — SR 11-7, EU AI Act, NIST AI RMF validation profiles
44
+ - `src/model_ledger/introspect/` — Plugin-based model introspection
45
+ - `src/model_ledger/cli/` — Typer CLI
46
+ - `src/model_ledger/export/` — Audit pack export
47
+
48
+ ## Boundary Rules
49
+
50
+ This is an Apache-2.0 open-source project. All code must be generic and useful to any organization. Organization-specific connectors, auth, and backends go in separate packages.
51
+
52
+ **Examples in code, tests, and docstrings must be generic** — use names like "Credit Scorecard", "feature_pipeline", "risk-team", "scoring_model". Never use organization-specific system names, team names, queue names, or person names in OSS code.
53
+
54
+ ## Key Patterns
55
+
56
+ - Event-log paradigm: models are identities (ModelRef), everything else is immutable Snapshots
57
+ - Protocol-first: all extension points use `@runtime_checkable` Protocol (no ABCs)
58
+ - Tool-shaped SDK: every Ledger method works as an agent tool call
59
+ - Append-only audit trail on every mutation
60
+ - Plugin discovery via `importlib.metadata.entry_points()`
@@ -0,0 +1,2 @@
1
+ # model-ledger project leads
2
+ * @vigneshnarayanaswamy
@@ -0,0 +1,53 @@
1
+ # Contributing to model-ledger
2
+
3
+ Thank you for your interest in contributing to model-ledger!
4
+
5
+ ## Development Setup
6
+
7
+ ```bash
8
+ # Clone the repository
9
+ git clone git@github.com:block/model-ledger.git
10
+ cd model-ledger
11
+
12
+ # Install dependencies
13
+ uv sync --all-extras
14
+
15
+ # Run tests
16
+ uv run pytest -v
17
+
18
+ # Run linter
19
+ uv run ruff check .
20
+ uv run ruff format --check .
21
+ ```
22
+
23
+ ## Making Changes
24
+
25
+ 1. Fork the repository and create a branch from `main`.
26
+ 2. Write tests for your changes (TDD preferred).
27
+ 3. Run `uv run pytest -v` and ensure all tests pass.
28
+ 4. Run `uv run ruff check . && uv run ruff format .` for linting.
29
+ 5. Commit with DCO sign-off: `git commit --signoff`
30
+ 6. Use conventional commit format for PR titles: `feat(scope): description`
31
+
32
+ ## DCO Sign-Off
33
+
34
+ All commits must include a DCO (Developer Certificate of Origin) sign-off:
35
+
36
+ ```bash
37
+ git commit --signoff -m "feat(sdk): add bulk registration"
38
+ ```
39
+
40
+ ## Code Style
41
+
42
+ - Python 3.10+ type hints throughout
43
+ - Pydantic 2.x for data models
44
+ - ruff for linting and formatting
45
+ - pytest for testing
46
+
47
+ ## Block Employees
48
+
49
+ If you work at Block, see internal documentation for Block-specific integrations and adapters.
50
+
51
+ ## Questions?
52
+
53
+ Open a discussion on GitHub or reach out on Discord.
@@ -0,0 +1 @@
1
+ ## [Click here for Block Open Source Project governance information](https://github.com/block/.github/blob/main/GOVERNANCE.md)
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2026 Block, Inc.
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.