bioversions 0.5.376__py3-none-any.whl → 0.7.1__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.
Files changed (85) hide show
  1. bioversions/__init__.py +7 -3
  2. bioversions/__main__.py +0 -2
  3. bioversions/charts.py +3 -7
  4. bioversions/cli.py +3 -5
  5. bioversions/py.typed +0 -0
  6. bioversions/resources/__init__.py +18 -7
  7. bioversions/resources/update.py +20 -12
  8. bioversions/resources/versions.json +20536 -0
  9. bioversions/slack_client.py +2 -5
  10. bioversions/sources/__init__.py +32 -17
  11. bioversions/sources/antibodyregistry.py +9 -6
  12. bioversions/sources/bigg.py +5 -7
  13. bioversions/sources/biogrid.py +0 -2
  14. bioversions/sources/cellosaurus.py +3 -5
  15. bioversions/sources/chebi.py +1 -3
  16. bioversions/sources/chembl.py +3 -4
  17. bioversions/sources/chemidplus.py +1 -3
  18. bioversions/sources/civic.py +9 -4
  19. bioversions/sources/complexportal.py +0 -2
  20. bioversions/sources/daily.py +0 -2
  21. bioversions/sources/depmap.py +1 -3
  22. bioversions/sources/dgi.py +9 -12
  23. bioversions/sources/disgenet.py +1 -3
  24. bioversions/sources/drugbank.py +2 -4
  25. bioversions/sources/drugcentral.py +2 -4
  26. bioversions/sources/ensembl.py +1 -3
  27. bioversions/sources/expasy.py +1 -4
  28. bioversions/sources/flybase.py +0 -2
  29. bioversions/sources/gtdb.py +35 -0
  30. bioversions/sources/guidetopharmacology.py +3 -5
  31. bioversions/sources/hgnc.py +13 -14
  32. bioversions/sources/homologene.py +0 -2
  33. bioversions/sources/icd10.py +1 -3
  34. bioversions/sources/icd11.py +1 -3
  35. bioversions/sources/icf.py +1 -3
  36. bioversions/sources/intact.py +0 -2
  37. bioversions/sources/interpro.py +1 -3
  38. bioversions/sources/itis.py +8 -15
  39. bioversions/sources/kegg.py +7 -7
  40. bioversions/sources/mesh.py +10 -5
  41. bioversions/sources/mgi.py +0 -2
  42. bioversions/sources/mirbase.py +13 -8
  43. bioversions/sources/moalmanac.py +0 -2
  44. bioversions/sources/msigdb.py +0 -2
  45. bioversions/sources/ncit.py +1 -4
  46. bioversions/sources/npass.py +0 -2
  47. bioversions/sources/obo.py +4 -6
  48. bioversions/sources/ols.py +6 -8
  49. bioversions/sources/omim.py +5 -6
  50. bioversions/sources/oncotree.py +4 -4
  51. bioversions/sources/pathbank.py +0 -2
  52. bioversions/sources/pathwaycommons.py +0 -2
  53. bioversions/sources/pfam.py +0 -2
  54. bioversions/sources/pombase.py +0 -2
  55. bioversions/sources/pr.py +1 -3
  56. bioversions/sources/pubchem.py +0 -2
  57. bioversions/sources/reactome.py +0 -2
  58. bioversions/sources/rfam.py +0 -2
  59. bioversions/sources/rgd.py +1 -3
  60. bioversions/sources/rhea.py +0 -2
  61. bioversions/sources/rxnorm.py +0 -2
  62. bioversions/sources/sgd.py +0 -2
  63. bioversions/sources/signor.py +36 -0
  64. bioversions/sources/slm.py +4 -3
  65. bioversions/sources/stringdb.py +2 -4
  66. bioversions/sources/umls.py +0 -2
  67. bioversions/sources/uniprot.py +1 -3
  68. bioversions/sources/unversioned.py +0 -2
  69. bioversions/sources/wikipathways.py +0 -2
  70. bioversions/sources/zfin.py +0 -2
  71. bioversions/templates/base.html +28 -0
  72. bioversions/templates/home.html +60 -0
  73. bioversions/twitter_client.py +5 -8
  74. bioversions/utils.py +30 -31
  75. bioversions/version.py +3 -5
  76. bioversions/wsgi.py +2 -4
  77. bioversions-0.7.1.dist-info/METADATA +393 -0
  78. bioversions-0.7.1.dist-info/RECORD +81 -0
  79. bioversions-0.7.1.dist-info/WHEEL +4 -0
  80. {bioversions-0.5.376.dist-info → bioversions-0.7.1.dist-info}/entry_points.txt +1 -0
  81. {bioversions-0.5.376.dist-info → bioversions-0.7.1.dist-info/licenses}/LICENSE +1 -1
  82. bioversions-0.5.376.dist-info/METADATA +0 -166
  83. bioversions-0.5.376.dist-info/RECORD +0 -77
  84. bioversions-0.5.376.dist-info/WHEEL +0 -5
  85. bioversions-0.5.376.dist-info/top_level.txt +0 -1
