ossplate 0.1.0__py3-none-any.whl

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 (46) hide show
  1. ossplate/__init__.py +3 -0
  2. ossplate/bin/darwin-arm64/ossplate +0 -0
  3. ossplate/bin/darwin-x64/ossplate +3 -0
  4. ossplate/bin/linux-x64/ossplate +3 -0
  5. ossplate/bin/win32-x64/ossplate.exe +3 -0
  6. ossplate/cli.py +55 -0
  7. ossplate/scaffold/.github/workflows/ci.yml +76 -0
  8. ossplate/scaffold/.github/workflows/publish-npm.yml +64 -0
  9. ossplate/scaffold/.github/workflows/publish.yml +97 -0
  10. ossplate/scaffold/.gitignore +9 -0
  11. ossplate/scaffold/CONTRIBUTING.md +30 -0
  12. ossplate/scaffold/LICENSE +9 -0
  13. ossplate/scaffold/README.md +73 -0
  14. ossplate/scaffold/core-rs/Cargo.lock +338 -0
  15. ossplate/scaffold/core-rs/Cargo.toml +28 -0
  16. ossplate/scaffold/core-rs/src/main.rs +1609 -0
  17. ossplate/scaffold/docs/README.md +21 -0
  18. ossplate/scaffold/docs/customizing-the-template.md +144 -0
  19. ossplate/scaffold/docs/phase-1-contract.md +52 -0
  20. ossplate/scaffold/docs/testing.md +71 -0
  21. ossplate/scaffold/docs/upgrade-plan.md +251 -0
  22. ossplate/scaffold/ossplate.toml +15 -0
  23. ossplate/scaffold/scripts/verify.sh +36 -0
  24. ossplate/scaffold/wrapper-js/README.md +7 -0
  25. ossplate/scaffold/wrapper-js/bin/darwin-arm64/ossplate +0 -0
  26. ossplate/scaffold/wrapper-js/bin/darwin-x64/ossplate +3 -0
  27. ossplate/scaffold/wrapper-js/bin/linux-x64/ossplate +3 -0
  28. ossplate/scaffold/wrapper-js/bin/ossplate.js +5 -0
  29. ossplate/scaffold/wrapper-js/bin/win32-x64/ossplate.exe +3 -0
  30. ossplate/scaffold/wrapper-js/package-lock.json +51 -0
  31. ossplate/scaffold/wrapper-js/package.json +43 -0
  32. ossplate/scaffold/wrapper-js/src/index.ts +69 -0
  33. ossplate/scaffold/wrapper-js/tsconfig.json +14 -0
  34. ossplate/scaffold/wrapper-py/README.md +7 -0
  35. ossplate/scaffold/wrapper-py/hatch_build.py +16 -0
  36. ossplate/scaffold/wrapper-py/pyproject.toml +37 -0
  37. ossplate/scaffold/wrapper-py/src/ossplate/__init__.py +3 -0
  38. ossplate/scaffold/wrapper-py/src/ossplate/bin/darwin-arm64/ossplate +0 -0
  39. ossplate/scaffold/wrapper-py/src/ossplate/bin/darwin-x64/ossplate +3 -0
  40. ossplate/scaffold/wrapper-py/src/ossplate/bin/linux-x64/ossplate +3 -0
  41. ossplate/scaffold/wrapper-py/src/ossplate/bin/win32-x64/ossplate.exe +3 -0
  42. ossplate/scaffold/wrapper-py/src/ossplate/cli.py +55 -0
  43. ossplate-0.1.0.dist-info/METADATA +21 -0
  44. ossplate-0.1.0.dist-info/RECORD +46 -0
  45. ossplate-0.1.0.dist-info/WHEEL +4 -0
  46. ossplate-0.1.0.dist-info/entry_points.txt +2 -0
