Metadata-Version: 2.4
Name: equilibrator-cache-data
Version: 0.1.0
Summary: Bundled mini compound cache and accession index for equilibrator-cache
Author-email: Elad Noor <elad.noor@weizmann.ac.il>
License-Expression: MIT
Project-URL: repository, https://gitlab.com/equilibrator/equilibrator-cache-data/
Keywords: eQuilibrator,cache,data
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# equilibrator-cache-data

The mini compound cache and accession index that
[equilibrator-cache](https://gitlab.com/equilibrator/equilibrator-cache/) uses to
answer lookups without downloading the full ~1.3 GB database.

It carries two files and no code beyond the three constants needed to locate
them:

| file | size | contents |
| --- | --- | --- |
| `mini_compounds.sqlite` | ~62 MB | every compound in the KEGG and BiGG namespaces (~41k of ~694k), with their thermodynamic data and all their synonyms |
| `accessions.idx` | ~6 MB | a Bloom filter over every accession in the full database |

Together they compress to roughly 24 MB in a wheel.

The index is what lets a miss against the mini cache be classified without a
large transfer: it has no false negatives, so an identifier it rejects is
genuinely unknown and the lookup can fail fast. Only an identifier it accepts,
and that the mini cache does not hold, triggers the full download.

## Usage

Installing this package is all that is needed; `equilibrator-cache` finds it on
its own.

```python
import equilibrator_cache_data

equilibrator_cache_data.MINI_COMPOUND_CACHE_PATH
equilibrator_cache_data.ACCESSION_INDEX_PATH
equilibrator_cache_data.is_available()
```

## Why this is a separate project

`equilibrator-cache` releases on every tag. If the databases rode inside it,
every patch release would upload ~24 MB and every user would re-download it for
a one-line code fix. Versioning the data separately means it is fetched once and
reused across many code releases. Its version therefore tracks the *data*: bump
it only when the databases are rebuilt.

## Building

The databases are build artifacts and are not in git. Rebuild them from a local
copy of the full cache, which `equilibrator-cache` will have downloaded to
`~/.cache/equilibrator/compounds.sqlite`:

```shell
uv sync --group build
python scripts/build_mini_cache.py ~/.cache/equilibrator/compounds.sqlite
python -m build
```

The build script validates its own output: it checks that the index has no false
negatives against the full cache, that no rows were orphaned by the compound
filter, and that microspecies and synonyms both survived.

Building needs `equilibrator-cache` installed, for the accession index writer.
That is a development-time dependency only — the published wheel has no runtime
dependencies, so the two projects do not form an install-time cycle. Note that
the writer is not in the 0.7.1 release on PyPI, so the `build` group pins the
`minidb` branch until the tiered cache ships.

## Releasing

Tagging runs `build:databases`, which downloads the full cache from Zenodo,
rebuilds both databases, and checks that the wheel it produced is not the empty
package a plain checkout would give. `publish:pypi` then uploads it, and is
manual: a version number can never be reused once taken.

Publishing uses PyPI trusted publishing, so no API token is stored in GitLab.
It needs a trusted publisher registered on PyPI for namespace `equilibrator`,
project `equilibrator-cache-data`, pipeline file `.gitlab-ci.yml` and
environment `pypi`.
