bioversions 0.5.552__py3-none-any.whl → 0.5.553__py3-none-any.whl
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.
- bioversions/__init__.py +7 -3
- bioversions/__main__.py +0 -2
- bioversions/charts.py +3 -7
- bioversions/cli.py +3 -5
- bioversions/resources/__init__.py +1 -3
- bioversions/resources/update.py +1 -3
- bioversions/resources/versions.json +19543 -0
- bioversions/slack_client.py +2 -5
- bioversions/sources/__init__.py +13 -11
- bioversions/sources/antibodyregistry.py +0 -2
- bioversions/sources/bigg.py +5 -7
- bioversions/sources/biogrid.py +0 -2
- bioversions/sources/cellosaurus.py +3 -5
- bioversions/sources/chebi.py +1 -3
- bioversions/sources/chembl.py +3 -4
- bioversions/sources/chemidplus.py +1 -3
- bioversions/sources/civic.py +4 -2
- bioversions/sources/complexportal.py +0 -2
- bioversions/sources/daily.py +0 -2
- bioversions/sources/depmap.py +1 -3
- bioversions/sources/dgi.py +1 -3
- bioversions/sources/disgenet.py +1 -3
- bioversions/sources/drugbank.py +2 -4
- bioversions/sources/drugcentral.py +2 -4
- bioversions/sources/ensembl.py +1 -3
- bioversions/sources/expasy.py +0 -3
- bioversions/sources/flybase.py +0 -2
- bioversions/sources/gtdb.py +35 -0
- bioversions/sources/guidetopharmacology.py +3 -5
- bioversions/sources/hgnc.py +1 -1
- bioversions/sources/homologene.py +0 -2
- bioversions/sources/icd10.py +1 -3
- bioversions/sources/icd11.py +1 -3
- bioversions/sources/icf.py +1 -3
- bioversions/sources/intact.py +0 -2
- bioversions/sources/interpro.py +1 -3
- bioversions/sources/itis.py +1 -3
- bioversions/sources/kegg.py +5 -6
- bioversions/sources/mesh.py +0 -2
- bioversions/sources/mgi.py +0 -2
- bioversions/sources/mirbase.py +13 -8
- bioversions/sources/moalmanac.py +0 -2
- bioversions/sources/msigdb.py +0 -2
- bioversions/sources/ncit.py +1 -4
- bioversions/sources/npass.py +0 -2
- bioversions/sources/obo.py +2 -4
- bioversions/sources/ols.py +6 -8
- bioversions/sources/omim.py +2 -3
- bioversions/sources/oncotree.py +4 -4
- bioversions/sources/pathbank.py +0 -2
- bioversions/sources/pathwaycommons.py +0 -2
- bioversions/sources/pfam.py +0 -2
- bioversions/sources/pombase.py +0 -2
- bioversions/sources/pr.py +1 -3
- bioversions/sources/pubchem.py +0 -2
- bioversions/sources/reactome.py +0 -2
- bioversions/sources/rfam.py +0 -2
- bioversions/sources/rgd.py +0 -2
- bioversions/sources/rhea.py +0 -2
- bioversions/sources/rxnorm.py +0 -2
- bioversions/sources/sgd.py +0 -2
- bioversions/sources/slm.py +1 -1
- bioversions/sources/stringdb.py +2 -4
- bioversions/sources/umls.py +0 -2
- bioversions/sources/uniprot.py +1 -3
- bioversions/sources/unversioned.py +0 -2
- bioversions/sources/wikipathways.py +0 -2
- bioversions/sources/zfin.py +0 -2
- bioversions/templates/base.html +28 -0
- bioversions/templates/home.html +60 -0
- bioversions/twitter_client.py +5 -8
- bioversions/utils.py +30 -28
- bioversions/version.py +3 -5
- bioversions/wsgi.py +2 -4
- {bioversions-0.5.552.dist-info → bioversions-0.5.553.dist-info}/LICENSE +1 -1
- bioversions-0.5.553.dist-info/METADATA +382 -0
- bioversions-0.5.553.dist-info/RECORD +81 -0
- bioversions-0.5.552.dist-info/METADATA +0 -166
- bioversions-0.5.552.dist-info/RECORD +0 -77
- {bioversions-0.5.552.dist-info → bioversions-0.5.553.dist-info}/WHEEL +0 -0
- {bioversions-0.5.552.dist-info → bioversions-0.5.553.dist-info}/entry_points.txt +0 -0
- {bioversions-0.5.552.dist-info → bioversions-0.5.553.dist-info}/top_level.txt +0 -0
bioversions/sources/ncit.py
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""A getter for the NCI Thesaurus."""
|
4
2
|
|
5
3
|
import re
|
6
|
-
from typing import Dict
|
7
4
|
|
8
5
|
from ..utils import Getter, VersionType, get_soup
|
9
6
|
|
@@ -25,7 +22,7 @@ class NCItGetter(Getter):
|
|
25
22
|
date_fmt = "%Y-%m-%d"
|
26
23
|
version_type = VersionType.other
|
27
24
|
|
28
|
-
def get(self) ->
|
25
|
+
def get(self) -> dict[str, str]:
|
29
26
|
"""Get the latest NCIt version number."""
|
30
27
|
soup = get_soup(URL)
|
31
28
|
version_str = soup.find("span", {"class": "vocabularynamelong_ncit"}).contents[0]
|
bioversions/sources/npass.py
CHANGED
bioversions/sources/obo.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Getters for OBO ontologies."""
|
4
2
|
|
5
|
-
from
|
3
|
+
from collections.abc import Iterable
|
6
4
|
|
7
5
|
from bioversions.utils import Getter, OBOFoundryGetter, VersionType
|
8
6
|
|
@@ -56,7 +54,7 @@ class PrGetter(OBOFoundryGetter):
|
|
56
54
|
homepage_fmt = "https://proconsortium.org/download/release_{version}/"
|
57
55
|
|
58
56
|
|
59
|
-
def iter_obo_getters() -> Iterable[
|
57
|
+
def iter_obo_getters() -> Iterable[type[Getter]]:
|
60
58
|
"""Iterate over OBO getters."""
|
61
59
|
yield from OBOFoundryGetter.__subclasses__()
|
62
60
|
|
bioversions/sources/ols.py
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Get versions from the OLS."""
|
4
2
|
|
5
3
|
import logging
|
6
|
-
from
|
4
|
+
from collections.abc import Iterable, Mapping
|
7
5
|
|
8
6
|
import bioregistry
|
9
7
|
from bioregistry.external.ols import get_ols_processing
|
@@ -16,7 +14,7 @@ logger = logging.getLogger(__name__)
|
|
16
14
|
ols_processing = get_ols_processing()
|
17
15
|
|
18
16
|
|
19
|
-
def _get_version_type(bioregistry_id: str) ->
|
17
|
+
def _get_version_type(bioregistry_id: str) -> VersionType | None:
|
20
18
|
ols_id = bioregistry.get_ols_prefix(bioregistry_id)
|
21
19
|
ols_config = ols_processing.get(ols_id)
|
22
20
|
if ols_config is None:
|
@@ -33,7 +31,7 @@ def _get_version_type(bioregistry_id: str) -> Optional[VersionType]:
|
|
33
31
|
return None
|
34
32
|
|
35
33
|
|
36
|
-
def make_ols_getter(bioregistry_id: str) ->
|
34
|
+
def make_ols_getter(bioregistry_id: str) -> type[Getter] | None:
|
37
35
|
"""Make a getter from OLS."""
|
38
36
|
ols_id = bioregistry.get_ols_prefix(bioregistry_id)
|
39
37
|
if ols_id is None:
|
@@ -66,14 +64,14 @@ def make_ols_getter(bioregistry_id: str) -> Optional[Type[Getter]]:
|
|
66
64
|
name = _name
|
67
65
|
version_type = _version_type # type:ignore
|
68
66
|
|
69
|
-
def get(self) ->
|
67
|
+
def get(self) -> str | Mapping[str, str]:
|
70
68
|
"""Get the version from the Bioregistry."""
|
71
69
|
return version
|
72
70
|
|
73
71
|
return OlsGetter
|
74
72
|
|
75
73
|
|
76
|
-
def iter_ols_getters() -> Iterable[
|
74
|
+
def iter_ols_getters() -> Iterable[type[Getter]]:
|
77
75
|
"""Iterate over OLS getters."""
|
78
76
|
for bioregistry_id in bioregistry.read_registry():
|
79
77
|
yv = make_ols_getter(bioregistry_id)
|
@@ -81,7 +79,7 @@ def iter_ols_getters() -> Iterable[Type[Getter]]:
|
|
81
79
|
yield yv
|
82
80
|
|
83
81
|
|
84
|
-
def extend_ols_getters(getters:
|
82
|
+
def extend_ols_getters(getters: list[type[Getter]]) -> None:
|
85
83
|
"""Extend the getters, without adding duplicates."""
|
86
84
|
for ols_getter in iter_ols_getters():
|
87
85
|
if any(getter.bioregistry_id == ols_getter.bioregistry_id for getter in getters):
|
bioversions/sources/omim.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""A getter for the OMIM."""
|
4
2
|
|
3
|
+
from typing import ClassVar
|
5
4
|
|
6
5
|
from bioversions.utils import Getter, VersionType, get_soup
|
7
6
|
|
@@ -16,7 +15,7 @@ class OMIMGetter(Getter):
|
|
16
15
|
name = "Online Mendelian Inheritance in Man"
|
17
16
|
date_version_fmt = "%B %d, %Y"
|
18
17
|
version_type = VersionType.date
|
19
|
-
collection = ["omim.ps", "omim"]
|
18
|
+
collection: ClassVar[list[str]] = ["omim.ps", "omim"]
|
20
19
|
|
21
20
|
def get(self) -> str:
|
22
21
|
"""Get the latest OMIM version number."""
|
bioversions/sources/oncotree.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""A getter for OncoTree."""
|
4
2
|
|
5
3
|
import requests
|
@@ -22,10 +20,12 @@ class OncoTreeGetter(Getter):
|
|
22
20
|
|
23
21
|
def get(self) -> str:
|
24
22
|
"""Get the latest OncoTree version number."""
|
25
|
-
res = requests.get(
|
23
|
+
res = requests.get(
|
24
|
+
"http://oncotree.mskcc.org/api/versions", params={"format": "json"}, timeout=5
|
25
|
+
)
|
26
26
|
res_json = res.json()
|
27
27
|
version = next(
|
28
|
-
|
28
|
+
r["release_date"] for r in res_json if r["api_identifier"] == "oncotree_latest_stable"
|
29
29
|
)
|
30
30
|
return version
|
31
31
|
|
bioversions/sources/pathbank.py
CHANGED
bioversions/sources/pfam.py
CHANGED
bioversions/sources/pombase.py
CHANGED
bioversions/sources/pr.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""A getter for the Protein Ontology."""
|
4
2
|
|
5
3
|
from bioversions.utils import Getter, VersionType, get_soup
|
@@ -26,7 +24,7 @@ class PRGetter(Getter):
|
|
26
24
|
rows = soup.find("table", **{"class": "nrm11"}).find_all("tr")
|
27
25
|
row = list(rows)[2]
|
28
26
|
version_cell, date_cell, *_ = list(row.find_all("td"))
|
29
|
-
return
|
27
|
+
return {"version": version_cell.text.strip(), "date": date_cell.text.strip()}
|
30
28
|
|
31
29
|
|
32
30
|
if __name__ == "__main__":
|
bioversions/sources/pubchem.py
CHANGED
bioversions/sources/reactome.py
CHANGED
bioversions/sources/rfam.py
CHANGED
bioversions/sources/rgd.py
CHANGED
bioversions/sources/rhea.py
CHANGED
bioversions/sources/rxnorm.py
CHANGED
bioversions/sources/sgd.py
CHANGED
bioversions/sources/slm.py
CHANGED
@@ -23,7 +23,7 @@ class SwissLipidGetter(Getter):
|
|
23
23
|
|
24
24
|
def get(self):
|
25
25
|
"""Get the latest SwissLipids version number."""
|
26
|
-
res = requests.get(URL).json()
|
26
|
+
res = requests.get(URL, timeout=15).json()
|
27
27
|
record = next(record for record in res if record["file"] == "lipids.tsv")
|
28
28
|
return datetime.datetime.strptime(record["date"], "%B %d %Y")
|
29
29
|
|
bioversions/sources/stringdb.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""A getter for StringDB."""
|
4
2
|
|
5
3
|
from bioversions.utils import Getter, VersionType, get_soup
|
@@ -21,9 +19,9 @@ class StringDBGetter(Getter):
|
|
21
19
|
soup = get_soup("https://string-db.org/cgi/access")
|
22
20
|
table = soup.find(**{"class": "footer_access_archive_table"})
|
23
21
|
rows = table.find_all(**{"class": "row"})
|
24
|
-
version, date, link, _summary =
|
22
|
+
version, date, link, _summary = (row.text for row in rows[1].find_all(**{"class": "cell"}))
|
25
23
|
date = date[len("current: since ") :]
|
26
|
-
return
|
24
|
+
return {"version": version, "date": date}
|
27
25
|
|
28
26
|
|
29
27
|
if __name__ == "__main__":
|
bioversions/sources/umls.py
CHANGED
bioversions/sources/uniprot.py
CHANGED
bioversions/sources/zfin.py
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
{% block head %}
|
5
|
+
<!-- Required meta tags -->
|
6
|
+
<meta charset="utf-8">
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
8
|
+
|
9
|
+
{% block styles %}
|
10
|
+
<!-- Bootstrap CSS -->
|
11
|
+
{{ bootstrap.load_css() }}
|
12
|
+
{% endblock %}
|
13
|
+
|
14
|
+
<script src="https://kit.fontawesome.com/4c86883252.js" crossorigin="anonymous"></script>
|
15
|
+
|
16
|
+
<title>{% block title %}{% endblock %}</title>
|
17
|
+
{% endblock %}
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
<!-- Your page content -->
|
21
|
+
{% block content %}{% endblock %}
|
22
|
+
|
23
|
+
{% block scripts %}
|
24
|
+
<!-- Optional JavaScript -->
|
25
|
+
{{ bootstrap.load_js() }}
|
26
|
+
{% endblock %}
|
27
|
+
</body>
|
28
|
+
</html>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
{% extends "base.html" %}
|
2
|
+
|
3
|
+
{% block title %}Bioversions{% endblock %}
|
4
|
+
|
5
|
+
{% block content %}
|
6
|
+
<div class="container" style="margin-top: 50px; margin-bottom: 50px">
|
7
|
+
<div class="row justify-content-center">
|
8
|
+
<div class="card">
|
9
|
+
<h5 class="card-header text-center">Biological Database Latest Versions</h5>
|
10
|
+
<div class="card-body">
|
11
|
+
<p>
|
12
|
+
This web application lists the latest versions for biological databases.
|
13
|
+
It refreshes once per day.
|
14
|
+
</p>
|
15
|
+
</div>
|
16
|
+
<table class="table table-striped table-hover">
|
17
|
+
<thead>
|
18
|
+
<tr>
|
19
|
+
<th>Name</th>
|
20
|
+
<th>Version</th>
|
21
|
+
<th>Date</th>
|
22
|
+
<th class="text-center">JSON</th>
|
23
|
+
</tr>
|
24
|
+
</thead>
|
25
|
+
<tbody>
|
26
|
+
{% for row in rows %}
|
27
|
+
<tr>
|
28
|
+
<td>{{ row.name }}</td>
|
29
|
+
<td>
|
30
|
+
{% if row.homepage %}
|
31
|
+
<a href="{{ row.homepage }}">{{ row.version }} <i class="fas fa-link"></i></a>
|
32
|
+
{% else %}
|
33
|
+
{{ row.version }}
|
34
|
+
{% endif %}
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
{% if row.date %}{{ row.date }}{% endif %}
|
38
|
+
</td>
|
39
|
+
<td class="text-center">
|
40
|
+
<a href="{{ url_for('database', name=row.name.lower().replace(" ", "")) }}">
|
41
|
+
<i class="fas fa-download"></i>
|
42
|
+
</a>
|
43
|
+
</td>
|
44
|
+
</tr>
|
45
|
+
{% endfor %}
|
46
|
+
</tbody>
|
47
|
+
</table>
|
48
|
+
<div class="card-footer">
|
49
|
+
<p style="text-align: center">
|
50
|
+
Developed with ❤️ by the <a href="https://indralab.github.io">INDRA Lab</a> in the
|
51
|
+
<a href="https://hits.harvard.edu">Harvard Program in Therapeutic Science (HiTS)</a>.<br/>
|
52
|
+
Funded by the DARPA Young Faculty Award W911NF2010255 (PI: Benjamin M. Gyori).<br/>
|
53
|
+
Point of contact: <a href="https://github.com/cthoyt">@cthoyt</a>.
|
54
|
+
(<a href="https://github.com/biopragmatics/bioversions">Source code</a>)
|
55
|
+
</p>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</div>
|
60
|
+
{% endblock %}
|
bioversions/twitter_client.py
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Utilities for interacting with Twitter."""
|
4
2
|
|
5
3
|
from functools import lru_cache
|
6
|
-
from typing import Optional
|
7
4
|
|
8
5
|
import pystow
|
9
6
|
import tweepy
|
@@ -11,11 +8,11 @@ import tweepy
|
|
11
8
|
|
12
9
|
@lru_cache(maxsize=1)
|
13
10
|
def _get_api(
|
14
|
-
consumer_key:
|
15
|
-
consumer_secret:
|
16
|
-
access_token:
|
17
|
-
access_token_secret:
|
18
|
-
) ->
|
11
|
+
consumer_key: str | None = None,
|
12
|
+
consumer_secret: str | None = None,
|
13
|
+
access_token: str | None = None,
|
14
|
+
access_token_secret: str | None = None,
|
15
|
+
) -> tweepy.API | None:
|
19
16
|
consumer_key = pystow.get_config("bioversions", "consumer_key", passthrough=consumer_key)
|
20
17
|
consumer_secret = pystow.get_config(
|
21
18
|
"bioversions", "consumer_secret", passthrough=consumer_secret
|
bioversions/utils.py
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Utilities and implementation for bioversions."""
|
4
2
|
|
5
3
|
import datetime
|
6
4
|
import enum
|
7
5
|
import ftplib
|
8
6
|
import os
|
9
|
-
from
|
7
|
+
from collections.abc import Mapping
|
8
|
+
from typing import Any, ClassVar
|
10
9
|
|
11
10
|
import bioregistry
|
12
11
|
import pydantic
|
@@ -48,7 +47,7 @@ def norm(s: str) -> str:
|
|
48
47
|
|
49
48
|
|
50
49
|
def get_soup(
|
51
|
-
url: str, verify: bool = True, timeout:
|
50
|
+
url: str, verify: bool = True, timeout: int | None = None, user_agent: str | None = None
|
52
51
|
) -> BeautifulSoup:
|
53
52
|
"""Get a beautiful soup parsed version of the given web page.
|
54
53
|
|
@@ -82,9 +81,9 @@ class MetaGetter(type):
|
|
82
81
|
|
83
82
|
_cache = None
|
84
83
|
|
85
|
-
date_fmt:
|
86
|
-
date_version_fmt:
|
87
|
-
homepage_fmt:
|
84
|
+
date_fmt: str | None
|
85
|
+
date_version_fmt: str | None
|
86
|
+
homepage_fmt: str | None
|
88
87
|
|
89
88
|
@property
|
90
89
|
def _cache_prop(cls):
|
@@ -105,7 +104,7 @@ class MetaGetter(type):
|
|
105
104
|
raise TypeError(f"_cache_prop was a {type(cls._cache_prop)}")
|
106
105
|
|
107
106
|
@property
|
108
|
-
def date(cls) ->
|
107
|
+
def date(cls) -> datetime.date | None:
|
109
108
|
"""Get the date if it's set."""
|
110
109
|
vp = cls.version_date_parsed
|
111
110
|
if vp is not None:
|
@@ -122,10 +121,12 @@ class MetaGetter(type):
|
|
122
121
|
try:
|
123
122
|
return datetime.datetime.strptime(date, cls.date_fmt).date()
|
124
123
|
except ValueError:
|
125
|
-
raise ValueError(
|
124
|
+
raise ValueError(
|
125
|
+
f"Issue in {cls.__name__} with date {date} and fmt {cls.date_fmt}"
|
126
|
+
) from None
|
126
127
|
|
127
128
|
@property
|
128
|
-
def version_date_parsed(cls) ->
|
129
|
+
def version_date_parsed(cls) -> datetime.date | None:
|
129
130
|
"""Get the date as a parsed class there's a format string."""
|
130
131
|
if cls.date_version_fmt is None:
|
131
132
|
return None
|
@@ -133,11 +134,12 @@ class MetaGetter(type):
|
|
133
134
|
return datetime.datetime.strptime(cls.version, cls.date_version_fmt).date()
|
134
135
|
except ValueError:
|
135
136
|
raise ValueError(
|
136
|
-
f"Issue parsing {cls.__name__} version {cls.version}
|
137
|
-
|
137
|
+
f"Issue parsing {cls.__name__} version {cls.version} "
|
138
|
+
f"with fmt {cls.date_version_fmt}"
|
139
|
+
) from None
|
138
140
|
|
139
141
|
@property
|
140
|
-
def homepage(cls) ->
|
142
|
+
def homepage(cls) -> str | None:
|
141
143
|
"""Get the homepage's URL if a format string was specified."""
|
142
144
|
if cls.homepage_fmt is None:
|
143
145
|
return None
|
@@ -163,11 +165,11 @@ class Bioversion(pydantic.BaseModel):
|
|
163
165
|
#: The version type
|
164
166
|
vtype: VersionType
|
165
167
|
#: The date of the current release
|
166
|
-
date:
|
168
|
+
date: datetime.date | None
|
167
169
|
#: The URL for the homepage of the specific version of the database
|
168
|
-
homepage:
|
170
|
+
homepage: str | None
|
169
171
|
#: The database prefix
|
170
|
-
bioregistry_id:
|
172
|
+
bioregistry_id: str | None
|
171
173
|
|
172
174
|
|
173
175
|
class Getter(metaclass=MetaGetter):
|
@@ -179,13 +181,13 @@ class Getter(metaclass=MetaGetter):
|
|
179
181
|
version_type: ClassVar[VersionType]
|
180
182
|
|
181
183
|
#: The URL with `{version}` to format in the version. Specify this in the inheriting class.
|
182
|
-
homepage_fmt: ClassVar[
|
184
|
+
homepage_fmt: ClassVar[str | None] = None
|
183
185
|
|
184
|
-
date_fmt: ClassVar[
|
186
|
+
date_fmt: ClassVar[str | None] = None
|
185
187
|
|
186
|
-
date_version_fmt: ClassVar[
|
188
|
+
date_version_fmt: ClassVar[str | None] = None
|
187
189
|
|
188
|
-
bioregistry_id: ClassVar[
|
190
|
+
bioregistry_id: ClassVar[str | None] = None
|
189
191
|
|
190
192
|
# The following are automatically calculated based on the metaclass
|
191
193
|
version: ClassVar[str]
|
@@ -193,21 +195,21 @@ class Getter(metaclass=MetaGetter):
|
|
193
195
|
homepage: ClassVar[str]
|
194
196
|
|
195
197
|
#: Prefixes this getter works for
|
196
|
-
collection: ClassVar[
|
198
|
+
collection: ClassVar[list[str] | None] = None
|
197
199
|
|
198
|
-
def get(self) ->
|
200
|
+
def get(self) -> str | Mapping[str, str] | datetime.datetime:
|
199
201
|
"""Get the latest of this database."""
|
200
202
|
raise NotImplementedError
|
201
203
|
|
202
204
|
@classmethod
|
203
|
-
def print(cls, sep: str = "\t", file=None):
|
205
|
+
def print(cls, sep: str = "\t", file=None):
|
204
206
|
"""Print the latest version of this database."""
|
205
207
|
x = [cls.bioregistry_id, cls.name, cls.version]
|
206
208
|
if cls.date:
|
207
209
|
x.append(f"({cls.date})")
|
208
210
|
if cls.homepage:
|
209
211
|
x.append(cls.homepage)
|
210
|
-
print(*x, sep=sep, file=file)
|
212
|
+
print(*x, sep=sep, file=file)
|
211
213
|
|
212
214
|
@classmethod
|
213
215
|
def resolve(cls) -> Bioversion:
|
@@ -225,7 +227,7 @@ class Getter(metaclass=MetaGetter):
|
|
225
227
|
@classmethod
|
226
228
|
def to_dict(cls) -> Mapping[str, Any]:
|
227
229
|
"""Get a dict with the data for this database."""
|
228
|
-
return cls.resolve().
|
230
|
+
return cls.resolve().model_dump()
|
229
231
|
|
230
232
|
|
231
233
|
class DailyGetter(Getter):
|
@@ -233,7 +235,7 @@ class DailyGetter(Getter):
|
|
233
235
|
|
234
236
|
version_type = VersionType.daily
|
235
237
|
|
236
|
-
def get(self) ->
|
238
|
+
def get(self) -> str | Mapping[str, str]:
|
237
239
|
"""Return a constant "daily" string."""
|
238
240
|
return "daily"
|
239
241
|
|
@@ -246,14 +248,14 @@ class UnversionedGetter(Getter):
|
|
246
248
|
#: Has this database been apparently abandoned (true) or is it still updated (false)
|
247
249
|
abandoned: ClassVar[bool]
|
248
250
|
|
249
|
-
def get(self) ->
|
251
|
+
def get(self) -> str | Mapping[str, str]:
|
250
252
|
"""Return a constant unversioned string."""
|
251
253
|
return "unversioned"
|
252
254
|
|
253
255
|
|
254
256
|
def get_obo_version(url: str) -> str:
|
255
257
|
"""Get the data version from an OBO file."""
|
256
|
-
with requests.get(url, stream=True) as res:
|
258
|
+
with requests.get(url, stream=True, timeout=60) as res:
|
257
259
|
for line in res.iter_lines():
|
258
260
|
line = line.decode("utf-8")
|
259
261
|
if line.startswith("data-version:"):
|
bioversions/version.py
CHANGED
@@ -1,22 +1,20 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""Version information for bioversions."""
|
4
2
|
|
5
3
|
import os
|
6
|
-
from subprocess import CalledProcessError, check_output
|
4
|
+
from subprocess import CalledProcessError, check_output
|
7
5
|
|
8
6
|
__all__ = [
|
9
7
|
"VERSION",
|
10
8
|
]
|
11
9
|
|
12
|
-
VERSION = "0.5.
|
10
|
+
VERSION = "0.5.553"
|
13
11
|
|
14
12
|
|
15
13
|
def get_git_hash() -> str:
|
16
14
|
"""Get the bioversions git hash."""
|
17
15
|
with open(os.devnull, "w") as devnull:
|
18
16
|
try:
|
19
|
-
ret = check_output(
|
17
|
+
ret = check_output(
|
20
18
|
["git", "rev-parse", "HEAD"],
|
21
19
|
cwd=os.path.dirname(__file__),
|
22
20
|
stderr=devnull,
|
bioversions/wsgi.py
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
1
|
"""A web application for listing database versions."""
|
4
2
|
|
5
|
-
from typing import Any
|
3
|
+
from typing import Any
|
6
4
|
|
7
5
|
import flask
|
8
6
|
from flask_bootstrap import Bootstrap
|
@@ -22,7 +20,7 @@ def home():
|
|
22
20
|
@app.route("/database/<name>.json")
|
23
21
|
def database(name: str):
|
24
22
|
"""Resolve information about a given database."""
|
25
|
-
rv:
|
23
|
+
rv: dict[str, Any] = {"query": name}
|
26
24
|
try:
|
27
25
|
bioversion = resolve(name)
|
28
26
|
except KeyError:
|