ossplate/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .cli import cli, get_binary_path, get_packaged_binary_path, main
2
+
3
+ __all__ = ["cli", "get_binary_path", "get_packaged_binary_path", "main"]
Binary file
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ printf '{"status":"packaged-stub"}\n'
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ printf '{"status":"packaged-stub"}\n'
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+
3
+ printf '{"status":"packaged-stub"}\n'
ossplate/cli.py ADDED
@@ -0,0 +1,55 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import platform
5
+ import subprocess
6
+ import sys
7
+ from importlib import resources
8
+ from pathlib import Path
9
+
10
+ ENV_OVERRIDE = "OSSPLATE_BINARY"
11
+ TEMPLATE_ROOT_ENV = "OSSPLATE_TEMPLATE_ROOT"
12
+ TARGETS = {
13
+ ("Darwin", "arm64"): ("darwin-arm64", "ossplate"),
14
+ ("Darwin", "x86_64"): ("darwin-x64", "ossplate"),
15
+ ("Linux", "x86_64"): ("linux-x64", "ossplate"),
16
+ ("Windows", "AMD64"): ("win32-x64", "ossplate.exe"),
17
+ }
18
+
19
+
20
+ def get_packaged_binary_path(base_dir: Path | None = None) -> str:
21
+ base_dir = base_dir or Path(resources.files("ossplate"))
22
+ env_override = os.environ.get(ENV_OVERRIDE)
23
+ if env_override:
24
+ return env_override
25
+
26
+ system = platform.system()
27
+ machine = platform.machine()
28
+ target = TARGETS.get((system, machine))
29
+ if target is None:
30
+ raise RuntimeError(f"Unsupported platform/arch: {system}/{machine}")
31
+
32
+ folder, executable = target
33
+ binary_path = base_dir / "bin" / folder / executable
34
+ if not binary_path.exists():
35
+ raise RuntimeError(f"Bundled ossplate binary not found at {binary_path}")
36
+ return str(binary_path)
37
+
38
+
39
+ def get_binary_path() -> str:
40
+ return get_packaged_binary_path()
41
+
42
+
43
+ def cli(args: tuple[str, ...]) -> int:
44
+ env = os.environ.copy()
45
+ env.setdefault(TEMPLATE_ROOT_ENV, str(Path(resources.files("ossplate")) / "scaffold"))
46
+ result = subprocess.run([get_binary_path(), *args], check=False, env=env)
47
+ return result.returncode
48
+
49
+
50
+ def main() -> None:
51
+ raise SystemExit(cli(tuple(sys.argv[1:])))
52
+
53
+
54
+ if __name__ == "__main__":
55
+ main()
@@ -0,0 +1,76 @@
1
+ # ossplate:workflow-name:start
2
+ name: Ossplate CI
3
+ # ossplate:workflow-name:end
4
+
5
+ on:
6
+ push:
7
+ branches:
8
+ - main
9
+ pull_request:
10
+
11
+ jobs:
12
+ template-readiness:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: dtolnay/rust-toolchain@stable
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: '20'
20
+ - run: cargo run --quiet --manifest-path core-rs/Cargo.toml -- validate
21
+ - run: cargo run --quiet --manifest-path core-rs/Cargo.toml -- sync --check
22
+ - run: node --test ./scripts/validate-template-readiness.test.mjs
23
+
24
+ rust:
25
+ needs: template-readiness
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: dtolnay/rust-toolchain@stable
30
+ - run: cargo fmt --check
31
+ working-directory: ./core-rs
32
+ - run: cargo clippy -- -D warnings
33
+ working-directory: ./core-rs
34
+ - run: cargo test
35
+ working-directory: ./core-rs
36
+
37
+ js:
38
+ needs: template-readiness
39
+ runs-on: ubuntu-latest
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+ - uses: dtolnay/rust-toolchain@stable
43
+ - uses: actions/setup-node@v4
44
+ with:
45
+ node-version: '20'
46
+ cache: npm
47
+ cache-dependency-path: ./wrapper-js/package-lock.json
48
+ - run: npm ci
49
+ working-directory: ./wrapper-js
50
+ - run: npm run build
51
+ working-directory: ./wrapper-js
52
+ - run: npm test
53
+ working-directory: ./wrapper-js
54
+ - run: npm pack --dry-run
55
+ working-directory: ./wrapper-js
56
+
57
+ python:
58
+ needs: template-readiness
59
+ runs-on: ubuntu-latest
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+ - uses: dtolnay/rust-toolchain@stable
63
+ - uses: actions/setup-node@v4
64
+ with:
65
+ node-version: '20'
66
+ - uses: actions/setup-python@v5
67
+ with:
68
+ python-version: '3.11'
69
+ - name: Test and build
70
+ run: |
71
+ python -m pip install --upgrade pip
72
+ pip install -e .
73
+ pip install build
74
+ python -m unittest discover -s tests -p 'test_*.py'
75
+ python -m build --wheel
76
+ working-directory: ./wrapper-py
@@ -0,0 +1,64 @@
1
+ # ossplate:workflow-name:start
2
+ name: Ossplate publish-npm
3
+ # ossplate:workflow-name:end
4
+
5
+ on:
6
+ release:
7
+ types: [published]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ publish-npm:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-node@v4
19
+ with:
20
+ node-version: '20'
21
+ registry-url: 'https://registry.npmjs.org'
22
+ cache: npm
23
+ cache-dependency-path: ./wrapper-js/package-lock.json
24
+ - name: Detect published version
25
+ id: published
26
+ working-directory: ./wrapper-js
27
+ run: |
28
+ NAME=$(node -p "require('./package.json').name")
29
+ VERSION=$(node -p "require('./package.json').version")
30
+ echo "name=$NAME" >> "$GITHUB_OUTPUT"
31
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
32
+ if npm view "$NAME@$VERSION" version >/dev/null 2>&1; then
33
+ echo "already=true" >> "$GITHUB_OUTPUT"
34
+ echo "::notice title=npm::${NAME}@${VERSION} is already published; skipping."
35
+ else
36
+ echo "already=false" >> "$GITHUB_OUTPUT"
37
+ fi
38
+ - if: steps.published.outputs.already != 'true'
39
+ run: npm ci
40
+ working-directory: ./wrapper-js
41
+ - name: Publish to npm
42
+ if: steps.published.outputs.already != 'true'
43
+ working-directory: ./wrapper-js
44
+ env:
45
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46
+ run: |
47
+ set +e
48
+ npm publish --access public --provenance 2>&1 | tee npm-publish.log
49
+ status=${PIPESTATUS[0]}
50
+ set -e
51
+ if [ "$status" -eq 0 ]; then
52
+ echo "::notice title=npm::published with OIDC trusted publishing."
53
+ exit 0
54
+ fi
55
+ if [ -z "${NODE_AUTH_TOKEN:-}" ]; then
56
+ echo "::error title=npm::OIDC publish failed and NPM_TOKEN is not configured."
57
+ exit "$status"
58
+ fi
59
+ if grep -qiE "already exists|cannot publish over|previously published" npm-publish.log; then
60
+ echo "::notice title=npm::package version already exists; skipping."
61
+ exit 0
62
+ fi
63
+ echo "::warning title=npm::OIDC publish failed; retrying with NPM_TOKEN fallback."
64
+ npm publish --access public
@@ -0,0 +1,97 @@
1
+ # ossplate:workflow-name:start
2
+ name: Ossplate publishing
3
+ # ossplate:workflow-name:end
4
+
5
+ on:
6
+ release:
7
+ types: [published]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ publish-pypi:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: '3.11'
21
+ - name: Build wheel
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install build
25
+ python -m build --wheel
26
+ working-directory: ./wrapper-py
27
+ - name: Publish to PyPI
28
+ uses: pypa/gh-action-pypi-publish@release/v1
29
+ with:
30
+ packages-dir: ./wrapper-py/dist/
31
+ skip-existing: true
32
+
33
+ publish-cargo:
34
+ runs-on: ubuntu-latest
35
+ permissions:
36
+ contents: read
37
+ id-token: write
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - uses: dtolnay/rust-toolchain@stable
41
+ - name: Authenticate with crates.io via OIDC
42
+ id: auth
43
+ continue-on-error: true
44
+ uses: rust-lang/crates-io-auth-action@v1
45
+ - name: Detect published crate version
46
+ id: version
47
+ working-directory: ./core-rs
48
+ run: |
49
+ CRATE_NAME=$(python3 - <<'PY'
50
+ import tomllib
51
+ with open("Cargo.toml", "rb") as f:
52
+ data = tomllib.load(f)
53
+ print(data["package"]["name"])
54
+ PY
55
+ )
56
+ CRATE_VERSION=$(python3 - <<'PY'
57
+ import tomllib
58
+ with open("Cargo.toml", "rb") as f:
59
+ data = tomllib.load(f)
60
+ print(data["package"]["version"])
61
+ PY
62
+ )
63
+ echo "name=$CRATE_NAME" >> "$GITHUB_OUTPUT"
64
+ echo "version=$CRATE_VERSION" >> "$GITHUB_OUTPUT"
65
+ if curl -fsSL "https://crates.io/api/v1/crates/${CRATE_NAME}/${CRATE_VERSION}" >/dev/null 2>&1; then
66
+ echo "already=true" >> "$GITHUB_OUTPUT"
67
+ echo "::notice title=cargo::${CRATE_NAME} ${CRATE_VERSION} is already published; skipping."
68
+ else
69
+ echo "already=false" >> "$GITHUB_OUTPUT"
70
+ fi
71
+ - name: Publish to crates.io
72
+ if: steps.version.outputs.already != 'true'
73
+ working-directory: ./core-rs
74
+ env:
75
+ CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token || secrets.CARGO_TOKEN }}
76
+ run: |
77
+ if [ -n "${{ steps.auth.outputs.token }}" ]; then
78
+ echo "::notice title=cargo::using crates.io OIDC token from trusted publishing."
79
+ else
80
+ echo "::notice title=cargo::OIDC token unavailable; falling back to CARGO_TOKEN secret."
81
+ fi
82
+ set +e
83
+ cargo publish 2>&1 | tee cargo-publish.log
84
+ status=${PIPESTATUS[0]}
85
+ set -e
86
+ if [ "$status" -eq 0 ]; then
87
+ exit 0
88
+ fi
89
+ if grep -q "status 429 Too Many Requests" cargo-publish.log; then
90
+ echo "::warning title=cargo::crates.io rate limit hit. Treating this publish attempt as non-blocking."
91
+ exit 0
92
+ fi
93
+ if grep -qi "already exists on crates.io index" cargo-publish.log; then
94
+ echo "::notice title=cargo::crate version already exists; skipping."
95
+ exit 0
96
+ fi
97
+ exit "$status"
@@ -0,0 +1,9 @@
1
+ .DS_Store
2
+ .venv/
3
+ __pycache__/
4
+ *.pyc
5
+ .tmp-*/
6
+ dist/
7
+ build/
8
+ node_modules/
9
+ target/
@@ -0,0 +1,30 @@
1
+ # Contributing
2
+
3
+ Use the root verification flow before committing changes:
4
+
5
+ ```bash
6
+ ./scripts/verify.sh
7
+ ```
8
+
9
+ That script mirrors the local release-confidence gate:
10
+
11
+ - Rust format, clippy, and tests
12
+ - `ossplate validate` and `ossplate sync --check`
13
+ - JavaScript wrapper tests and package dry-run
14
+ - Python wrapper tests
15
+
16
+ Useful operator commands:
17
+
18
+ ```bash
19
+ cargo run --manifest-path core-rs/Cargo.toml -- validate
20
+ cargo run --manifest-path core-rs/Cargo.toml -- sync --check
21
+ cargo run --manifest-path core-rs/Cargo.toml -- sync
22
+ ```
23
+
24
+ Current ownership model:
25
+
26
+ - `ossplate.toml` is the canonical identity source
27
+ - `sync` owns Rust/npm/Python metadata surfaces
28
+ - `sync` owns the root `README.md` identity block between `ossplate:readme-identity` markers
29
+ - `sync` owns the top-level workflow display names between `ossplate:workflow-name` markers
30
+ - workflow logic, auth, triggers, and job structure remain manual
@@ -0,0 +1,9 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
4
+
5
+ In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
9
+ For more information, please refer to <http://unlicense.org/>
@@ -0,0 +1,73 @@
1
+ <!-- ossplate:readme-identity:start -->
2
+ # Ossplate
3
+
4
+ A practical baseline for shipping one project across Cargo, npm, and PyPI without starting from scratch every time.
5
+ <!-- ossplate:readme-identity:end -->
6
+
7
+ ## What This Tool Gives You
8
+
9
+ - a canonical Rust CLI in [`core-rs/`](./core-rs)
10
+ - a thin npm wrapper in [`wrapper-js/`](./wrapper-js)
11
+ - a thin Python wrapper in [`wrapper-py/`](./wrapper-py)
12
+ - normal `push` / `pull_request` CI
13
+ - rerun-safe publish workflows for npm, PyPI, and Cargo
14
+ - setup and upgrade docs in [`docs/`](./docs/README.md)
15
+
16
+ ## Philosophy
17
+
18
+ This project is intentionally small.
19
+
20
+ It exists to validate and synchronize the shared identity of a multi-registry OSS scaffold before broader scaffolding features are added.
21
+
22
+ ## Core Commands
23
+
24
+ ```bash
25
+ cargo run --manifest-path core-rs/Cargo.toml -- validate
26
+ cargo run --manifest-path core-rs/Cargo.toml -- sync --check
27
+ cargo run --manifest-path core-rs/Cargo.toml -- create ../my-new-project
28
+ cargo run --manifest-path core-rs/Cargo.toml -- init --path ../existing-project
29
+ ```
30
+
31
+ Wrapper installs expose the same command surface as `ossplate`.
32
+
33
+ `create` and `init` now work from packaged wrapper artifacts as well as a source checkout. Installed wrappers carry a curated scaffold payload rather than a broad repo snapshot. Use flags to set the project identity during scaffold creation instead of editing `ossplate.toml` by hand first:
34
+
35
+ ```bash
36
+ cargo run --manifest-path core-rs/Cargo.toml -- create ../my-new-project \
37
+ --name "My Project" \
38
+ --repository "https://github.com/acme/my-project" \
39
+ --author-name "Acme" \
40
+ --author-email "oss@acme.dev" \
41
+ --rust-crate "my-project" \
42
+ --npm-package "@acme/my-project" \
43
+ --python-package "my-project-py" \
44
+ --command "my-project"
45
+ ```
46
+
47
+ ## Local Verify
48
+
49
+ Run the full local verification flow with:
50
+
51
+ ```bash
52
+ ./scripts/verify.sh
53
+ ```
54
+
55
+ This is the recommended local mirror of the CI gate.
56
+
57
+ ## Verification
58
+
59
+ - local workflow and layered testing guidance live in [docs/testing.md](./docs/testing.md)
60
+ - contributor workflow lives in [CONTRIBUTING.md](./CONTRIBUTING.md)
61
+ - `ossplate validate` reports owned metadata drift
62
+ - `ossplate sync --check` fails if owned metadata would be rewritten
63
+ - JS and Python artifact tests prove installed distributions can run `version`, `create`, and `validate`
64
+
65
+ ## Release Auth
66
+
67
+ - PyPI publishes from [`.github/workflows/publish.yml`](./.github/workflows/publish.yml) via GitHub OIDC trusted publishing
68
+ - Cargo publishes from [`.github/workflows/publish.yml`](./.github/workflows/publish.yml) via OIDC trusted publishing with `secrets.CARGO_TOKEN` as fallback
69
+ - npm publishes from [`.github/workflows/publish-npm.yml`](./.github/workflows/publish-npm.yml) via OIDC trusted publishing with `secrets.NPM_TOKEN` as fallback
70
+
71
+ ## License
72
+
73
+ Licensed under the [Unlicense](LICENSE).