Metadata-Version: 2.4
Name: anitomy-ng
Version: 1.0.0
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Typing :: Typed
Requires-Dist: ruff>=0.11 ; extra == 'lint'
Requires-Dist: pyright>=1.1.400 ; extra == 'lint'
Requires-Dist: pytest ; extra == 'test'
Provides-Extra: lint
Provides-Extra: test
License-File: LICENSE
Summary: Anime video filename parser (Python bindings for the anitomy-ng Rust crate)
Keywords: anime,parser,filename,anitomy
License: MPL-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Issues, https://github.com/tylergibbs2/anitomy-ng/issues
Project-URL: Repository, https://github.com/tylergibbs2/anitomy-ng

# anitomy-ng

[![CI](https://github.com/tylergibbs2/anitomy-ng/actions/workflows/ci.yml/badge.svg)](https://github.com/tylergibbs2/anitomy-ng/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/anitomy-ng.svg)](https://crates.io/crates/anitomy-ng)
[![docs.rs](https://img.shields.io/docsrs/anitomy-ng.svg)](https://docs.rs/anitomy-ng)
[![PyPI](https://img.shields.io/pypi/v/anitomy-ng.svg)](https://pypi.org/project/anitomy-ng/)
[![License: MPL 2.0](https://img.shields.io/badge/License-MPL_2.0-brightgreen.svg)](https://www.mozilla.org/en-US/MPL/2.0/)

A pure-Rust port of [erengy/anitomy](https://github.com/erengy/anitomy), an
anime video filename parser, with Python bindings. No `unsafe`, no C
dependencies.

```
[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv
```
parses into release group, title, year, episode, resolution, video/audio
codec, release version, and file checksum — see the examples below.

**Status**: conformance-tested against upstream's own bundled test data (the
current C++ rewrite on the `develop` branch and the original, long-frozen
`master` implementation), plus the
[anitopy](https://github.com/igorcmoura/anitopy) Python port's fixtures. On
each suite it scores at least as high as that suite's reference parser, run
as a compiled/installed binary rather than judged from its source.

## Install

Rust:

```sh
cargo add anitomy-ng
```

Python (wheels built via [maturin](https://www.maturin.rs/)):

```sh
pip install anitomy-ng
```

## Usage

Rust:

```rust
let elements = anitomy_ng::parse(
    "[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv",
    anitomy_ng::Options::default(),
);
for element in &elements {
    println!("{:?}: {}", element.kind, element.value);
}
```

Python:

```python
import anitomy_ng

for element in anitomy_ng.parse(
    "[TaigaSubs]_Toradora!_(2008)_-_01v2_-_Tiger_and_Dragon_[1280x720_H.264_FLAC][1234ABCD].mkv"
):
    print(element.kind, element.value)
```

Both return an ordered list of elements (position in the filename, kind, and
value); `ElementKind`/`kind` covers title, episode, season, release group,
video/audio terms, resolution, checksum, and so on — see
[`anitomy/src/element.rs`](anitomy/src/element.rs) for the full set.

## Layout

```
anitomy/       core Rust crate (published as `anitomy-ng`) — no unsafe, no non-dev dependencies
anitomy-py/    Python bindings (pyo3 + maturin, published as `anitomy-ng`), typed:
               ElementKind is a real enum.Enum, Element a real dataclass
third_party/   vendored upstream test fixtures, not compiled — see third_party/README.md
scripts/       fixture-generation tooling
```

## Development

```sh
cargo test -p anitomy-ng --test conformance     # Rust conformance suite
cd anitomy-py && uv run --extra test pytest tests/ -q   # Python conformance suite
```

## License

Licensed under the Mozilla Public License 2.0 — see [`LICENSE`](LICENSE).

This project builds on the following, **all MPL-2.0**, and is distributed
under the same license accordingly:

- [erengy/anitomy](https://github.com/erengy/anitomy) (© Eren Okka) — the C++
  implementation this project is a port of.
- [Rapptz/anitomy-rs](https://github.com/Rapptz/anitomy-rs) (© Rapptz) — an
  independent Rust reimplementation; some logic and beyond-upstream keywords
  are adapted from it.
- [igorcmoura/anitopy](https://github.com/igorcmoura/anitopy) (© Igor C.
  Moura) — its test data (`table.py`/`failing_table.py`) is used as a
  conformance fixture suite.

`third_party/` vendors this upstream material under their own MPL-2.0
licenses — see [`third_party/README.md`](third_party/README.md).

