Metadata-Version: 2.4
Name: pymetadata-core
Version: 0.3.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 :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Typing :: Typed
License-File: LICENSE
Summary: Lazy reading and writing of COMBINE archives (OMEX), a Rust core for pymetadata
Keywords: COMBINE,OMEX,SBML,SED-ML,systems biology
Author: Matthias König
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Repository, https://github.com/matthiaskoenig/pymetadata-core

# pymetadata-core

Lazy reading and writing of COMBINE archives (OMEX, a zip with a `manifest.xml`), as a Rust core with a python binding. Opening an archive reads the manifest and nothing else, an entry is inflated when it is asked for, and writing copies every untouched entry as the compressed blob it already is.

```python
from pymetadata_core import Archive, lookup_format

with open("model.omex", "rb") as f:
    archive = Archive.from_bytes(f.read())

print(archive.entries)  # [(location, format, master), ...]
sbml = archive.entry_bytes("./model.xml")

archive.set_entry("data/notes.txt", lookup_format("txt"), False, b"hello")
data = archive.to_bytes()  # only the new entry is deflated
```

Errors are raised as `pymetadata_core.OmexError`, a subclass of `ValueError`.

Inflating an entry, `set_entry` and writing the archive run without the GIL, so another thread can work meanwhile. An `Archive` is in use by one call at a time: a second thread which uses it meanwhile gets `pymetadata_core.ArchiveBusyError`, a `RuntimeError`. Use one `Archive` per thread.

The design is in [`docs/design/omex-core.md`](https://github.com/matthiaskoenig/pymetadata-core/blob/develop/docs/design/omex-core.md).