bioversions/__init__.py CHANGED
@@ -1,5 +1,9 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """What's the current version for each biological database?""" # noqa:D400
4
2
 
5
- from .sources import get_rows, get_version, resolve # noqa:F401
3
+ from .sources import get_rows, get_version, resolve
4
+
5
+ __all__ = [
6
+ "get_rows",
7
+ "get_version",
8
+ "resolve",
9
+ ]
bioversions/__main__.py CHANGED
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Command line interface for bioversions."""
4
2
 
5
3
  from .cli import main
bioversions/charts.py CHANGED
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Generation of charts summarizing bioversions."""
4
2
 
5
3
  import os
@@ -21,7 +19,7 @@ def version_types_pie_chart():
21
19
  "Missing" if getter.version_type is None else getter.version_type.value
22
20
  for getter in get_getters()
23
21
  )
24
- labels, counts = zip(*counts.most_common())
22
+ labels, counts = zip(*counts.most_common(), strict=False)
25
23
  fig, ax = plt.subplots()
26
24
  ax.pie(
27
25
  counts,
@@ -29,9 +27,7 @@ def version_types_pie_chart():
29
27
  autopct="%1.f%%",
30
28
  startangle=30,
31
29
  explode=[0.01 for _ in range(len(counts))],
32
- # shadow=True,
33
30
  )
34
- # fig.legend(fontsize='medium')
35
31
  fig.tight_layout()
36
32
  path = os.path.join(IMG, "version_types.svg")
37
33
  plt.savefig(path, dpi=300)
@@ -45,7 +41,7 @@ def verioning_date_formats_pie_chart():
45
41
  for getter in get_getters()
46
42
  if getter.version_type in {VersionType.date, VersionType.month}
47
43
  )
48
- labels, counts = zip(*counts.most_common())
44
+ labels, counts = zip(*counts.most_common(), strict=False)
49
45
  fig, ax = plt.subplots()
50
46
  ax.pie(
51
47
  counts,
@@ -67,7 +63,7 @@ def has_release_url():
67
63
  for getter in get_getters()
68
64
  if getter.version_type != VersionType.unversioned
69
65
  )
70
- labels, counts = zip(*counts.most_common())
66
+ labels, counts = zip(*counts.most_common(), strict=False)
71
67
  fig, ax = plt.subplots()
72
68
  ax.pie(
73
69
  counts,
bioversions/cli.py CHANGED
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Command line interface for bioversions."""
4
2
 
5
3
  import click
@@ -21,9 +19,9 @@ main.add_command(update)
21
19
  web = make_web_command(
22
20
  app="bioversions.wsgi:app",
23
21
  group=main,
24
- command_kwargs=dict(
25
- help="Run the bioversions web application.",
26
- ),
22
+ command_kwargs={
23
+ "help": "Run the bioversions web application.",
24
+ },
27
25
  )
28
26
 
29
27
 
bioversions/py.typed CHANGED
File without changes
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Resources."""
4
2
 
5
3
  import datetime
@@ -9,17 +7,18 @@ from pathlib import Path
9
7
  import yaml
10
8
 
11
9
  __all__ = [
12
- "VERSIONS_PATH",
13
10
  "EXPORT_PATH",
11
+ "VERSIONS_PATH",
14
12
  "load_versions",
15
- "write_versions",
16
13
  "write_export",
14
+ "write_versions",
17
15
  ]
18
16
 
19
17
  HERE = Path(__file__).parent.resolve()
20
18
  VERSIONS_PATH = HERE.joinpath(HERE, "versions.json")
21
19
 
22
20
  ROOT = HERE.parent.parent.parent.resolve()
21
+ PYPROJECT_TOML_PATH = ROOT.joinpath("pyproject.toml")
23
22
  DOCS = ROOT.joinpath("docs")
24
23
  EXPORTS_DIRECTORY = DOCS.joinpath("_data")
25
24
  EXPORT_PATH = EXPORTS_DIRECTORY.joinpath("versions.yml")
@@ -28,22 +27,34 @@ FAILURES_PATH = DOCS.joinpath("failures.md")
28
27
 
29
28
  def load_versions():
30
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
+ )
31
35
  with open(VERSIONS_PATH) as file:
32
36
  return json.load(file)
33
37
 
34
38
 
35
39
  def _date_converter(o):
36
- if isinstance(o, (datetime.datetime, datetime.date)):
40
+ if isinstance(o, datetime.datetime | datetime.date):
37
41
  return o.strftime("%Y-%m-%d")
38
42
 
39
43
 
40
- def write_versions(versions, indent: int = 2, **kwargs):
44
+ def write_versions(versions, indent: int = 2, **kwargs) -> None:
41
45
  """Write Bioversions data."""
46
+ _ensure_editable()
42
47
  with open(VERSIONS_PATH, "w") as file:
43
48
  json.dump(versions, file, indent=indent, default=_date_converter, **kwargs)
44
49
 
45
50
 
46
- def write_export(versions):
51
+ def write_export(versions) -> None:
47
52
  """Write Bioversions data to the export directory."""
53
+ _ensure_editable()
48
54
  with open(EXPORT_PATH, "w") as file:
49
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")
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """Update the web page."""
4
2
 
5
3
  import getpass
@@ -7,6 +5,7 @@ import sys
7
5
  from datetime import datetime
8
6
 
9
7
  import click
8
+ from tqdm import tqdm
10
9
  from tqdm.contrib.logging import logging_redirect_tqdm
11
10
 
12
11
  from bioversions.resources import (
@@ -16,7 +15,7 @@ from bioversions.resources import (
16
15
  write_export,
17
16
  write_versions,
18
17
  )
19
- from bioversions.sources import _iter_versions
18
+ from bioversions.sources import FailureTuple, _iter_versions
20
19
  from bioversions.version import get_git_hash
21
20
 
22
21
  __all__ = [
@@ -36,7 +35,7 @@ def update(force: bool):
36
35
  _update(force=force)
37
36
 
38
37
 
39
- def _update(force: bool):
38
+ def _update(force: bool): # noqa:C901
40
39
  if not get_git_hash():
41
40
  click.secho("Not on development installation", fg="red")
42
41
  return sys.exit(1)
@@ -49,10 +48,10 @@ def _update(force: bool):
49
48
  today = datetime.now().strftime("%Y-%m-%d")
50
49
 
51
50
  changes = False
52
- errors = []
53
- for bv, error in _iter_versions(use_tqdm=True):
54
- if error is not None or bv is None:
55
- 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)
56
55
  continue
57
56
 
58
57
  if bv.name in versions:
@@ -83,7 +82,7 @@ def _update(force: bool):
83
82
  v["releases"].append(append_dict)
84
83
 
85
84
  if not changes and not force:
86
- click.secho(f"No changes to {EXPORT_PATH}", fg="yellow", bold=True)
85
+ tqdm.write(click.style(f"No changes to {EXPORT_PATH}", fg="yellow", bold=True))
87
86
  else:
88
87
  rv_database = sorted(versions.values(), key=lambda version: version["name"].lower())
89
88
  rv = {
@@ -94,11 +93,20 @@ def _update(force: bool):
94
93
  },
95
94
  "database": rv_database,
96
95
  }
97
- click.secho(f"Writing new {EXPORT_PATH}", fg="green", bold=True)
96
+ tqdm.write(click.style(f"Writing new {EXPORT_PATH}", fg="green", bold=True))
98
97
  write_export(rv)
99
98
  write_versions(rv)
100
99
 
101
- 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)
102
110
 
103
111
 
104
112
  def _log_update(bv) -> None:
@@ -106,7 +114,7 @@ def _log_update(bv) -> None:
106
114
  if bv.homepage:
107
115
  text += f". See {bv.homepage}"
108
116
 
109
- click.secho(text, fg="green", bold=True)
117
+ tqdm.write(click.style(text, fg="green", bold=True))
110
118
 
111
119
  try:
112
120
  from .. import slack_client