bioversions 0.5.560__py3-none-any.whl → 0.5.561__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 CHANGED
@@ -3,7 +3,7 @@
3
3
  from .sources import get_rows, get_version, resolve
4
4
 
5
5
  __all__ = [
6
+ "get_rows",
6
7
  "get_version",
7
8
  "resolve",
8
- "get_rows",
9
9
  ]
@@ -7,17 +7,18 @@ from pathlib import Path
7
7
  import yaml
8
8
 
9
9
  __all__ = [
10
- "VERSIONS_PATH",
11
10
  "EXPORT_PATH",
11
+ "VERSIONS_PATH",
12
12
  "load_versions",
13
- "write_versions",
14
13
  "write_export",
14
+ "write_versions",
15
15
  ]
16
16
 
17
17
  HERE = Path(__file__).parent.resolve()
18
18
  VERSIONS_PATH = HERE.joinpath(HERE, "versions.json")
19
19
 
20
20
  ROOT = HERE.parent.parent.parent.resolve()
21
+ PYPROJECT_TOML_PATH = ROOT.joinpath("pyproject.toml")
21
22
  DOCS = ROOT.joinpath("docs")
22
23
  EXPORTS_DIRECTORY = DOCS.joinpath("_data")
23
24
  EXPORT_PATH = EXPORTS_DIRECTORY.joinpath("versions.yml")
@@ -26,6 +27,11 @@ FAILURES_PATH = DOCS.joinpath("failures.md")
26
27
 
27
28
  def load_versions():
28
29
  """Load Bioversions data."""
30
+ if not VERSIONS_PATH.is_file():
31
+ raise RuntimeError(
32
+ f"bioversions was not packaged/built/installed properly -"
33
+ f"{VERSIONS_PATH.name} was not found inside the distribution"
34
+ )
29
35
  with open(VERSIONS_PATH) as file:
30
36
  return json.load(file)
31
37
 
@@ -35,13 +41,20 @@ def _date_converter(o):
35
41
  return o.strftime("%Y-%m-%d")
36
42
 
37
43
 
38
- def write_versions(versions, indent: int = 2, **kwargs):
44
+ def write_versions(versions, indent: int = 2, **kwargs) -> None:
39
45
  """Write Bioversions data."""
46
+ _ensure_editable()
40
47
  with open(VERSIONS_PATH, "w") as file:
41
48
  json.dump(versions, file, indent=indent, default=_date_converter, **kwargs)
42
49
 
43
50
 
44
- def write_export(versions):
51
+ def write_export(versions) -> None:
45
52
  """Write Bioversions data to the export directory."""
53
+ _ensure_editable()
46
54
  with open(EXPORT_PATH, "w") as file:
47
55
  yaml.safe_dump(versions, file)
56
+
57
+
58
+ def _ensure_editable() -> None:
59
+ if not PYPROJECT_TOML_PATH.is_file():
60
+ raise RuntimeError("can not make export when bioversions is not installed in editable mode")
@@ -15,7 +15,7 @@ from bioversions.resources import (
15
15
  write_export,
16
16
  write_versions,
17
17
  )
18
- from bioversions.sources import _iter_versions
18
+ from bioversions.sources import FailureTuple, _iter_versions
19
19
  from bioversions.version import get_git_hash
20
20
 
