Metadata-Version: 2.4
Name: fair-bioheaders-tools
Version: 0.1.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
License-File: LICENSE
License-File: THIRD-PARTY-LICENSES.yaml
Summary: FAIR-bioHeaders read/validate/verify engine (Rust) for Python
Keywords: bioinformatics,fasta,gfa,gff3,metadata,fair
Author: FAIR-bioHeaders contributors
License-Expression: MPL-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Bug Tracker, https://github.com/FAIR-bioHeaders/FAIR-bioHeaders-Tools/issues
Project-URL: Changelog, https://github.com/FAIR-bioHeaders/FAIR-bioHeaders-Tools/blob/main/crates/CHANGELOG.md
Project-URL: Repository, https://github.com/FAIR-bioHeaders/FAIR-bioHeaders-Tools
Project-URL: Toolkit, https://github.com/FAIR-bioHeaders/FAIR-bioHeaders-Tools-Python

# fair-bioheaders-tools

The FAIR-bioHeaders read/validate/verify engine (Rust) for Python: header
framing, exact SHA-512/256 checksum coverage, portable YAML/JSON metadata with
exact numbers, strict gzip/BGZF input, record-aware schema selection (V1-V7)
over digest-pinned bundles, JSON Schema 2020-12 validation and family
predicates for FASTA, GFA, FHP-FASTA and FHGFF3 files and YAML/JSON metadata.

```python
import fair_bioheaders_tools as fht

engine = fht.Engine()
report = engine.verify("genome.fhr.fasta.gz")
print(report.outcome, report.checksum.computed)
for d in report.diagnostics:
    print(d.severity, d.code, d.rule, d.header_line, d.message)
```

Verdicts are returned, never raised. Integers are exact `int`; decimals are
`float` unless `Engine(exact_decimals=True)` returns `decimal.Decimal`. The
default limits follow FAIR-bioHeaders-Specification docs/FORMAT.md; the 1 GiB
`in_memory_decompressed_bytes` bound for buffered input (metadata files, and
the header lines a sequence read retains, counted three times for their
copies; sequence bodies are streamed, not retained) can be lowered with
`Engine(limits={"in_memory_decompressed_bytes": n})` or raised with
`raise_limits=`.

`validate` reading a path or file object stops once the header block has
ended, without reading the body (a live pipe is not waited on: a file
object with `read1()`, such as `sys.stdin.buffer`, is read with it, so a
buffered pipe returns as soon as the header block has arrived); `verify`
reads to the end. Push streams report the same point: `Stream.feed()` returns
True, after which `finish()` needs no more input. `validate` is header-only on
every source: bytes after the header block are never inspected, so a late FHR
line (R10) or gzip damage in the body is reported by `verify` only.

## Installation

```bash
pip install fair-bioheaders-tools
```

Prebuilt wheels need no compiler. One `cp39-abi3` wheel serves every CPython
3.9 or later on its platform (free-threaded CPython is not supported):

| Platform | Wheel tag | Tested on |
| --- | --- | --- |
| Linux x86_64, glibc 2.28+ | `manylinux_2_28_x86_64` | Ubuntu 24.04, AlmaLinux 8 |
| Linux aarch64, glibc 2.28+ | `manylinux_2_28_aarch64` | Ubuntu 24.04, AlmaLinux 8 |
| Linux x86_64, musl | `musllinux_1_2_x86_64` | Alpine |
| Linux aarch64, musl | `musllinux_1_2_aarch64` | Alpine |
| macOS 11+ arm64 | `macosx_11_0_arm64` | macOS 15 |
| macOS 10.12+ x86_64 | `macosx_10_12_x86_64` | macOS 15 (Intel), while GitHub offers Intel runners |
| Windows x86_64 | `win_amd64` | Windows Server 2025 |

pip 20.3 or later is needed to recognise the `manylinux_2_28` tag, and a more
recent pip for `musllinux_1_2`; if pip offers to build from source on one of
these platforms, upgrade pip first (`python -m pip install --upgrade pip`).

**Elsewhere** pip builds from the source distribution, which needs Rust 1.85
or later (`cargo` on `PATH`, for example from <https://rustup.rs>) and a C
linker. If no Rust is installed, the build backend (maturin) downloads a Rust
toolchain for the build by default; set `MATURIN_NO_INSTALL_RUST=1` to forbid
that, in which case the build stops with "Cargo, the Rust package manager, is
not installed or is not on PATH". To refuse source builds entirely, install
with `pip install --only-binary :all: fair-bioheaders-tools`.

## Identity and rollback

`fair_bioheaders_tools.__version__` is the package version,
`ENGINE_VERSION` the Rust engine version and `ABI_VERSION` the engine ABI
(`0.1` in 0.1.x); each report's `provenance` names the contract bundle and its
digest. Release files are listed with their SHA-256 in `SHA256SUMS` on the
[GitHub Release](https://github.com/FAIR-bioHeaders/FAIR-bioHeaders-Tools/releases)
of the matching `core-vX.Y.Z` tag and carry build-provenance attestations
(`gh attestation verify FILE -R FAIR-bioHeaders/FAIR-bioHeaders-Tools`). Each
wheel ships `LICENSE`, the third-party notices (`THIRD-PARTY-LICENSES.yaml`)
and a CycloneDX SBOM in its `.dist-info`.

To roll back, pin the previous version (`fair-bioheaders-tools==X.Y.Z`). A bad
release is yanked on PyPI and replaced by a new version; files are never
replaced. Releases: [crates/CHANGELOG.md](https://github.com/FAIR-bioHeaders/FAIR-bioHeaders-Tools/blob/main/crates/CHANGELOG.md).

