Metadata-Version: 2.4
Name: pyHermiT
Version: 0.2.1
Summary: Java-free OWL 2 DL reasoning with pure-Python and optional Rust backends
Author: pyHermiT contributors
License-Expression: LGPL-3.0-or-later
Project-URL: Homepage, https://github.com/OAEI-ML/pyHermiT
Project-URL: Documentation, https://github.com/OAEI-ML/pyHermiT/tree/main/docs
Project-URL: Repository, https://github.com/OAEI-ML/pyHermiT
Project-URL: Issues, https://github.com/OAEI-ML/pyHermiT/issues
Project-URL: Specifications, https://github.com/OAEI-ML/pyHermiT/tree/main/specs
Keywords: OWL,OWL2,ontology,reasoner,semantic-web
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: COPYING
License-File: NOTICE.md
Requires-Dist: pyowl-core<0.3,>=0.2.1
Provides-Extra: dev
Requires-Dist: build<2,>=1.2; extra == "dev"
Requires-Dist: hypothesis<7,>=6.100; extra == "dev"
Requires-Dist: import-linter<3,>=2.1; extra == "dev"
Requires-Dist: mypy<3,>=1.10; extra == "dev"
Requires-Dist: packaging<27,>=24; extra == "dev"
Requires-Dist: pytest<10,>=8.2; extra == "dev"
Requires-Dist: pytest-cov<8,>=5; extra == "dev"
Requires-Dist: ruff==0.15.22; extra == "dev"
Requires-Dist: tomli<3,>=2.0; python_version < "3.11" and extra == "dev"
Dynamic: license-file

# pyHermiT