21
21
  __all__ = [
@@ -48,10 +48,10 @@ def _update(force: bool): # noqa:C901
48
48
  today = datetime.now().strftime("%Y-%m-%d")
49
49
 
50
50
  changes = False
51
- errors = []
52
- for bv, error in _iter_versions(use_tqdm=True):
53
- if error is not None or bv is None:
54
- errors.append(error)
51
+ failure_tuples = []
52
+ for bv in _iter_versions(use_tqdm=True):
53
+ if isinstance(bv, FailureTuple):
54
+ failure_tuples.append(bv)
55
55
  continue
56
56
 
57
57
  if bv.name in versions:
@@ -97,7 +97,16 @@ def _update(force: bool): # noqa:C901
97
97
  write_export(rv)
98
98
  write_versions(rv)
99
99
 
100
- FAILURES_PATH.write_text("# Errors\n\n" + "\n".join(f"- {error}" for error in errors))
100
+ if failure_tuples:
101
+ click.secho(f"Writing failure summary to {FAILURES_PATH}")
102
+ text = "# Summary of Errors\n\n"
103
+ for t in failure_tuples:
104
+ text += f"- {t.name} - {t.message}\n"
105
+ text += "\n"
106
+ for t in failure_tuples:
107
+ text += f"## {t.name}\n\nUsing class: `{t.clstype}`\n\n"
108
+ text += f"```python-traceback\n{t.trace}\n```\n\n"
109
+ FAILURES_PATH.write_text(text)
101
110
 
102
111
 
103
112
  def _log_update(bv) -> None:
@@ -4,8 +4,10 @@ from __future__ import annotations
4
4
 
5
5
  import ftplib
6
6
  import logging
7
+ import traceback
7
8
  from collections.abc import Iterable, Mapping
8
9
  from functools import lru_cache
10
+ from typing import NamedTuple
9
11
 
10
12
  from tqdm import tqdm
11
13
 
@@ -70,9 +72,9 @@ from .zfin import ZfinGetter
70
72
  from ..utils import Bioversion, Getter, norm, refresh_daily
71
73
 
72
74
  __all__ = [
73
- "resolve",
74
75
  "get_rows",
75
76
  "get_version",
77
+ "resolve",
76
78
  ]
77
79
 
78
80
  logger = logging.getLogger(__name__)
@@ -189,14 +191,23 @@ def get_rows(use_tqdm: bool | None = False) -> list[Bioversion]:
189
191
  """Get the rows, refreshing once per day."""
190
192
  return [
191
193
  bioversion
192
- for bioversion, error in _iter_versions(use_tqdm=use_tqdm)
193
- if error is None and bioversion is not None
194
+ for bioversion in _iter_versions(use_tqdm=use_tqdm)
195
+ if isinstance(bioversion, Bioversion)
194
196
  ]
195
197
 
196
198
 
199
+ class FailureTuple(NamedTuple):
200
+ """Holds information about failures."""
201
+
202
+ name: str
203
+ clstype: str
204
+ message: str
205
+ trace: str
206
+
207
+
197
208
  def _iter_versions(
198
209
  use_tqdm: bool | None = False,
199
- ) -> Iterable[tuple[Bioversion, None] | tuple[None, str]]:
210
+ ) -> Iterable[Bioversion | FailureTuple]:
200
211
  it = tqdm(get_getters(), disable=not use_tqdm)
201
212
 
202
213
  for cls in it:
