Repository navigation
Package the validator as the installable okgf command
#1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: release | ||
|
|
||
| # Publish the `okgf` package to PyPI when a version tag is pushed (e.g. v0.1.0). | ||
| # Publishing uses PyPI Trusted Publishing (OIDC): no API token is stored in the repo. The PyPI | ||
| # project must list this repository + workflow + the `pypi` environment as a trusted publisher. | ||
| on: | ||
| push: | ||
| tags: ["v*"] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Build sdist and wheel | ||
| run: | | ||
| python -m pip install --upgrade build | ||
| python -m build | ||
| - name: Smoke-test the built wheel | ||
| run: | | ||
| python -m pip install dist/*.whl | ||
| okgf --version | ||
| okgf --strict examples/minimal | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
|
|
||
| publish-pypi: | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| environment: pypi | ||
| permissions: | ||
| id-token: write # OIDC token for PyPI Trusted Publishing | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: dist | ||
| path: dist/ | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
|
||
| bump-homebrew: | ||
| needs: publish-pypi | ||
| runs-on: ubuntu-latest | ||
| # Optional: open a PR against the tap to update the formula. Needs a HOMEBREW_TAP_TOKEN secret | ||
| # with push/PR access to OneHillAI/homebrew-tap. Skipped automatically when the secret is absent. | ||
| if: ${{ false }} | ||
| steps: | ||
| - name: Bump the tap formula | ||
| run: echo "Enable this job and set HOMEBREW_TAP_TOKEN to auto-bump OneHillAI/homebrew-tap." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| __pycache__/ | ||
| *.pyc | ||
| .pytest_cache/ | ||
| # Build / packaging artifacts | ||
| build/ | ||
| dist/ | ||
| *.egg-info/ | ||
| .venv/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| """Make a fresh source checkout importable as the ``okgf`` package during tests. | ||
|
|
||
| The normal path is to install the package first (``pip install -e .``), which makes this a no-op. | ||
| This hook additionally lets ``python -m pytest`` work straight from an uninstalled checkout by putting | ||
| the repository root on ``sys.path``. | ||
| """ | ||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Installing the OKGF validator | ||
|
|
||
| The reference validator ships as a small Python package named `okgf`. Installing it gives you an | ||
| `okgf` command for validating OKGF pages and bundles. The validator depends only on PyYAML; | ||
| cryptographic signature verification is an optional extra. | ||
|
|
||
| ## One-line install (recommended) | ||
|
|
||
| No system Python required - this uses [uv](https://docs.astral.sh/uv/) to manage an isolated Python | ||
| for the tool: | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/OneHillAI/okgf/main/install.sh | sh | ||
| ``` | ||
|
|
||
| To also enable Ed25519 signature verification, set `OKGF_VERIFY=1`: | ||
|
|
||
| ```sh | ||
| curl -fsSL https://raw.githubusercontent.com/OneHillAI/okgf/main/install.sh | OKGF_VERIFY=1 sh | ||
| ``` | ||
|
|
||
| Prefer to read before you run? The script is short: [`install.sh`](../install.sh). It falls back to | ||
| `pipx`, and installs `uv` only if neither `uv` nor `pipx` is present. | ||
|
|
||
| ## Homebrew (macOS / Linux) | ||
|
|
||
| ```sh | ||
| brew install OneHillAI/tap/okgf | ||
| ``` | ||
|
|
||
| ## With pip, pipx, or uv | ||
|
|
||
| If you already manage Python environments, install from PyPI directly: | ||
|
|
||
| ```sh | ||
| pipx install okgf # isolated, recommended for a CLI | ||
| uv tool install okgf # same idea, via uv | ||
| python -m pip install okgf # into the current environment | ||
| ``` | ||
|
|
||
| Add signature verification with the `verify` extra: | ||
|
|
||
| ```sh | ||
| pipx install "okgf[verify]" | ||
| ``` | ||
|
|
||
| ## Verify the install | ||
|
|
||
| ```sh | ||
| okgf --version | ||
| okgf --strict path/to/bundle | ||
| okgf --strict --pubkey path/to/ORG_PUBKEY.pem path/to/bundle # verify signatures | ||
| ``` | ||
|
|
||
| `python -m okgf ...` works identically to the `okgf` command. | ||
|
|
||
| ## Optional: signature verification | ||
|
|
||
| Signature checks need the [`cryptography`](https://cryptography.io/) package, pulled in by the | ||
| `verify` extra (`OKGF_VERIFY=1` for the one-line installer, or `pip install 'okgf[verify]'`). Without | ||
| it, a page that carries an `x-okgf-signature` is still format-checked, but reported as unverified | ||
| rather than trusted - the validator never claims a signature is valid when it cannot check it. | ||
|
|
||
| ## From a source checkout | ||
|
|
||
| Working on the validator itself, or want to run it without installing? | ||
|
|
||
| ```sh | ||
| git clone https://github.com/OneHillAI/okgf.git | ||
| cd okgf | ||
| python -m pip install -e ".[dev]" # editable install with test + verify extras | ||
| okgf --strict examples/minimal | ||
| python -m pytest tests/ -q | ||
| ``` | ||
|
|
||
| The historical entry point `python tools/okgf_validate.py ...` still works from a checkout: it is a | ||
| thin shim that re-exports the package, kept so older scripts and docs do not break. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.