From d244ab722f6f27f19ad2cc4fe59bb5b6f07c7191 Mon Sep 17 00:00:00 2001 From: PD Hall <20580126+pdhall99@users.noreply.github.com> Date: Tue, 15 Sep 2026 21:14:47 +0100 Subject: [PATCH] Improve docs --- .github/workflows/ci.yml | 4 ++-- README.md | 9 +++++---- docs/CONTRIBUTING.md | 11 +++-------- src/spanwend/__init__.py | 14 ++++++++++++-- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a30068..738183d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ permissions: env: RUNNER: &runner "ubuntu-24.04" JOB_TIMEOUT: &job_timeout 30 - TOOL_PYTHON_VERSION: "3.12" + TOOL_PYTHON_VERSION: "3.10" HATCH_VERSION: "1.18.0" - UV_VERSION: "0.12.5" + UV_VERSION: "0.12.13" DISTRIBUTION_NAME: "spanwend" IMPORT_NAME: "spanwend" DOCS_ENABLED: "false" diff --git a/README.md b/README.md index 3bab6e0..d3530dc 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,9 @@ Encoding and conversion preserve span boundaries and labels, and report when a t `spanwend` requires Python 3.10 or later (see [compatibility and versioning](#compatibility-and-versioning)). It has no runtime dependencies. -Install the latest release from [PyPI](https://pypi.org/project/spanwend/): +`spanwend` is available from [PyPI](https://pypi.org/project/quirer/). +Install it with your preferred Python package manager. +For example, using `pip`: ```shell python -m pip install spanwend @@ -196,8 +198,7 @@ Scheme name inputs are case-insensitive. spanwend supports the following schemes | BMES | `bmes` | — | `B`, `M`, `E`, `S` | — | | BMEOW / BMEWO | `bmeow` | `bmewo` | `B`, `M`, `E`, `W` | — | -The bare name `"iob"` is deliberately rejected because it is ambiguous: use -`"iob1"` for IOB1 or `"bio"`/`"iob2"` for BIO/IOB2. +The bare name `"iob"` is rejected because it is ambiguous: use `"iob1"` for IOB1 or `"bio"`/`"iob2"` for BIO/IOB2. ### Spans @@ -307,7 +308,7 @@ For releases before `1.0.0`, the public API should be considered under developme This project supports Python feature releases from their official final release until their official end-of-life (EOL). -Support for a new Python feature release is generally introduced in the first minor release of spanwend following the upstream Python release. +Support for a new Python feature release is generally introduced in the first minor release of this project following the upstream Python release. Python feature releases may be dropped once they reach the end of their upstream support cycle. The currently supported Python versions are declared in the package metadata. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index bb2b909..0bc62bd 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -12,11 +12,7 @@ Thank you for considering making a contribution. - `hatch>=1.17` - Access to the internet for GitHub and installation of packages from PyPI -If `hatch` is not available in your development environment, install it by running - -```shell -uv tool install "hatch>=1.17" -``` +If Hatch is not available in your development environment, see the [Hatch installation instructions](https://hatch.pypa.io/latest/install/). ## Setup @@ -60,15 +56,14 @@ The core package is intentionally dependency-free; a new runtime dependency requ ### Checks -Making a pull request normally triggers CI checks, which must pass before the pull request can be merged into main. +Pull requests must pass checks in CI before they can be merged into main. -Run these same checks in your development environment and fix any problems before opening a pull request: +Run the same checks in your development environment and fix any problems before opening a pull request ```shell hatch check code --fix # Check and fix linting and formatting using ruff - Note that this mutates files hatch check types # Check type annotations using pyrefly hatch test --all # Run tests using pytest for all locally available versions of python in the matrix -hatch run docs:build # Build the Zensical documentation site hatch run pre-commit:ci # Run all pre-commit hooks ``` diff --git a/src/spanwend/__init__.py b/src/spanwend/__init__.py index 8f43c4b..74f9418 100644 --- a/src/spanwend/__init__.py +++ b/src/spanwend/__init__.py @@ -1,4 +1,6 @@ -"""Loss-aware operations for sequence tags and labelled spans.""" +"""A library for working with sequence-tagging schemes.""" + +from importlib.metadata import PackageNotFoundError, version from spanwend._api import ( check_conformance, @@ -18,10 +20,17 @@ from spanwend._span import Span from spanwend._syntax import DEFAULT_SYNTAX, TagSyntax +try: + __version__ = version("spanwend") +except PackageNotFoundError: + __version__ = "unknown" +finally: + del PackageNotFoundError, version + __all__ = [ - "DEFAULT_SYNTAX", "ConfiguredScheme", "ConformanceResult", + "DEFAULT_SYNTAX", "Diagnostic", "DiagnosticCode", "InvalidTagSequenceError", @@ -36,6 +45,7 @@ "SpanwendError", "TagSyntax", "UnrepresentableError", + "__version__", "check_conformance", "check_representability", "convert",