[![PyPI](https://img.shields.io/pypi/v/pyHermiT)](https://pypi.org/project/pyHermiT/)
[![Python](https://img.shields.io/pypi/pyversions/pyHermiT)](https://pypi.org/project/pyHermiT/)
[![License](https://img.shields.io/badge/license-LGPL--3.0--or--later-blue)](LICENSE)

pyHermiT is specified as a Java-free Python and Rust reimplementation of the core
HermiT OWL 2 DL reasoner, with a complete pure-Python fallback. It targets Python 3.10+
and uses the Java-free `pyowl-core` package for shared ontology parsing, immutable views,
overlays, composites, and zero-reparse communication with Exact-OM and other consumers.

The 0.2.1 production implementation provides the public reasoner facade, complete
pure-Python path, and an optional private Rust backend. It consumes the pyowl-core 0.2
model and can compile its encoded structural-view schema 2 directly in Rust. The normative
architecture, compatibility rules, backend completeness requirements, and verification plan
begin at [`specs/README.md`](specs/README.md). Built runtime artifacts contain no Java,
JVM launcher, Java bridge, or reference implementation.

## Installation

```shell
python -m pip install pyHermiT
```

A supported native wheel enables Rust acceleration automatically. The universal
wheel provides the complete compiler-free Python backend. Neither installation
contains, downloads, or starts Java.

## Quick start

```python
from pyowl_core import ImportPolicy, LoadOptions, load_snapshot
from pyhermit import Reasoner

ontology = (
    b"Prefix(:=<urn:example#>) Ontology(<urn:example> "
    b"Declaration(Class(:A)) Declaration(Class(:B)) SubClassOf(:A :B))"
)
view = load_snapshot(
    ontology,
    options=LoadOptions(imports=ImportPolicy.RESOLVE_STRICT),
)

with Reasoner(view) as reasoner:
    assert reasoner.ontology is view
    assert reasoner.is_consistent()
    taxonomy = reasoner.class_hierarchy()
```

See the [user guide](docs/user-guide.md) for backend selection, import
resolution, classification and realization queries, timeouts, updates, and
error handling. Existing 0.1 deployments should follow the
[0.2 migration guide](docs/migration-0.2.md) before reusing persisted data or caches.

## Release and licensing status

The owner has selected the source-guided implementation mode and
`LGPL-3.0-or-later`, matching the pinned upstream declaration. `LICENSE` contains the
LGPL text, `COPYING` the GPL text it incorporates, and `NOTICE.md` the initial upstream
attribution. The owner authorized `0.2.1` publication under the existing licensing policy;
`LIC-001` remains waived without representing that legal review occurred. The authorization
is recorded in
[`reports/release/0.2.1-owner-release-override.md`](reports/release/0.2.1-owner-release-override.md).
The completed repository audits are under
[`reports/licensing/`](reports/licensing/) and
[`reports/release/artifact-audit.md`](reports/release/artifact-audit.md).

## Strict native pipeline

`require_native_pipeline_support()` checks the native HermiT and pyowl-core receipt
capabilities before loading an ontology. Opt in with
`ReasonerConfig(require_native_pipeline=True)` to require native structural validation,
metadata, compilation and hierarchy processing. Defaults retain their existing behavior.
Strict mode currently supports consistency and class/object/data-property hierarchies on
core-validated native snapshot/segment owners. It rejects unsupported owners, Python or
verification backends, and Python byte-indexing fallback explicitly. Assertion-local generic
queries share the permanent native rules, join plans, role automata, datatype registries and
existential templates. Only their facts, clauses, witnesses and mutable tableau state are local.
Batches retain at most one active query state; result caches contain bounded Boolean results.

The admitted query syntax includes Boolean class expressions, nominals/equality, known role
assertions, existing source literals, universal restrictions and ground existential witnesses.
Unknown roles or new literal payloads, newly required inverse-role blocking, nested existential
expansions below variable-valued universal restrictions, and global schema/role changes retain
the full native rebuild path by default. Strict mode rejects these cases before publication.
Realization publication and committed updates are not yet admitted in strict mode. Recurring
committed updates have not been established as an Exact workload, so incremental admission
remains conditional rather than widening this query envelope.

`Reasoner.diagnostics()` reports the actual core receipt, metadata validation and domain
copies. `native_result_validation` becomes true after a successful native hierarchy result;
`native_result_publications` counts these publications. A positive capability probe does not
replace owner validation or admit an unsupported operation. The `native_query_*` counters
separately record delta loads, local rule plans, peak local records, legacy full-program loads
and default full-rebuild fallbacks. Query syntax is limited to 1 MiB per request, 16 MiB and
4,096 items per batch; exhausting a resource bound never enables a fallback.

## Documentation

Start with the [user guide](docs/user-guide.md) for backend selection, standalone and
shared-view loading, every service family, updates, concurrency, and errors. The
[API reference](docs/api-reference.md) enumerates every stable facade member, and the
[developer guide](docs/developer-guide.md) traces the core-view boundary through the
private IR and Python/Rust engines. The [documentation index](docs/index.md) links the
normative specifications and machine-readable evidence.

The historical `0.1.1` qualification is recorded in the
[release report](reports/release-report-local.json),
[coverage matrix](reports/coverage-matrix.json), and
[benchmark audit](benchmarks/evidence/WP17-local-audit.md). The owner accepted the
remaining licensed W3C, live-reference, and dedicated-performance runs as post-release
follow-up for `0.2.0`. The release workflow separately requires every configured native
target to pass before trusted publication.

## Development

Use Python 3.10 or newer and install a compatible `pyowl-core`:

```shell
python -m pip install \
  "pyowl-core>=0.2.1,<0.3" \
  "build>=1.2,<2" "hypothesis>=6.100,<7" "import-linter>=2.1,<3" \
  "mypy>=1.10,<3" "packaging>=24,<27" "pytest>=8.2,<10" \
  "pytest-cov>=5,<8" "ruff==0.15.22" "setuptools==83.0.0" \
  "setuptools-rust==1.13.0" "tomli>=2.0,<3; python_version < '3.11'"
PYHERMIT_BUILD_NATIVE=0 python -m pip install --no-build-isolation -e .
python -m pytest
python -m tools.specs.check_workpackages
python -m tools.specs.check_project
python -m tools.specs.check_links
python -m tools.specs.check_release_gate --require-publishable
ruff format --check .
ruff check .
mypy
lint-imports
cargo deny --manifest-path native/Cargo.toml check --config deny.toml
```

Build and inspect the compiler-free artifacts with:

```shell
SOURCE_DATE_EPOCH=946684800 PYHERMIT_BUILD_NATIVE=0 python -m build
python -m tools.packaging_probe.check_artifact --pure dist/*.whl
python -m tools.packaging_probe.check_artifact dist/*.tar.gz
```

`PYHERMIT_BUILD_NATIVE=auto|0|1` is the only supported build switch:

- `auto` (default) attempts the optional native extension when Cargo is available and
  otherwise produces a truthfully tagged Python-only local build;
- `0` never declares the extension and produces the reproducible `py3-none-any`
  fallback; and
- `1` requires the locked Rust build and fails instead of silently falling back.

The distribution workflow builds the sdist, universal fallback, and the eight required
`cp310-abi3` manylinux 2.17, musllinux 1.2, macOS, and Windows x86-64/ARM64 targets. It
audits Rust advisories/licenses/sources, ABI, and external libraries; installs on CPython
3.10 and 3.12; compares
pure/native metadata and Python payloads, and verifies local-index resolver preference.
The target manifest remains `configured-awaiting-hosted-validation` until those hosted
jobs pass. The universal Python fallback is the portable production artifact while
additional native wheels complete that hosted validation.
