equilibrator-cache-data 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- equilibrator_cache_data-0.1.0/LICENSE +25 -0
- equilibrator_cache_data-0.1.0/PKG-INFO +94 -0
- equilibrator_cache_data-0.1.0/README.md +75 -0
- equilibrator_cache_data-0.1.0/pyproject.toml +71 -0
- equilibrator_cache_data-0.1.0/setup.cfg +4 -0
- equilibrator_cache_data-0.1.0/src/equilibrator_cache_data/__init__.py +42 -0
- equilibrator_cache_data-0.1.0/src/equilibrator_cache_data/accessions.idx +0 -0
- equilibrator_cache_data-0.1.0/src/equilibrator_cache_data/mini_compounds.sqlite +4 -0
- equilibrator_cache_data-0.1.0/src/equilibrator_cache_data.egg-info/PKG-INFO +94 -0
- equilibrator_cache_data-0.1.0/src/equilibrator_cache_data.egg-info/SOURCES.txt +11 -0
- equilibrator_cache_data-0.1.0/src/equilibrator_cache_data.egg-info/dependency_links.txt +1 -0
- equilibrator_cache_data-0.1.0/src/equilibrator_cache_data.egg-info/top_level.txt +1 -0
- equilibrator_cache_data-0.1.0/tests/test_data_package.py +111 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 Weizmann Institute of Science
|
|
4
|
+
Copyright (c) 2018,2019 Institute for Molecular Systems Biology,
|
|
5
|
+
ETH Zurich
|
|
6
|
+
Copyright (c) 2018,2019 Novo Nordisk Foundation Center for Biosustainability,
|
|
7
|
+
Technical University of Denmark
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in
|
|
17
|
+
all copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: equilibrator-cache-data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Bundled mini compound cache and accession index for equilibrator-cache
|
|
5
|
+
Author-email: Elad Noor <elad.noor@weizmann.ac.il>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: repository, https://gitlab.com/equilibrator/equilibrator-cache-data/
|
|
8
|
+
Keywords: eQuilibrator,cache,data
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# equilibrator-cache-data
|
|
21
|
+
|
|
22
|
+
The mini compound cache and accession index that
|
|
23
|
+
[equilibrator-cache](https://gitlab.com/equilibrator/equilibrator-cache/) uses to
|
|
24
|
+
answer lookups without downloading the full ~1.3 GB database.
|
|
25
|
+
|
|
26
|
+
It carries two files and no code beyond the three constants needed to locate
|
|
27
|
+
them:
|
|
28
|
+
|
|
29
|
+
| file | size | contents |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| `mini_compounds.sqlite` | ~62 MB | every compound in the KEGG and BiGG namespaces (~41k of ~694k), with their thermodynamic data and all their synonyms |
|
|
32
|
+
| `accessions.idx` | ~6 MB | a Bloom filter over every accession in the full database |
|
|
33
|
+
|
|
34
|
+
Together they compress to roughly 24 MB in a wheel.
|
|
35
|
+
|
|
36
|
+
The index is what lets a miss against the mini cache be classified without a
|
|
37
|
+
large transfer: it has no false negatives, so an identifier it rejects is
|
|
38
|
+
genuinely unknown and the lookup can fail fast. Only an identifier it accepts,
|
|
39
|
+
and that the mini cache does not hold, triggers the full download.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Installing this package is all that is needed; `equilibrator-cache` finds it on
|
|
44
|
+
its own.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import equilibrator_cache_data
|
|
48
|
+
|
|
49
|
+
equilibrator_cache_data.MINI_COMPOUND_CACHE_PATH
|
|
50
|
+
equilibrator_cache_data.ACCESSION_INDEX_PATH
|
|
51
|
+
equilibrator_cache_data.is_available()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Why this is a separate project
|
|
55
|
+
|
|
56
|
+
`equilibrator-cache` releases on every tag. If the databases rode inside it,
|
|
57
|
+
every patch release would upload ~24 MB and every user would re-download it for
|
|
58
|
+
a one-line code fix. Versioning the data separately means it is fetched once and
|
|
59
|
+
reused across many code releases. Its version therefore tracks the *data*: bump
|
|
60
|
+
it only when the databases are rebuilt.
|
|
61
|
+
|
|
62
|
+
## Building
|
|
63
|
+
|
|
64
|
+
The databases are build artifacts and are not in git. Rebuild them from a local
|
|
65
|
+
copy of the full cache, which `equilibrator-cache` will have downloaded to
|
|
66
|
+
`~/.cache/equilibrator/compounds.sqlite`:
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
uv sync --group build
|
|
70
|
+
python scripts/build_mini_cache.py ~/.cache/equilibrator/compounds.sqlite
|
|
71
|
+
python -m build
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The build script validates its own output: it checks that the index has no false
|
|
75
|
+
negatives against the full cache, that no rows were orphaned by the compound
|
|
76
|
+
filter, and that microspecies and synonyms both survived.
|
|
77
|
+
|
|
78
|
+
Building needs `equilibrator-cache` installed, for the accession index writer.
|
|
79
|
+
That is a development-time dependency only — the published wheel has no runtime
|
|
80
|
+
dependencies, so the two projects do not form an install-time cycle. Note that
|
|
81
|
+
the writer is not in the 0.7.1 release on PyPI, so the `build` group pins the
|
|
82
|
+
`minidb` branch until the tiered cache ships.
|
|
83
|
+
|
|
84
|
+
## Releasing
|
|
85
|
+
|
|
86
|
+
Tagging runs `build:databases`, which downloads the full cache from Zenodo,
|
|
87
|
+
rebuilds both databases, and checks that the wheel it produced is not the empty
|
|
88
|
+
package a plain checkout would give. `publish:pypi` then uploads it, and is
|
|
89
|
+
manual: a version number can never be reused once taken.
|
|
90
|
+
|
|
91
|
+
Publishing uses PyPI trusted publishing, so no API token is stored in GitLab.
|
|
92
|
+
It needs a trusted publisher registered on PyPI for namespace `equilibrator`,
|
|
93
|
+
project `equilibrator-cache-data`, pipeline file `.gitlab-ci.yml` and
|
|
94
|
+
environment `pypi`.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# equilibrator-cache-data
|
|
2
|
+
|
|
3
|
+
The mini compound cache and accession index that
|
|
4
|
+
[equilibrator-cache](https://gitlab.com/equilibrator/equilibrator-cache/) uses to
|
|
5
|
+
answer lookups without downloading the full ~1.3 GB database.
|
|
6
|
+
|
|
7
|
+
It carries two files and no code beyond the three constants needed to locate
|
|
8
|
+
them:
|
|
9
|
+
|
|
10
|
+
| file | size | contents |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| `mini_compounds.sqlite` | ~62 MB | every compound in the KEGG and BiGG namespaces (~41k of ~694k), with their thermodynamic data and all their synonyms |
|
|
13
|
+
| `accessions.idx` | ~6 MB | a Bloom filter over every accession in the full database |
|
|
14
|
+
|
|
15
|
+
Together they compress to roughly 24 MB in a wheel.
|
|
16
|
+
|
|
17
|
+
The index is what lets a miss against the mini cache be classified without a
|
|
18
|
+
large transfer: it has no false negatives, so an identifier it rejects is
|
|
19
|
+
genuinely unknown and the lookup can fail fast. Only an identifier it accepts,
|
|
20
|
+
and that the mini cache does not hold, triggers the full download.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
Installing this package is all that is needed; `equilibrator-cache` finds it on
|
|
25
|
+
its own.
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import equilibrator_cache_data
|
|
29
|
+
|
|
30
|
+
equilibrator_cache_data.MINI_COMPOUND_CACHE_PATH
|
|
31
|
+
equilibrator_cache_data.ACCESSION_INDEX_PATH
|
|
32
|
+
equilibrator_cache_data.is_available()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Why this is a separate project
|
|
36
|
+
|
|
37
|
+
`equilibrator-cache` releases on every tag. If the databases rode inside it,
|
|
38
|
+
every patch release would upload ~24 MB and every user would re-download it for
|
|
39
|
+
a one-line code fix. Versioning the data separately means it is fetched once and
|
|
40
|
+
reused across many code releases. Its version therefore tracks the *data*: bump
|
|
41
|
+
it only when the databases are rebuilt.
|
|
42
|
+
|
|
43
|
+
## Building
|
|
44
|
+
|
|
45
|
+
The databases are build artifacts and are not in git. Rebuild them from a local
|
|
46
|
+
copy of the full cache, which `equilibrator-cache` will have downloaded to
|
|
47
|
+
`~/.cache/equilibrator/compounds.sqlite`:
|
|
48
|
+
|
|
49
|
+
```shell
|
|
50
|
+
uv sync --group build
|
|
51
|
+
python scripts/build_mini_cache.py ~/.cache/equilibrator/compounds.sqlite
|
|
52
|
+
python -m build
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The build script validates its own output: it checks that the index has no false
|
|
56
|
+
negatives against the full cache, that no rows were orphaned by the compound
|
|
57
|
+
filter, and that microspecies and synonyms both survived.
|
|
58
|
+
|
|
59
|
+
Building needs `equilibrator-cache` installed, for the accession index writer.
|
|
60
|
+
That is a development-time dependency only — the published wheel has no runtime
|
|
61
|
+
dependencies, so the two projects do not form an install-time cycle. Note that
|
|
62
|
+
the writer is not in the 0.7.1 release on PyPI, so the `build` group pins the
|
|
63
|
+
`minidb` branch until the tiered cache ships.
|
|
64
|
+
|
|
65
|
+
## Releasing
|
|
66
|
+
|
|
67
|
+
Tagging runs `build:databases`, which downloads the full cache from Zenodo,
|
|
68
|
+
rebuilds both databases, and checks that the wheel it produced is not the empty
|
|
69
|
+
package a plain checkout would give. `publish:pypi` then uploads it, and is
|
|
70
|
+
manual: a version number can never be reused once taken.
|
|
71
|
+
|
|
72
|
+
Publishing uses PyPI trusted publishing, so no API token is stored in GitLab.
|
|
73
|
+
It needs a trusted publisher registered on PyPI for namespace `equilibrator`,
|
|
74
|
+
project `equilibrator-cache-data`, pipeline file `.gitlab-ci.yml` and
|
|
75
|
+
environment `pypi`.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "equilibrator-cache-data"
|
|
3
|
+
description = "Bundled mini compound cache and accession index for equilibrator-cache"
|
|
4
|
+
readme = {file = "README.md", content-type = "text/markdown"}
|
|
5
|
+
license = "MIT"
|
|
6
|
+
license-files = ["LICENSE"]
|
|
7
|
+
authors = [
|
|
8
|
+
{name = "Elad Noor", email = "elad.noor@weizmann.ac.il"}
|
|
9
|
+
]
|
|
10
|
+
keywords = [
|
|
11
|
+
"eQuilibrator",
|
|
12
|
+
"cache",
|
|
13
|
+
"data",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Science/Research",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics",
|
|
19
|
+
"Natural Language :: English",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
]
|
|
23
|
+
requires-python = ">=3.11"
|
|
24
|
+
|
|
25
|
+
# No runtime dependencies: this project only carries data files. equilibrator-cache
|
|
26
|
+
# depends on it, and it needs equilibrator-cache to *build* the databases (see the
|
|
27
|
+
# build group below), but that is development-time only, so the two do not form an
|
|
28
|
+
# install-time cycle.
|
|
29
|
+
dependencies = []
|
|
30
|
+
|
|
31
|
+
# Versioned by the data it carries, not by the equilibrator-cache release it is
|
|
32
|
+
# installed alongside. Bump this only when the databases themselves are rebuilt,
|
|
33
|
+
# so that ordinary code releases do not make everyone re-download ~24 MB.
|
|
34
|
+
version = "0.1.0"
|
|
35
|
+
|
|
36
|
+
[dependency-groups]
|
|
37
|
+
# Building needs equilibrator_cache.accession_index to write the index, and that
|
|
38
|
+
# module is not in the 0.7.1 release on PyPI. Pinned to the branch until the
|
|
39
|
+
# tiered cache ships; replace with "equilibrator-cache >=0.8" once it does.
|
|
40
|
+
build = [
|
|
41
|
+
"equilibrator-cache @ git+https://gitlab.com/equilibrator/equilibrator-cache.git@minidb",
|
|
42
|
+
"build",
|
|
43
|
+
]
|
|
44
|
+
test = [
|
|
45
|
+
"pytest",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
repository = "https://gitlab.com/equilibrator/equilibrator-cache-data/"
|
|
50
|
+
|
|
51
|
+
[build-system]
|
|
52
|
+
requires = ["setuptools>=77", "wheel"]
|
|
53
|
+
build-backend = "setuptools.build_meta"
|
|
54
|
+
|
|
55
|
+
[tool.setuptools.packages.find]
|
|
56
|
+
where = ["src"]
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.package-data]
|
|
59
|
+
equilibrator_cache_data = ["*.sqlite", "*.idx"]
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
markers = [
|
|
63
|
+
"needs_full_db: needs a local copy of the full (~1.3 GB) compound cache. Deselected by default; run with `pytest -m needs_full_db`.",
|
|
64
|
+
]
|
|
65
|
+
addopts = '-m "not needs_full_db"'
|
|
66
|
+
|
|
67
|
+
[tool.ruff]
|
|
68
|
+
target-version = "py311"
|
|
69
|
+
|
|
70
|
+
[tool.ruff.lint]
|
|
71
|
+
ignore = ["F401"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Locate the compound cache databases bundled with this package."""
|
|
2
|
+
|
|
3
|
+
# The MIT License (MIT)
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2013 The Weizmann Institute of Science.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
|
15
|
+
# all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
# THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
import pathlib
|
|
26
|
+
|
|
27
|
+
__all__ = ("ACCESSION_INDEX_PATH", "MINI_COMPOUND_CACHE_PATH", "is_available")
|
|
28
|
+
|
|
29
|
+
_HERE = pathlib.Path(__file__).parent
|
|
30
|
+
|
|
31
|
+
MINI_COMPOUND_CACHE_PATH = _HERE / "mini_compounds.sqlite"
|
|
32
|
+
ACCESSION_INDEX_PATH = _HERE / "accessions.idx"
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def is_available() -> bool:
|
|
36
|
+
"""Return True if both data files were actually included in this install.
|
|
37
|
+
|
|
38
|
+
An install built without running ``scripts/populate_data_package.py`` yields
|
|
39
|
+
an importable but empty package, so importing it is not by itself proof that
|
|
40
|
+
the databases are there.
|
|
41
|
+
"""
|
|
42
|
+
return MINI_COMPOUND_CACHE_PATH.is_file() and ACCESSION_INDEX_PATH.is_file()
|
|
Binary file
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: equilibrator-cache-data
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Bundled mini compound cache and accession index for equilibrator-cache
|
|
5
|
+
Author-email: Elad Noor <elad.noor@weizmann.ac.il>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: repository, https://gitlab.com/equilibrator/equilibrator-cache-data/
|
|
8
|
+
Keywords: eQuilibrator,cache,data
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# equilibrator-cache-data
|
|
21
|
+
|
|
22
|
+
The mini compound cache and accession index that
|
|
23
|
+
[equilibrator-cache](https://gitlab.com/equilibrator/equilibrator-cache/) uses to
|
|
24
|
+
answer lookups without downloading the full ~1.3 GB database.
|
|
25
|
+
|
|
26
|
+
It carries two files and no code beyond the three constants needed to locate
|
|
27
|
+
them:
|
|
28
|
+
|
|
29
|
+
| file | size | contents |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| `mini_compounds.sqlite` | ~62 MB | every compound in the KEGG and BiGG namespaces (~41k of ~694k), with their thermodynamic data and all their synonyms |
|
|
32
|
+
| `accessions.idx` | ~6 MB | a Bloom filter over every accession in the full database |
|
|
33
|
+
|
|
34
|
+
Together they compress to roughly 24 MB in a wheel.
|
|
35
|
+
|
|
36
|
+
The index is what lets a miss against the mini cache be classified without a
|
|
37
|
+
large transfer: it has no false negatives, so an identifier it rejects is
|
|
38
|
+
genuinely unknown and the lookup can fail fast. Only an identifier it accepts,
|
|
39
|
+
and that the mini cache does not hold, triggers the full download.
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Installing this package is all that is needed; `equilibrator-cache` finds it on
|
|
44
|
+
its own.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import equilibrator_cache_data
|
|
48
|
+
|
|
49
|
+
equilibrator_cache_data.MINI_COMPOUND_CACHE_PATH
|
|
50
|
+
equilibrator_cache_data.ACCESSION_INDEX_PATH
|
|
51
|
+
equilibrator_cache_data.is_available()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Why this is a separate project
|
|
55
|
+
|
|
56
|
+
`equilibrator-cache` releases on every tag. If the databases rode inside it,
|
|
57
|
+
every patch release would upload ~24 MB and every user would re-download it for
|
|
58
|
+
a one-line code fix. Versioning the data separately means it is fetched once and
|
|
59
|
+
reused across many code releases. Its version therefore tracks the *data*: bump
|
|
60
|
+
it only when the databases are rebuilt.
|
|
61
|
+
|
|
62
|
+
## Building
|
|
63
|
+
|
|
64
|
+
The databases are build artifacts and are not in git. Rebuild them from a local
|
|
65
|
+
copy of the full cache, which `equilibrator-cache` will have downloaded to
|
|
66
|
+
`~/.cache/equilibrator/compounds.sqlite`:
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
uv sync --group build
|
|
70
|
+
python scripts/build_mini_cache.py ~/.cache/equilibrator/compounds.sqlite
|
|
71
|
+
python -m build
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The build script validates its own output: it checks that the index has no false
|
|
75
|
+
negatives against the full cache, that no rows were orphaned by the compound
|
|
76
|
+
filter, and that microspecies and synonyms both survived.
|
|
77
|
+
|
|
78
|
+
Building needs `equilibrator-cache` installed, for the accession index writer.
|
|
79
|
+
That is a development-time dependency only — the published wheel has no runtime
|
|
80
|
+
dependencies, so the two projects do not form an install-time cycle. Note that
|
|
81
|
+
the writer is not in the 0.7.1 release on PyPI, so the `build` group pins the
|
|
82
|
+
`minidb` branch until the tiered cache ships.
|
|
83
|
+
|
|
84
|
+
## Releasing
|
|
85
|
+
|
|
86
|
+
Tagging runs `build:databases`, which downloads the full cache from Zenodo,
|
|
87
|
+
rebuilds both databases, and checks that the wheel it produced is not the empty
|
|
88
|
+
package a plain checkout would give. `publish:pypi` then uploads it, and is
|
|
89
|
+
manual: a version number can never be reused once taken.
|
|
90
|
+
|
|
91
|
+
Publishing uses PyPI trusted publishing, so no API token is stored in GitLab.
|
|
92
|
+
It needs a trusted publisher registered on PyPI for namespace `equilibrator`,
|
|
93
|
+
project `equilibrator-cache-data`, pipeline file `.gitlab-ci.yml` and
|
|
94
|
+
environment `pypi`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/equilibrator_cache_data/__init__.py
|
|
5
|
+
src/equilibrator_cache_data/accessions.idx
|
|
6
|
+
src/equilibrator_cache_data/mini_compounds.sqlite
|
|
7
|
+
src/equilibrator_cache_data.egg-info/PKG-INFO
|
|
8
|
+
src/equilibrator_cache_data.egg-info/SOURCES.txt
|
|
9
|
+
src/equilibrator_cache_data.egg-info/dependency_links.txt
|
|
10
|
+
src/equilibrator_cache_data.egg-info/top_level.txt
|
|
11
|
+
tests/test_data_package.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
equilibrator_cache_data
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""Test that the packaged databases are present and usable."""
|
|
2
|
+
|
|
3
|
+
# The MIT License (MIT)
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2013 The Weizmann Institute of Science.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
|
15
|
+
# all copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
# THE SOFTWARE.
|
|
24
|
+
|
|
25
|
+
import sqlite3
|
|
26
|
+
|
|
27
|
+
import pytest
|
|
28
|
+
|
|
29
|
+
import equilibrator_cache_data
|
|
30
|
+
|
|
31
|
+
pytestmark = pytest.mark.skipif(
|
|
32
|
+
not equilibrator_cache_data.is_available(),
|
|
33
|
+
reason="databases not built; run scripts/build_mini_cache.py",
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
EXPECTED_TABLES = {
|
|
37
|
+
"compounds",
|
|
38
|
+
"compound_identifiers",
|
|
39
|
+
"compound_microspecies",
|
|
40
|
+
"magnesium_dissociation_constant",
|
|
41
|
+
"registries",
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@pytest.fixture(scope="module")
|
|
46
|
+
def mini():
|
|
47
|
+
connection = sqlite3.connect(equilibrator_cache_data.MINI_COMPOUND_CACHE_PATH)
|
|
48
|
+
yield connection
|
|
49
|
+
connection.close()
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_schema_matches_the_full_cache(mini):
|
|
53
|
+
tables = {
|
|
54
|
+
row[0]
|
|
55
|
+
for row in mini.execute("SELECT name FROM sqlite_master WHERE type='table'")
|
|
56
|
+
}
|
|
57
|
+
assert EXPECTED_TABLES <= tables
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_thermodynamic_data_survived_the_filter(mini):
|
|
61
|
+
"""A mini cache without microspecies cannot transform anything."""
|
|
62
|
+
assert mini.execute("SELECT COUNT(*) FROM compound_microspecies").fetchone()[0] > 0
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_every_compound_keeps_its_synonyms(mini):
|
|
66
|
+
"""Synonyms are what make search and get_common_name work."""
|
|
67
|
+
compounds = mini.execute("SELECT COUNT(*) FROM compounds").fetchone()[0]
|
|
68
|
+
named = mini.execute(
|
|
69
|
+
"""SELECT COUNT(DISTINCT ci.compound_id) FROM compound_identifiers ci
|
|
70
|
+
JOIN registries r ON ci.registry_id = r.id WHERE r.name = 'Synonyms'"""
|
|
71
|
+
).fetchone()[0]
|
|
72
|
+
assert named == compounds
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_no_rows_orphaned_by_the_compound_filter(mini):
|
|
76
|
+
for table in ("compound_identifiers", "compound_microspecies"):
|
|
77
|
+
orphans = mini.execute(
|
|
78
|
+
f"SELECT COUNT(*) FROM {table} "
|
|
79
|
+
"WHERE compound_id NOT IN (SELECT id FROM compounds)"
|
|
80
|
+
).fetchone()[0]
|
|
81
|
+
assert orphans == 0, table
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_reads_without_a_write_journal(mini):
|
|
85
|
+
"""The wheel installs into a read-only site-packages on many systems."""
|
|
86
|
+
assert mini.execute("PRAGMA journal_mode").fetchone()[0] == "delete"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_index_is_loadable_and_rejects_nonsense():
|
|
90
|
+
accession_index = pytest.importorskip("equilibrator_cache.accession_index")
|
|
91
|
+
index = accession_index.AccessionIndex.load(
|
|
92
|
+
equilibrator_cache_data.ACCESSION_INDEX_PATH
|
|
93
|
+
)
|
|
94
|
+
assert "C00002" in index
|
|
95
|
+
assert "NOT-A-REAL-ACCESSION-12345" not in index
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def test_index_covers_every_accession_in_the_mini_cache(mini):
|
|
99
|
+
"""A false negative here would turn a resolvable compound into a silent None."""
|
|
100
|
+
accession_index = pytest.importorskip("equilibrator_cache.accession_index")
|
|
101
|
+
index = accession_index.AccessionIndex.load(
|
|
102
|
+
equilibrator_cache_data.ACCESSION_INDEX_PATH
|
|
103
|
+
)
|
|
104
|
+
missing = [
|
|
105
|
+
accession
|
|
106
|
+
for (accession,) in mini.execute(
|
|
107
|
+
"SELECT DISTINCT accession FROM compound_identifiers"
|
|
108
|
+
)
|
|
109
|
+
if accession not in index
|
|
110
|
+
]
|
|
111
|
+
assert missing == []
|