diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a830055 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +# Publishing a GitHub release tagged vX.Y.Z builds the package and uploads it to PyPI +# with Trusted Publishing (OIDC), so no API token is stored anywhere. + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-python@v7 + with: + python-version: "3.13" + - run: pip install build twine pytest + - name: Tag matches the package version + run: | + version=$(python -c "import re; print(re.search(r'__version__ = \"(.+)\"', open('src/glyph_cli/__init__.py').read())[1])") + test "v$version" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME does not match version $version"; exit 1; } + - run: python -m build + - run: twine check --strict dist/* + - name: Test the built wheel + run: | + pip install dist/*.whl + glyph validate + pytest -q # src/ is not on the path, so this tests the installed wheel + - uses: actions/upload-artifact@v7 + with: + name: dist + path: dist/ + + publish: + needs: build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/glyph-cli/ + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v8 + with: + name: dist + path: dist/ + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 728cded..1943f79 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ build/ site/ .pytest_cache/ .ruff_cache/ +.cache/ diff --git a/README.md b/README.md index d5bfa76..9a6fd3c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ The dictionary and toolkit for the **grid script**: how humans write down what R **Docs:** https://interimm.github.io/glyph-cli/ ```sh -uvx --from git+https://github.com/InterImm/glyph-cli glyph show BODY.OTHER STAR.TIME COUNT.137 +uvx --from glyph-cli glyph show BODY.OTHER STAR.TIME COUNT.137 ``` ```text @@ -20,7 +20,7 @@ uvx --from git+https://github.com/InterImm/glyph-cli glyph show BODY.OTHER STAR. ## Install ```sh -uv tool install git+https://github.com/InterImm/glyph-cli # or: pipx install git+https://github.com/InterImm/glyph-cli +uv tool install glyph-cli # or: pipx install glyph-cli, or: pip install glyph-cli ``` Python 3.10 or newer, no other dependencies. @@ -40,7 +40,7 @@ glyph init my-vocab.json && export GLYPH_VOCAB=$PWD/my-vocab.json glyph add BODY.STAR "a star-world" --domain Worlds ``` -A page file has one band per line, `SYMBOL: node | relation | node`; a blank line starts the next statement. See [`examples/`](examples) and the [docs](https://interimm.github.io/glyph-cli/pages/). +A page file has one band per line, `SYMBOL: node | relation | node`; a blank line starts the next statement. See [`examples/`](https://github.com/InterImm/glyph-cli/tree/main/examples) and the [docs](https://interimm.github.io/glyph-cli/pages/). ## Develop @@ -52,10 +52,17 @@ uv run python scripts/gen_docs.py # regenerate docs/vocabulary.md, docs/cli.m uv run zensical serve # docs at http://localhost:8000 ``` -The vocabulary ships in [`src/glyph_cli/data/vocab.json`](src/glyph_cli/data/vocab.json). Change it with the tool (`glyph --vocab src/glyph_cli/data/vocab.json add ...`), then run `scripts/gen_docs.py`; the tests fail if the generated docs are stale. +The vocabulary ships in [`src/glyph_cli/data/vocab.json`](https://github.com/InterImm/glyph-cli/blob/main/src/glyph_cli/data/vocab.json). Change it with the tool (`glyph --vocab src/glyph_cli/data/vocab.json add ...`), then run `scripts/gen_docs.py`; the tests fail if the generated docs are stale. Pushes to `main` publish the docs to GitHub Pages. +## Release + +1. Bump `__version__` in `src/glyph_cli/__init__.py` and merge it to `main`. +2. Publish a GitHub release tagged `vX.Y.Z` (the same version). + +The release workflow checks the tag matches the version, builds the package, tests the built wheel and uploads it to [PyPI](https://pypi.org/project/glyph-cli/) with Trusted Publishing, so no token is stored. + ## License MIT diff --git a/docs/getting-started.md b/docs/getting-started.md index a9a05da..a5b808e 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -7,21 +7,23 @@ === "uv" ```sh - uv tool install git+https://github.com/InterImm/glyph-cli + uv tool install glyph-cli ``` === "pipx" ```sh - pipx install git+https://github.com/InterImm/glyph-cli + pipx install glyph-cli ``` === "pip" ```sh - pip install git+https://github.com/InterImm/glyph-cli + pip install glyph-cli ``` +The latest code on `main` installs with `uv tool install git+https://github.com/InterImm/glyph-cli`. + Check it works: ```sh diff --git a/docs/index.md b/docs/index.md index dd18e66..fe6bd1c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -13,7 +13,7 @@ It draws words and pages on the lattice, keeps the vocabulary honest, reads a pa No install needed if you have [uv](https://docs.astral.sh/uv/): ```sh -uvx --from git+https://github.com/InterImm/glyph-cli glyph show BODY.OTHER STAR.TIME COUNT.137 +uvx --from glyph-cli glyph show BODY.OTHER STAR.TIME COUNT.137 ``` ```text diff --git a/pyproject.toml b/pyproject.toml index 0776218..e4ac9f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,15 +12,26 @@ license-files = ["LICENSE"] authors = [{ name = "InterImm" }] requires-python = ">=3.10" dependencies = [] +keywords = ["conlang", "writing system", "knowledge graph", "science fiction", "interimm"] classifiers = [ + "Development Status :: 3 - Alpha", "Environment :: Console", + "Intended Audience :: Other Audience", + "Operating System :: OS Independent", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Text Processing :: Linguistic", ] [project.urls] Homepage = "https://github.com/InterImm/glyph-cli" Documentation = "https://interimm.github.io/glyph-cli/" +Source = "https://github.com/InterImm/glyph-cli" +Issues = "https://github.com/InterImm/glyph-cli/issues" [project.scripts] glyph = "glyph_cli.cli:main" @@ -45,3 +56,6 @@ extend-exclude = ["docs"] [tool.ruff.lint] select = ["E", "F", "W", "I", "UP", "B"] + +[tool.hatch.build.targets.sdist] +include = ["src/", "tests/", "examples/", "scripts/", "docs/", "zensical.toml", "README.md", "LICENSE"]