modelferry 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.
- modelferry-0.1.0/.gitattributes +5 -0
- modelferry-0.1.0/.github/workflows/ci.yml +121 -0
- modelferry-0.1.0/.github/workflows/release.yml +134 -0
- modelferry-0.1.0/.gitignore +33 -0
- modelferry-0.1.0/CHANGELOG.md +53 -0
- modelferry-0.1.0/CLAUDE.md +34 -0
- modelferry-0.1.0/LICENSE +201 -0
- modelferry-0.1.0/PKG-INFO +235 -0
- modelferry-0.1.0/README.md +208 -0
- modelferry-0.1.0/SPEC.md +267 -0
- modelferry-0.1.0/docs/Dockerfile.vhs +18 -0
- modelferry-0.1.0/docs/demo.gif +0 -0
- modelferry-0.1.0/docs/demo.md +12 -0
- modelferry-0.1.0/docs/demo.tape +52 -0
- modelferry-0.1.0/pyproject.toml +87 -0
- modelferry-0.1.0/scripts/e2e_airgap.sh +83 -0
- modelferry-0.1.0/src/modelferry/__init__.py +3 -0
- modelferry-0.1.0/src/modelferry/cli.py +139 -0
- modelferry-0.1.0/src/modelferry/errors.py +25 -0
- modelferry-0.1.0/src/modelferry/hf.py +156 -0
- modelferry-0.1.0/src/modelferry/manifest.py +190 -0
- modelferry-0.1.0/src/modelferry/offline.py +549 -0
- modelferry-0.1.0/src/modelferry/pack.py +423 -0
- modelferry-0.1.0/tests/_bundle.py +156 -0
- modelferry-0.1.0/tests/conftest.py +23 -0
- modelferry-0.1.0/tests/test_cli_skeleton.py +37 -0
- modelferry-0.1.0/tests/test_offline_corruption.py +71 -0
- modelferry-0.1.0/tests/test_offline_manifest.py +106 -0
- modelferry-0.1.0/tests/test_offline_pathsafety.py +181 -0
- modelferry-0.1.0/tests/test_offline_roundtrip.py +78 -0
- modelferry-0.1.0/tests/test_offline_stdlib_lint.py +77 -0
- modelferry-0.1.0/tests/test_offline_unpack_hardening.py +88 -0
- modelferry-0.1.0/tests/test_offline_verify.py +72 -0
- modelferry-0.1.0/tests/test_pack_dest.py +198 -0
- modelferry-0.1.0/tests/test_pack_hardening.py +56 -0
- modelferry-0.1.0/tests/test_pack_integration.py +48 -0
- modelferry-0.1.0/tests/test_pack_writer.py +274 -0
- modelferry-0.1.0/uv.lock +489 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ci-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
lint:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v5
|
|
19
|
+
# Fail if uv.lock does not match a default resolve of pyproject. This catches
|
|
20
|
+
# a lock accidentally left in --resolution lowest-direct mode by local floor
|
|
21
|
+
# experiments, so normal installs and CI keep resolving the highest versions.
|
|
22
|
+
- name: Lockfile is up to date
|
|
23
|
+
run: uv lock --check
|
|
24
|
+
- name: Sync dev environment
|
|
25
|
+
run: uv sync
|
|
26
|
+
- name: Ruff check
|
|
27
|
+
run: uv run ruff check .
|
|
28
|
+
- name: Ruff format check
|
|
29
|
+
run: uv run ruff format --check .
|
|
30
|
+
- name: Byte-compile offline.py on Python 3.9
|
|
31
|
+
run: uv run --no-project --python 3.9 python -m py_compile src/modelferry/offline.py
|
|
32
|
+
|
|
33
|
+
unit:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
strategy:
|
|
36
|
+
matrix:
|
|
37
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- name: Install uv
|
|
41
|
+
uses: astral-sh/setup-uv@v5
|
|
42
|
+
- name: Sync dev environment
|
|
43
|
+
run: uv sync --python ${{ matrix.python-version }}
|
|
44
|
+
- name: Unit tests (no network)
|
|
45
|
+
run: uv run pytest -m "not network"
|
|
46
|
+
|
|
47
|
+
# Resolve every direct dependency to its declared floor and run the suite, so
|
|
48
|
+
# the version lower bounds in pyproject are tested claims instead of Phase 1
|
|
49
|
+
# guesses. A floor that does not actually work turns this job red. The network
|
|
50
|
+
# integration test is included so the huggingface_hub floor (1.0.0) is exercised
|
|
51
|
+
# for real: the offline suite never imports huggingface_hub (hf.py's imports are
|
|
52
|
+
# lazy inside resolve_and_download), so only a real pack reaches it.
|
|
53
|
+
floor-test:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@v4
|
|
57
|
+
- name: Install uv
|
|
58
|
+
uses: astral-sh/setup-uv@v5
|
|
59
|
+
- name: Sync at dependency floors
|
|
60
|
+
run: uv sync --resolution lowest-direct
|
|
61
|
+
- name: Offline tests at the floors
|
|
62
|
+
run: uv run pytest -m "not network"
|
|
63
|
+
- name: Integration test at the floors (network, exercises huggingface_hub 1.0.0)
|
|
64
|
+
run: uv run pytest -m network
|
|
65
|
+
|
|
66
|
+
integration:
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
- name: Install uv
|
|
71
|
+
uses: astral-sh/setup-uv@v5
|
|
72
|
+
- name: Sync dev environment
|
|
73
|
+
run: uv sync
|
|
74
|
+
- name: Integration tests (network, tiny public repo)
|
|
75
|
+
run: uv run pytest -m network
|
|
76
|
+
|
|
77
|
+
airgap-e2e:
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/checkout@v4
|
|
81
|
+
- name: Install uv
|
|
82
|
+
uses: astral-sh/setup-uv@v5
|
|
83
|
+
- name: Sync dev environment
|
|
84
|
+
run: uv sync
|
|
85
|
+
- name: Air-gap end-to-end (docker, --network none)
|
|
86
|
+
run: bash scripts/e2e_airgap.sh
|
|
87
|
+
|
|
88
|
+
# Network job, like integration: install modelferry as a built wheel into a
|
|
89
|
+
# clean venv with the repo not on the path, then run the full pack/verify/unpack
|
|
90
|
+
# round trip from a temp dir. uv sync installs the project editable, so this is
|
|
91
|
+
# the only job that exercises the wheel a user actually gets, and it proves
|
|
92
|
+
# pack.py finds offline.py inside the installed package (not at a repo path).
|
|
93
|
+
wheel-install:
|
|
94
|
+
runs-on: ubuntu-latest
|
|
95
|
+
steps:
|
|
96
|
+
- uses: actions/checkout@v4
|
|
97
|
+
- name: Install uv
|
|
98
|
+
uses: astral-sh/setup-uv@v5
|
|
99
|
+
- name: Build the wheel
|
|
100
|
+
run: uv build
|
|
101
|
+
- name: Install the wheel into a clean venv (repo not on the path)
|
|
102
|
+
run: |
|
|
103
|
+
uv venv /tmp/wenv
|
|
104
|
+
uv pip install --python /tmp/wenv/bin/python dist/*.whl
|
|
105
|
+
- name: Pack/verify/unpack round trip from a temp dir (network, tiny repo)
|
|
106
|
+
env:
|
|
107
|
+
HF_HUB_DISABLE_PROGRESS_BARS: "1"
|
|
108
|
+
run: |
|
|
109
|
+
mf=/tmp/wenv/bin/modelferry
|
|
110
|
+
# Prove the CLI and its offline.py come from the installed wheel, not the
|
|
111
|
+
# repo checkout the reviewer worried could mask a __file__ resolution bug.
|
|
112
|
+
/tmp/wenv/bin/python -c "import modelferry,pathlib; p=pathlib.Path(modelferry.__file__); assert 'site-packages' in str(p), p; print('modelferry from', p)"
|
|
113
|
+
work="$(mktemp -d)"
|
|
114
|
+
cd "$work"
|
|
115
|
+
"$mf" pack hf-internal-testing/tiny-random-gpt2 --dest ./b --chunk-size 200K --exclude "*.bin" --exclude "*.h5"
|
|
116
|
+
bundle="$(echo ./b/tiny-random-gpt2__*)"
|
|
117
|
+
echo "bundle: $bundle"
|
|
118
|
+
"$mf" verify "$bundle"
|
|
119
|
+
"$mf" unpack "$bundle" ./out
|
|
120
|
+
test -f ./out/model.safetensors
|
|
121
|
+
echo "wheel-install round trip OK"
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Two independent triggers, so the TestPyPI rehearsal is a real rehearsal and a
|
|
4
|
+
# re-run of the release tag can never be blocked by TestPyPI rejecting a
|
|
5
|
+
# duplicate version:
|
|
6
|
+
#
|
|
7
|
+
# workflow_dispatch -> build and publish to TestPyPI. Run this manually from
|
|
8
|
+
# the Actions tab before tagging, to rehearse the upload.
|
|
9
|
+
# push tag v* -> build and publish to PyPI. This is the real release.
|
|
10
|
+
#
|
|
11
|
+
# Both publish steps use trusted publishing (OIDC), so no API tokens are stored
|
|
12
|
+
# in the repo. Configure the publishers first:
|
|
13
|
+
# TestPyPI: https://test.pypi.org/manage/account/publishing/
|
|
14
|
+
# PyPI: https://pypi.org/manage/account/publishing/
|
|
15
|
+
# with owner HamzaAhmedWajeeh, repo modelferry, workflow release.yml, and the
|
|
16
|
+
# environment names below (testpypi / pypi).
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
push:
|
|
20
|
+
tags:
|
|
21
|
+
- "v*"
|
|
22
|
+
workflow_dispatch:
|
|
23
|
+
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
build:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- name: Install uv
|
|
33
|
+
uses: astral-sh/setup-uv@v5
|
|
34
|
+
- name: Verify tag matches package version
|
|
35
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
36
|
+
run: |
|
|
37
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
38
|
+
pkg="$(uv run --no-project python -c 'import tomllib,pathlib; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])')"
|
|
39
|
+
echo "tag=$tag pkg=$pkg"
|
|
40
|
+
test "$tag" = "$pkg" || { echo "tag $tag does not match pyproject version $pkg"; exit 1; }
|
|
41
|
+
- name: Build sdist and wheel
|
|
42
|
+
run: uv build
|
|
43
|
+
- name: Check metadata
|
|
44
|
+
run: uvx twine check dist/*
|
|
45
|
+
- uses: actions/upload-artifact@v4
|
|
46
|
+
with:
|
|
47
|
+
name: dist
|
|
48
|
+
path: dist/
|
|
49
|
+
|
|
50
|
+
# Manual rehearsal only (workflow_dispatch). Never runs on a tag push.
|
|
51
|
+
testpypi:
|
|
52
|
+
needs: build
|
|
53
|
+
if: github.event_name == 'workflow_dispatch'
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
environment: testpypi
|
|
56
|
+
permissions:
|
|
57
|
+
id-token: write
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/download-artifact@v4
|
|
60
|
+
with:
|
|
61
|
+
name: dist
|
|
62
|
+
path: dist/
|
|
63
|
+
- name: Publish to TestPyPI
|
|
64
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
65
|
+
with:
|
|
66
|
+
repository-url: https://test.pypi.org/legacy/
|
|
67
|
+
# TestPyPI rejects duplicate versions; skip already-present files so a
|
|
68
|
+
# repeat rehearsal of the same version does not hard-fail. Not set on
|
|
69
|
+
# the PyPI job, where a duplicate should be a real error.
|
|
70
|
+
skip-existing: true
|
|
71
|
+
|
|
72
|
+
# Real release only (tag push). Runs BEFORE the PyPI publish (needs: build) so a
|
|
73
|
+
# failure here blocks the irreversible publish instead of following it: PyPI is a
|
|
74
|
+
# write-once index, a GitHub release is editable. Publishes the canonical sha256
|
|
75
|
+
# of the bundled verifier in the tag's release notes, the out-of-band mitigation
|
|
76
|
+
# the trust model (README, SPEC section 9) promises: a receiving site can check a
|
|
77
|
+
# bundle's tools/modelferry_offline.py against this hash before trusting it, or
|
|
78
|
+
# bring its own known-good copy. Idempotent, so a re-run after a later-step
|
|
79
|
+
# failure edits the existing release instead of erroring on "already exists".
|
|
80
|
+
github-release:
|
|
81
|
+
needs: build
|
|
82
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
83
|
+
runs-on: ubuntu-latest
|
|
84
|
+
permissions:
|
|
85
|
+
contents: write
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/checkout@v4
|
|
88
|
+
- name: Create the GitHub release with the canonical offline.py hash
|
|
89
|
+
env:
|
|
90
|
+
GH_TOKEN: ${{ github.token }}
|
|
91
|
+
run: |
|
|
92
|
+
sha="$(sha256sum src/modelferry/offline.py | cut -d' ' -f1)"
|
|
93
|
+
# Lead with the CHANGELOG 0.1.0 section so the release page says what this
|
|
94
|
+
# is, then append the verifier block. The awk prints from the 0.1.0 header
|
|
95
|
+
# up to (not including) the link-reference lines at the end of the file.
|
|
96
|
+
awk '/^## \[0\.1\.0\]/{f=1} f && /^\[.*\]: /{exit} f{print}' CHANGELOG.md > notes.md
|
|
97
|
+
cat >> notes.md <<EOF
|
|
98
|
+
|
|
99
|
+
## Verifier
|
|
100
|
+
|
|
101
|
+
Canonical sha256 of the offline verifier, copied verbatim into every bundle
|
|
102
|
+
at \`tools/modelferry_offline.py\` and recorded as \`verifier.sha256\` in each
|
|
103
|
+
\`manifest.json\`:
|
|
104
|
+
|
|
105
|
+
\`\`\`
|
|
106
|
+
$sha offline.py
|
|
107
|
+
\`\`\`
|
|
108
|
+
|
|
109
|
+
A receiving site can check a bundle's verifier against this hash out-of-band
|
|
110
|
+
before trusting it, or ignore the bundled copy and bring its own known-good
|
|
111
|
+
verifier. See the trust model in the README.
|
|
112
|
+
EOF
|
|
113
|
+
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
|
|
114
|
+
gh release edit "$GITHUB_REF_NAME" --notes-file notes.md
|
|
115
|
+
else
|
|
116
|
+
gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file notes.md
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Real release only (tag push), gated on github-release so the write-once PyPI
|
|
120
|
+
# publish happens last, only after the release-notes step has succeeded.
|
|
121
|
+
pypi:
|
|
122
|
+
needs: github-release
|
|
123
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
124
|
+
runs-on: ubuntu-latest
|
|
125
|
+
environment: pypi
|
|
126
|
+
permissions:
|
|
127
|
+
id-token: write
|
|
128
|
+
steps:
|
|
129
|
+
- uses: actions/download-artifact@v4
|
|
130
|
+
with:
|
|
131
|
+
name: dist
|
|
132
|
+
path: dist/
|
|
133
|
+
- name: Publish to PyPI
|
|
134
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Byte-compiled / optimized
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.pyo
|
|
5
|
+
|
|
6
|
+
# Virtual environments
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
|
|
10
|
+
# Tool caches
|
|
11
|
+
.pytest_cache/
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
.mypy_cache/
|
|
14
|
+
|
|
15
|
+
# Build / packaging artifacts
|
|
16
|
+
build/
|
|
17
|
+
dist/
|
|
18
|
+
*.egg-info/
|
|
19
|
+
|
|
20
|
+
# Coverage
|
|
21
|
+
.coverage
|
|
22
|
+
htmlcov/
|
|
23
|
+
|
|
24
|
+
# OS cruft
|
|
25
|
+
.DS_Store
|
|
26
|
+
|
|
27
|
+
# Local Claude Code state (personal, not shared)
|
|
28
|
+
.claude/
|
|
29
|
+
|
|
30
|
+
# Local demo / scratch bundles (e.g. the README quickstart's --dest ./bundles)
|
|
31
|
+
/bundles/
|
|
32
|
+
/tmp_snapshot/
|
|
33
|
+
/make_demo_bundle.py
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to modelferry are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-07-16
|
|
10
|
+
|
|
11
|
+
First release.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `modelferry pack REPO_ID --dest DIR`: download a Hugging Face model repo pinned
|
|
16
|
+
to a commit, split oversized files into `.mfpartNNNN` parts, hash everything
|
|
17
|
+
with sha256, and write a bundle with `manifest.json`, `MANIFEST.md`, the
|
|
18
|
+
payload, and a copy of the offline verifier.
|
|
19
|
+
- `modelferry verify`, `unpack`, and `inspect`: thin wrappers over the exact
|
|
20
|
+
standard-library verifier that ships inside every bundle, so the installed CLI
|
|
21
|
+
and the bundled tool behave identically.
|
|
22
|
+
- `src/modelferry/offline.py`: the self-contained verifier and unpacker. Standard
|
|
23
|
+
library only, runs on CPython 3.9, no network, no third-party packages. Copied
|
|
24
|
+
verbatim into every bundle at `tools/modelferry_offline.py`.
|
|
25
|
+
- `manifest.json` (version 1): deterministic, `sort_keys` serialization with
|
|
26
|
+
whole-file and per-part sha256 hashes, source repo and resolved commit SHA,
|
|
27
|
+
license, gated flag, and the verifier hash.
|
|
28
|
+
- `MANIFEST.md`: human-readable approval document for security review.
|
|
29
|
+
- Chunking sized for FAT32 by default (`--chunk-size 3900M`), with `--include` /
|
|
30
|
+
`--exclude` fnmatch filtering and resumable downloads via `--staging`.
|
|
31
|
+
- Streamed IO with a fixed 8 MiB buffer throughout, so bundles larger than RAM
|
|
32
|
+
pack and verify with flat memory use.
|
|
33
|
+
- Zip-slip-safe unpack: absolute paths, `..` segments, and anything resolving
|
|
34
|
+
outside the destination are rejected, and symlinks are never created.
|
|
35
|
+
- Post-pack read-back self-verify, so disk-level write errors surface before the
|
|
36
|
+
bundle leaves the connected side.
|
|
37
|
+
- Exit codes per SPEC section 10 (0 success, 1 integrity, 2 usage, 3 source,
|
|
38
|
+
4 filesystem).
|
|
39
|
+
|
|
40
|
+
### Security
|
|
41
|
+
|
|
42
|
+
- `HF_TOKEN` is read from the environment only and is never written into a
|
|
43
|
+
bundle, manifest, receipt, or log. A test packs with a fake token and asserts
|
|
44
|
+
the token bytes appear nowhere in the output.
|
|
45
|
+
- The trust model is documented in the README. v1 covers accidental corruption,
|
|
46
|
+
incomplete transfers, media errors, and casual tampering. It does not cover a
|
|
47
|
+
coordinated adversary who rewrites payload, manifest, and verifier together;
|
|
48
|
+
that needs out-of-band signature verification, planned for v1.1. Each release
|
|
49
|
+
publishes the canonical `offline.py` sha256 so a receiving site can check the
|
|
50
|
+
bundled verifier out-of-band.
|
|
51
|
+
|
|
52
|
+
[Unreleased]: https://github.com/HamzaAhmedWajeeh/modelferry/compare/v0.1.0...HEAD
|
|
53
|
+
[0.1.0]: https://github.com/HamzaAhmedWajeeh/modelferry/releases/tag/v0.1.0
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# modelferry
|
|
2
|
+
|
|
3
|
+
CLI that packs Hugging Face models into chunked, sha256-manifested bundles for transfer into air-gapped environments, and verifies/unpacks them offline. SPEC.md is the contract: read the relevant sections before implementing anything. If the spec turns out to be wrong or ambiguous, stop and ask; when we agree on a change, update SPEC.md in the same commit as the code.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- Setup: `uv sync`
|
|
8
|
+
- Tests (default, no network): `uv run pytest -m "not network"`
|
|
9
|
+
- All tests: `uv run pytest`
|
|
10
|
+
- Lint + format: `uv run ruff check . && uv run ruff format .`
|
|
11
|
+
- Air-gap end-to-end (needs docker): `bash scripts/e2e_airgap.sh`
|
|
12
|
+
|
|
13
|
+
## Hard rules
|
|
14
|
+
|
|
15
|
+
- IMPORTANT: `src/modelferry/offline.py` uses the Python standard library only, runs on CPython 3.9, imports nothing from the modelferry package, and stays under ~550 lines (raised from 500 in phase 2.2 to fit symlink/atomic-join/part-name hardening). It is copied verbatim into every bundle. The AST test in tests/ enforces this; never loosen that test.
|
|
16
|
+
- IMPORTANT: never write tokens or secrets into bundles, manifests, receipts, or logs. `HF_TOKEN` is read from the environment only.
|
|
17
|
+
- manifest.json format is frozen once Phase 2 merges. Any structural or semantic change bumps `manifest_version` and updates SPEC.md §5 in the same commit.
|
|
18
|
+
- All payload IO is streamed with a fixed 8 MiB buffer. Never read a payload file fully into memory.
|
|
19
|
+
- Unpack rejects absolute paths, `..` segments, and anything resolving outside the destination. Never create symlinks.
|
|
20
|
+
- Exit codes exactly per SPEC.md §10. Do not invent new ones.
|
|
21
|
+
- Runtime dependencies are typer, rich, huggingface_hub. Do not add a fourth without asking.
|
|
22
|
+
- Never weaken a corruption, path-safety, or token-leak test to make it pass. Fix the code instead.
|
|
23
|
+
- Every bugfix ships with a regression test.
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
- Build in the phase order of SPEC.md §13, one phase per session.
|
|
28
|
+
- Mark network-dependent tests `@pytest.mark.network` so the default test run stays offline.
|
|
29
|
+
- Before declaring a phase done: ruff clean, `pytest -m "not network"` green, and for Phase 4+ the e2e script passes.
|
|
30
|
+
- Commit at phase boundaries with short imperative messages (e.g. "phase 2: offline verifier + tests").
|
|
31
|
+
|
|
32
|
+
## Prose style (README, MANIFEST.md template, all docs)
|
|
33
|
+
|
|
34
|
+
- Plain sentences, contractions, no em dashes, no marketing adjectives, no bullet-point walls. Write like an engineer explaining to another engineer.
|
modelferry-0.1.0/LICENSE
ADDED
|
@@ -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 Derivative
|
|
95
|
+
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.
|