@@ -206,10 +217,10 @@ def _iter_versions(
206
217
  except (OSError, AttributeError, ftplib.error_perm):
207
218
  msg = f"failed to resolve {cls.name}"
208
219
  tqdm.write(msg)
209
- yield None, msg
220
+ yield FailureTuple(cls.name, cls.__name__, msg, traceback.format_exc())
210
221
  except ValueError as e:
211
222
  msg = f"issue parsing {cls.name}: {e}"
212
223
  tqdm.write(msg)
213
- yield None, msg
224
+ yield FailureTuple(cls.name, cls.__name__, msg, traceback.format_exc())
214
225
  else:
215
- yield yv, None
226
+ yield yv
@@ -10,7 +10,7 @@ __all__ = [
10
10
  "ExPASyGetter",
11
11
  ]
12
12
 
13
- URL = "ftp://ftp.expasy.org/databases/enzyme/enzuser.txt"
13
+ URL = "https://ftp.expasy.org/databases/enzyme/enzuser.txt"
14
14
 
15
15
 
16
16
  class ExPASyGetter(Getter):
@@ -5,11 +5,11 @@ from collections.abc import Iterable
5
5
  from bioversions.utils import Getter, OBOFoundryGetter, VersionType
6
6
 
7
7
  __all__ = [
8
- "iter_obo_getters",
9
8
  "ChebiGetter",
10
- "GoGetter",
11
9
  "DoidGetter",
10
+ "GoGetter",
12
11
  "PrGetter",
12
+ "iter_obo_getters",
13
13
  ]
14
14
 
15
15
 
bioversions/utils.py CHANGED
@@ -11,7 +11,6 @@ import bioregistry
11
11
  import pydantic
12
12
  import pystow
13
13
  import requests
14
- import requests_ftp
15
14
  from bs4 import BeautifulSoup
16
15
  from cachier import cachier
17
16
 
@@ -20,8 +19,6 @@ HERE = os.path.abspath(os.path.dirname(__file__))
20
19
  DOCS = os.path.abspath(os.path.join(HERE, os.pardir, os.pardir, "docs"))
21
20
  IMG = os.path.join(DOCS, "img")
22
21
 
23
- requests_ftp.monkeypatch_session()
24
-
25
22
 
26
23
  class VersionType(enum.Enum):
27
24
  """Different types of versions."""
bioversions/version.py CHANGED
@@ -7,7 +7,7 @@ __all__ = [
7
7
  "VERSION",
8
8
  ]
9
9
 
10
- VERSION = "0.5.560"
10
+ VERSION = "0.5.561"
11
11
 
12
12
 
13
13
  def get_git_hash() -> str:
@@ -1,7 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: bioversions
3
- Version: 0.5.560
3
+ Version: 0.5.561
4
4
  Summary: Get the current version for biological databases
5
+ Project-URL: Bug Tracker, https://github.com/biopragmatics/bioversions/issues
6
+ Project-URL: Homepage, https://github.com/biopragmatics/bioversions
7
+ Project-URL: Repository, https://github.com/biopragmatics/bioversions.git
8
+ Project-URL: Documentation, https://bioversions.readthedocs.io
5
9
  Author-email: Charles Tapley Hoyt <cthoyt@gmail.com>
6
10
  Maintainer-email: Charles Tapley Hoyt <cthoyt@gmail.com>
7
11
  License: MIT License
@@ -25,63 +29,59 @@ License: MIT License
25
29
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
30
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
31
  SOFTWARE.
28
-
29
- Project-URL: Bug Tracker, https://github.com/biopragmatics/bioversions/issues
30
- Project-URL: Homepage, https://github.com/biopragmatics/bioversions
31
- Project-URL: Repository, https://github.com/biopragmatics/bioversions.git
32
- Project-URL: Documentation, https://bioversions.readthedocs.io
33
- Keywords: snekpack,cookiecutter,databases,biological databases,biomedical databases
32
+ Keywords: biological databases,biomedical databases,cookiecutter,databases,snekpack
34
33
  Classifier: Development Status :: 4 - Beta
35
34
  Classifier: Environment :: Console
35
+ Classifier: Framework :: Pytest
36
+ Classifier: Framework :: Sphinx
37
+ Classifier: Framework :: tox
36
38
  Classifier: Intended Audience :: Developers
37
39
  Classifier: License :: OSI Approved :: MIT License
40
+ Classifier: Natural Language :: English
38
41
  Classifier: Operating System :: OS Independent
39
- Classifier: Framework :: Pytest
40
- Classifier: Framework :: tox
41
- Classifier: Framework :: Sphinx
42
42
  Classifier: Programming Language :: Python
43
- Classifier: Programming Language :: Python :: 3.10
43
+ Classifier: Programming Language :: Python :: 3 :: Only
44
44
  Classifier: Programming Language :: Python :: 3.9
45
+ Classifier: Programming Language :: Python :: 3.10
45
46
  Classifier: Programming Language :: Python :: 3.11
46
47
  Classifier: Programming Language :: Python :: 3.12
47
- Classifier: Programming Language :: Python :: 3 :: Only
48
+ Classifier: Programming Language :: Python :: 3.13
49
+ Classifier: Typing :: Typed
48
50
  Requires-Python: >=3.9
49
- Description-Content-Type: text/markdown
50
- License-File: LICENSE
51
- Requires-Dist: requests
52
- Requires-Dist: requests_ftp
53
51
  Requires-Dist: beautifulsoup4
52
+ Requires-Dist: bioregistry[align]>=0.10.0
54
53
  Requires-Dist: cachier>=2.2.1
55
- Requires-Dist: pystow>=0.1.0
56
54
  Requires-Dist: click
57
- Requires-Dist: click_default_group
58
- Requires-Dist: dataclasses_json
59
- Requires-Dist: tabulate
60
- Requires-Dist: more_click
61
- Requires-Dist: pyyaml
62
- Requires-Dist: tqdm
63
- Requires-Dist: bioregistry[align]>=0.10.0
55
+ Requires-Dist: click-default-group
56
+ Requires-Dist: dataclasses-json
64
57
  Requires-Dist: lxml
65
- Requires-Dist: pydantic>=2.0
58
+ Requires-Dist: more-click
66
59
  Requires-Dist: psycopg2-binary
67
- Provides-Extra: tests
68
- Requires-Dist: pytest; extra == "tests"
69
- Requires-Dist: coverage; extra == "tests"
60
+ Requires-Dist: pydantic>=2.0
61
+ Requires-Dist: pystow>=0.1.0
62
+ Requires-Dist: pyyaml
63
+ Requires-Dist: requests
64
+ Requires-Dist: tabulate
65
+ Requires-Dist: tqdm
66
+ Provides-Extra: charts
67
+ Requires-Dist: matplotlib; extra == 'charts'
68
+ Requires-Dist: seaborn; extra == 'charts'
70
69
  Provides-Extra: docs
71
- Requires-Dist: sphinx>=8; extra == "docs"
72
- Requires-Dist: sphinx-rtd-theme>=3.0; extra == "docs"
73
- Requires-Dist: sphinx-click; extra == "docs"
74
- Requires-Dist: sphinx_automodapi; extra == "docs"
70
+ Requires-Dist: sphinx-automodapi; extra == 'docs'
71
+ Requires-Dist: sphinx-click; extra == 'docs'
72
+ Requires-Dist: sphinx-rtd-theme>=3.0; extra == 'docs'
73
+ Requires-Dist: sphinx>=8; extra == 'docs'
75
74
  Provides-Extra: slack
76
- Requires-Dist: slack_sdk; extra == "slack"
75
+ Requires-Dist: slack-sdk; extra == 'slack'
76
+ Provides-Extra: tests
77
+ Requires-Dist: coverage; extra == 'tests'
78
+ Requires-Dist: pytest; extra == 'tests'
77
79
  Provides-Extra: twitter
78
- Requires-Dist: tweepy; extra == "twitter"
79
- Provides-Extra: charts
80
- Requires-Dist: matplotlib; extra == "charts"
81
- Requires-Dist: seaborn; extra == "charts"
80
+ Requires-Dist: tweepy; extra == 'twitter'
82
81
  Provides-Extra: web
83
- Requires-Dist: flask; extra == "web"
84
- Requires-Dist: bootstrap-flask; extra == "web"
82
+ Requires-Dist: bootstrap-flask; extra == 'web'
83
+ Requires-Dist: flask; extra == 'web'
84
+ Description-Content-Type: text/markdown
85
85
 
86
86
  <p align="center">
87
87
  <img src="https://github.com/biopragmatics/bioversions/raw/main/docs/source/logo.png" height="150">
@@ -1,17 +1,17 @@
1
- bioversions/__init__.py,sha256=JXXSH1eWkPWqXXqs7vqtyNkBWHKqCrANmLVOs3df8s0,194
1
+ bioversions/__init__.py,sha256=fwSqW_i6TOuEMYijL28J37ILIwDwZyhNNaH7BEHqujg,194
2
2
  bioversions/__main__.py,sha256=TnmQZvX7vgBdyZruaMQUaz2FcuxSiRuCrQ9OHy3pYic,108
3
3
  bioversions/charts.py,sha256=3_BcyAAxUp4bBq9UwAEdJBo4MngxnQxvqQs-atRHYzI,2419
4
4
  bioversions/cli.py,sha256=k5sPKa-ff8iuuiB7ldRvHPWcZZ0V3szDSMq9zwdIa84,1563
5
5
  bioversions/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  bioversions/slack_client.py,sha256=p9HmnyRCVuQvje0RbdDK9QuRlSw__WwFCJ8Be9cIkzM,1209
7
7
  bioversions/twitter_client.py,sha256=9d5Am0FSs7_EgGdjkxqpo98vPir9rjIXIxhZMmLgK5Q,1285
8
- bioversions/utils.py,sha256=rrtu9K2QTqbg_EaSnl83xe3XSssrZeVmsCl4APvI3Qo,10398
9
- bioversions/version.py,sha256=iGKr3LwFQCH5nAsTrwZjuV3wlNJCOt4EEIh-XTHYFyc,587
8
+ bioversions/utils.py,sha256=x5d4p12VMlD5F8-y_J6JE5sct7BCV1d-zO-y5bSamSM,10342
9
+ bioversions/version.py,sha256=Q_aK7ZD4dIa2_ZaP3nze3oVJcrS8vQdZo_Kzb6aOoAU,587
10
10
  bioversions/wsgi.py,sha256=-F7pUZipcQgj1T_f-9QCZBVdQ9sZBH93x3hxh9h7klU,794
11
- bioversions/resources/__init__.py,sha256=q6p1gt5COyyIhsifGMBQxiHvQZH5q-SsPAHUQnFUivk,1147
12
- bioversions/resources/update.py,sha256=5BFypXcJ0rXrQgTyFplB-FqOkzTHUXAYNFtu76dzgOA,3261
11
+ bioversions/resources/__init__.py,sha256=Nxw6w6_gRC4B_JwvbAAKpNR2rIpkNRZ5UkBIMdNqldY,1659
12
+ bioversions/resources/update.py,sha256=btT_tdp0NKBRdshf4VuOe-vHWq0QQtcWWFcXS8QUfLU,3626
13
13
  bioversions/resources/versions.json,sha256=z4LobxLg8z-ltiARxDt08VuLIwNBtjCeCC8WUgg53o8,477637
14
- bioversions/sources/__init__.py,sha256=ezGCq9b3yp_YS4nfYJmoC1w23sBn2nhRmGS-5Uli5cI,5983
14
+ bioversions/sources/__init__.py,sha256=pXONlDoxWIVRTSdCN3RDr3aMY38QGPOt0EwPAMCaIF8,6248
15
15
  bioversions/sources/antibodyregistry.py,sha256=6GF_9v8A_8Y4o6_nsZ9cAOP5vK3ZbPQ5qeL99UefR80,680
16
16
  bioversions/sources/bigg.py,sha256=iVrxyvKiEIUXs6FM2AiLDYa-yYDNGMONmiIv_R6KBg4,661
17
17
  bioversions/sources/biogrid.py,sha256=FcQA8AIN7TwWdwRQb_r5hUZwh9Ztl13GeGXKXv1Kcag,734
@@ -28,7 +28,7 @@ bioversions/sources/disgenet.py,sha256=PALIRkPBkT2csrN-Fnn-AZzCc9Z2M2hekE-_FrqE-
28
28
  bioversions/sources/drugbank.py,sha256=WZwhVFK16CGeLDFCPCxtHHyGeEgwlpbINLm1868fPxY,994
29
29
  bioversions/sources/drugcentral.py,sha256=wH2xL-CWpeVP2042CnWm1X-w3YJv2m5FigTw1ht1cLg,1116
30
30
  bioversions/sources/ensembl.py,sha256=mUd5_LsI6oSU4a8DJLSam9lkndf6Zfun0VaxZIye2tI,737
31
- bioversions/sources/expasy.py,sha256=3cRqQS_LiDzwF-hE26abD_FWEVMHa6v3UiTvK-ETRs0,769
31
+ bioversions/sources/expasy.py,sha256=5C9m9Okygaq2D7zuuTnkOD4V24QU4C89ldztfLtiqnI,771
32
32
  bioversions/sources/flybase.py,sha256=L1qs0OF0OhjdknwV6DfvnnlxP37Z09hjuk-pz1Un2GM,754
33
33
  bioversions/sources/gtdb.py,sha256=lbtmSh4uhy6-Ve_slwO-Y7_wHRVySuof1I_rR-FQ05k,1001
34
34
  bioversions/sources/guidetopharmacology.py,sha256=WAasA6ZlyqJiqP70VrrCEpi2-JW7UMrUunAuE6pTk_g,1377
@@ -48,7 +48,7 @@ bioversions/sources/moalmanac.py,sha256=DMotSYD4sGOTZaJgn_iPeUfEdhjlgmzoKKLYS-L6
48
48
  bioversions/sources/msigdb.py,sha256=honGI0qErm5wsZsr0hwWXiw32D3n5xxH5gX3xUEh3po,778
49
49
  bioversions/sources/ncit.py,sha256=6rwzQSCHEIeZ1wt2ymCyfevM64479ngrpBEHxfLc2oc,1015
50
50
  bioversions/sources/npass.py,sha256=tRaQJJXQQ5fgVLUaUQRrEUMvN963BGdY1zN__KgE1hY,714
51
- bioversions/sources/obo.py,sha256=_C5SSmVX_BCAeTpc45isQdUtnRlEZ-V3kuhngj_GtGk,1713
51
+ bioversions/sources/obo.py,sha256=cnt0cLpM8wtCG14e6-dYu63qxX6YAd9PzrE5SKJ_8Lc,1713
52
52
  bioversions/sources/ols.py,sha256=Zet7BQwluY8f00RvDcyu7EVg4IscnrhxNG4UJhwsL8Y,2697
53
53
  bioversions/sources/omim.py,sha256=F87kmMIAxeeXCqrILQNz5250v4p4YsBkA6l02SagHis,880
54
54
  bioversions/sources/oncotree.py,sha256=abA58H43gA_TtiOBawBZUzPK7elAPYqWIP7lFd6KqO4,1032
@@ -73,9 +73,8 @@ bioversions/sources/wikipathways.py,sha256=STw8Bivc3IZLYIx-KwpxHLUmRTqNfHm0wQywD
73
73
  bioversions/sources/zfin.py,sha256=3Ooz3lDx8J42OAoyU8eJI-fRnMRiYyUMcj4fDE5DVLQ,683
74
74
  bioversions/templates/base.html,sha256=AKB6aT39U9VtOM2zvW_Um5IgYO9Ky-CLpByxy5XXO5M,713
75
75
  bioversions/templates/home.html,sha256=z98FSslCRP2K39xbHpSPgk19j7Z21PSbRGAtaXI0Md0,2756
76
- bioversions-0.5.560.dist-info/LICENSE,sha256=QcgJZKGxlW5BwBNnCBL8VZLVtRvXs81Ch9lJRQSIpJg,1076
77
- bioversions-0.5.560.dist-info/METADATA,sha256=yuSNH-a5gZNezmPzRLT9Asu67rjRPZoAFzAft1vrXS4,19665
78
- bioversions-0.5.560.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
79
- bioversions-0.5.560.dist-info/entry_points.txt,sha256=A3qrS-nvKNZPZWQbYlmsmiDTge524C4yR-arRJwdHls,53
80
- bioversions-0.5.560.dist-info/top_level.txt,sha256=0QO2OEUMchj5GSlWEFi0cvUpsm4b_uwuuvr6uSEmfY0,12
81
- bioversions-0.5.560.dist-info/RECORD,,
76
+ bioversions-0.5.561.dist-info/METADATA,sha256=rjXiJDrGumeJ0XNv-KaOvEQET2gewODoBd5eAb7gfu4,19725
77
+ bioversions-0.5.561.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
78
+ bioversions-0.5.561.dist-info/entry_points.txt,sha256=A3qrS-nvKNZPZWQbYlmsmiDTge524C4yR-arRJwdHls,53
79
+ bioversions-0.5.561.dist-info/licenses/LICENSE,sha256=QcgJZKGxlW5BwBNnCBL8VZLVtRvXs81Ch9lJRQSIpJg,1076
80
+ bioversions-0.5.561.dist-info/RECORD,,
@@ -1,5 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.6.0)
2
+ Generator: hatchling 1.26.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
-
@@ -1 +0,0 @@
1
- bioversions