scigantic-bindingdb 0.2.4__tar.gz → 0.2.6__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.
Files changed (31) hide show
  1. {scigantic_bindingdb-0.2.4/src/scigantic_bindingdb.egg-info → scigantic_bindingdb-0.2.6}/PKG-INFO +11 -4
  2. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/README.md +7 -1
  3. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/pyproject.toml +11 -4
  4. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/connection.py +14 -3
  5. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6/src/scigantic_bindingdb.egg-info}/PKG-INFO +11 -4
  6. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb.egg-info/SOURCES.txt +1 -0
  7. scigantic_bindingdb-0.2.6/src/scigantic_bindingdb.egg-info/requires.txt +8 -0
  8. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/tests/test_connection.py +13 -0
  9. scigantic_bindingdb-0.2.6/tests/test_jupyter_progress_bar.py +45 -0
  10. scigantic_bindingdb-0.2.4/src/scigantic_bindingdb.egg-info/requires.txt +0 -7
  11. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/LICENSE +0 -0
  12. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/setup.cfg +0 -0
  13. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/__init__.py +0 -0
  14. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/__main__.py +0 -0
  15. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/_constants.py +0 -0
  16. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/cache.py +0 -0
  17. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/chembl_bridge.py +0 -0
  18. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/cli.py +0 -0
  19. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/dti_pairs.py +0 -0
  20. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/measurements.py +0 -0
  21. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/py.typed +0 -0
  22. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb/releases.py +0 -0
  23. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb.egg-info/dependency_links.txt +0 -0
  24. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb.egg-info/entry_points.txt +0 -0
  25. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/src/scigantic_bindingdb.egg-info/top_level.txt +0 -0
  26. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/tests/test_cache.py +0 -0
  27. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/tests/test_chembl_bridge.py +0 -0
  28. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/tests/test_cli.py +0 -0
  29. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/tests/test_dti_pairs.py +0 -0
  30. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/tests/test_measurements.py +0 -0
  31. {scigantic_bindingdb-0.2.4 → scigantic_bindingdb-0.2.6}/tests/test_releases.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scigantic-bindingdb
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Query BindingDB directly from a public S3 mirror with DuckDB, including a ChEMBL cross-reference bridge table and a ready drug-target-interaction training table.
5
5
  Author: Scigantic
6
6
  License: MIT-0
@@ -21,10 +21,11 @@ Classifier: Topic :: Scientific/Engineering :: Chemistry
21
21
  Requires-Python: >=3.10
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
- Requires-Dist: duckdb>=0.10
25
- Requires-Dist: pandas>=1.5
24
+ Requires-Dist: duckdb<2,>=0.10
25
+ Requires-Dist: pandas<4,>=1.5
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest>=7; extra == "dev"
28
+ Requires-Dist: pytest-cov>=5; extra == "dev"
28
29
  Requires-Dist: mypy>=1.10; extra == "dev"
29
30
  Requires-Dist: pandas-stubs; extra == "dev"
30
31
  Dynamic: license-file
@@ -163,4 +164,10 @@ $ scigantic-bindingdb query "SELECT count(*) FROM measurements" --release 202608
163
164
 
164
165
  ## License
165
166
 
166
- MIT-0. See [LICENSE](LICENSE).
167
+ MIT-0. See [LICENSE](LICENSE). This covers the code in this package only.
168
+
169
+ ## Data license
170
+
171
+ BindingDB's underlying data is not under one license: it's a row-by-row mix, determined by each measurement's `curation_source` column. BindingDB [licenses](https://www.bindingdb.org/rwd/bind/info.jsp) its own staff-curated rows under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/), but rows imported from ChEMBL (`curation_source = 'ChEMBL'`, 51.3% of measurements in the 202608 release) carry ChEMBL's own [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) terms instead, share-alike included. Check `curation_source` before redistributing a subset of `measurements` or `dti_pairs()` to know which terms apply to those specific rows.
172
+
173
+ `chembl_bridge()` results specifically warrant care regardless of a matched measurement's own `curation_source`: every row includes `chembl_id`/`chembl_molregno` matched from ChEMBL's own `molecule_dictionary`, and with the default `with_names=True`, ChEMBL's own `pref_name`. Those columns carry ChEMBL's CC BY-SA 3.0 terms, independent of whichever license applies to the rest of that row.
@@ -132,4 +132,10 @@ $ scigantic-bindingdb query "SELECT count(*) FROM measurements" --release 202608
132
132
 
133
133
  ## License
134
134
 
135
- MIT-0. See [LICENSE](LICENSE).
135
+ MIT-0. See [LICENSE](LICENSE). This covers the code in this package only.
136
+
137
+ ## Data license
138
+
139
+ BindingDB's underlying data is not under one license: it's a row-by-row mix, determined by each measurement's `curation_source` column. BindingDB [licenses](https://www.bindingdb.org/rwd/bind/info.jsp) its own staff-curated rows under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/), but rows imported from ChEMBL (`curation_source = 'ChEMBL'`, 51.3% of measurements in the 202608 release) carry ChEMBL's own [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) terms instead, share-alike included. Check `curation_source` before redistributing a subset of `measurements` or `dti_pairs()` to know which terms apply to those specific rows.
140
+
141
+ `chembl_bridge()` results specifically warrant care regardless of a matched measurement's own `curation_source`: every row includes `chembl_id`/`chembl_molregno` matched from ChEMBL's own `molecule_dictionary`, and with the default `with_names=True`, ChEMBL's own `pref_name`. Those columns carry ChEMBL's CC BY-SA 3.0 terms, independent of whichever license applies to the rest of that row.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scigantic-bindingdb"
7
- version = "0.2.4"
7
+ version = "0.2.6"
8
8
  description = "Query BindingDB directly from a public S3 mirror with DuckDB, including a ChEMBL cross-reference bridge table and a ready drug-target-interaction training table."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -25,12 +25,12 @@ classifiers = [
25
25
  ]
26
26
 
27
27
  dependencies = [
28
- "duckdb>=0.10",
29
- "pandas>=1.5",
28
+ "duckdb>=0.10,<2",
29
+ "pandas>=1.5,<4",
30
30
  ]
31
31
 
32
32
  [project.optional-dependencies]
33
- dev = ["pytest>=7", "mypy>=1.10", "pandas-stubs"]
33
+ dev = ["pytest>=7", "pytest-cov>=5", "mypy>=1.10", "pandas-stubs"]
34
34
 
35
35
  [project.urls]
36
36
  Homepage = "https://scigantic.com"
@@ -49,5 +49,12 @@ scigantic_bindingdb = ["py.typed"]
49
49
  [tool.pytest.ini_options]
50
50
  testpaths = ["tests"]
51
51
 
52
+ [tool.coverage.run]
53
+ source = ["scigantic_bindingdb"]
54
+ # Not wired into CI as a gate: this suite runs real queries against the live
55
+ # S3 mirror, so a coverage threshold would be one more thing that can fail
56
+ # for reasons unrelated to a change. `pytest --cov` is available locally for
57
+ # anyone who wants the number.
58
+
52
59
  [tool.mypy]
53
60
  strict = true
@@ -69,7 +69,15 @@ def _get_base_connection(release: str) -> "duckdb.DuckDBPyConnection":
69
69
  # whether that's a real terminal. Surprising output for a
70
70
  # library call in a notebook or script, so it's off here by
71
71
  # default.
72
- new_con.execute("SET enable_progress_bar=false")
72
+ # Inside a Jupyter kernel without ipywidgets, DuckDB (1.5.5) raises
73
+ # InvalidInputException on ANY change to enable_progress_bar, even turning
74
+ # it off ("required package 'ipywidgets' is missing"). Plain Python never
75
+ # hits it; a notebook on an image without ipywidgets fails on the first
76
+ # call. The setting is cosmetic; skip it rather than fail the connection.
77
+ try:
78
+ new_con.execute("SET enable_progress_bar=false")
79
+ except duckdb.Error:
80
+ pass
73
81
  new_con.execute("INSTALL httpfs")
74
82
  new_con.execute("LOAD httpfs")
75
83
  new_con.execute(f"SET s3_region='{REGION}'")
@@ -123,8 +131,11 @@ def query(sql: str, release: str | None = None) -> "pd.DataFrame":
123
131
  For several queries against the same release, call connect() once and
124
132
  reuse it instead, to avoid opening and closing a cursor per query.
125
133
  """
126
- con = connect(release)
134
+ resolved_release = release or latest()
135
+ con = connect(resolved_release)
127
136
  try:
128
- return con.execute(sql).df()
137
+ df = con.execute(sql).df()
138
+ df.attrs["bindingdb_release"] = resolved_release
139
+ return df
129
140
  finally:
130
141
  con.close()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scigantic-bindingdb
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: Query BindingDB directly from a public S3 mirror with DuckDB, including a ChEMBL cross-reference bridge table and a ready drug-target-interaction training table.
5
5
  Author: Scigantic
6
6
  License: MIT-0
@@ -21,10 +21,11 @@ Classifier: Topic :: Scientific/Engineering :: Chemistry
21
21
  Requires-Python: >=3.10
22
22
  Description-Content-Type: text/markdown
23
23
  License-File: LICENSE
24
- Requires-Dist: duckdb>=0.10
25
- Requires-Dist: pandas>=1.5
24
+ Requires-Dist: duckdb<2,>=0.10
25
+ Requires-Dist: pandas<4,>=1.5
26
26
  Provides-Extra: dev
27
27
  Requires-Dist: pytest>=7; extra == "dev"
28
+ Requires-Dist: pytest-cov>=5; extra == "dev"
28
29
  Requires-Dist: mypy>=1.10; extra == "dev"
29
30
  Requires-Dist: pandas-stubs; extra == "dev"
30
31
  Dynamic: license-file
@@ -163,4 +164,10 @@ $ scigantic-bindingdb query "SELECT count(*) FROM measurements" --release 202608
163
164
 
164
165
  ## License
165
166
 
166
- MIT-0. See [LICENSE](LICENSE).
167
+ MIT-0. See [LICENSE](LICENSE). This covers the code in this package only.
168
+
169
+ ## Data license
170
+
171
+ BindingDB's underlying data is not under one license: it's a row-by-row mix, determined by each measurement's `curation_source` column. BindingDB [licenses](https://www.bindingdb.org/rwd/bind/info.jsp) its own staff-curated rows under [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/), but rows imported from ChEMBL (`curation_source = 'ChEMBL'`, 51.3% of measurements in the 202608 release) carry ChEMBL's own [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) terms instead, share-alike included. Check `curation_source` before redistributing a subset of `measurements` or `dti_pairs()` to know which terms apply to those specific rows.
172
+
173
+ `chembl_bridge()` results specifically warrant care regardless of a matched measurement's own `curation_source`: every row includes `chembl_id`/`chembl_molregno` matched from ChEMBL's own `molecule_dictionary`, and with the default `with_names=True`, ChEMBL's own `pref_name`. Those columns carry ChEMBL's CC BY-SA 3.0 terms, independent of whichever license applies to the rest of that row.
@@ -23,5 +23,6 @@ tests/test_chembl_bridge.py
23
23
  tests/test_cli.py
24
24
  tests/test_connection.py
25
25
  tests/test_dti_pairs.py
26
+ tests/test_jupyter_progress_bar.py
26
27
  tests/test_measurements.py
27
28
  tests/test_releases.py
@@ -0,0 +1,8 @@
1
+ duckdb<2,>=0.10
2
+ pandas<4,>=1.5
3
+
4
+ [dev]
5
+ pytest>=7
6
+ pytest-cov>=5
7
+ mypy>=1.10
8
+ pandas-stubs
@@ -20,6 +20,19 @@ def test_query_returns_dataframe_with_expected_columns():
20
20
  assert len(df) == 5
21
21
 
22
22
 
23
+ def test_query_records_bindingdb_release_in_attrs():
24
+ # Matches scigantic_chembl's query(), which stamps df.attrs["chembl_release"]
25
+ # the same way: the release actually used should travel with the result,
26
+ # not just be implicit in whatever the caller happened to pass.
27
+ df = bindingdb.query("SELECT 1", release="202608")
28
+ assert df.attrs["bindingdb_release"] == "202608"
29
+
30
+
31
+ def test_query_omitted_release_records_resolved_release_in_attrs():
32
+ df = bindingdb.query("SELECT 1")
33
+ assert df.attrs["bindingdb_release"] == bindingdb.latest()
34
+
35
+
23
36
  def test_connect_registers_all_five_core_tables():
24
37
  con = bindingdb.connect()
25
38
  try:
@@ -0,0 +1,45 @@
1
+ """Regression: DuckDB inside a Jupyter kernel without ipywidgets.
2
+
3
+ DuckDB 1.5.5 detects Jupyter and raises InvalidInputException on any change to
4
+ enable_progress_bar when ipywidgets is absent, even `SET enable_progress_bar=false`.
5
+ The connection setup must survive that. The real condition needs an ipykernel on
6
+ an image without ipywidgets (scigantic's minimal/database images); this test
7
+ reproduces the raise by wrapping duckdb.connect so that one SET fails the way
8
+ DuckDB fails it.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import duckdb
14
+ import pytest
15
+
16
+ from scigantic_bindingdb import connection
17
+ from scigantic_bindingdb.connection import connect
18
+
19
+
20
+ class _JupyterLikeConnection:
21
+ def __init__(self, real: duckdb.DuckDBPyConnection) -> None:
22
+ self._real = real
23
+
24
+ def execute(self, sql: str, *a: object, **k: object) -> duckdb.DuckDBPyConnection:
25
+ if "enable_progress_bar" in sql:
26
+ raise duckdb.InvalidInputException(
27
+ "Invalid Input Error: Could not change the progress bar setting because: "
28
+ "'required package 'ipywidgets' is missing, which is needed to render progress bars in Jupyter'"
29
+ )
30
+ return self._real.execute(sql, *a, **k)
31
+
32
+ def __getattr__(self, name: str) -> object:
33
+ return getattr(self._real, name)
34
+
35
+
36
+ def test_connection_survives_jupyter_progress_bar_refusal(monkeypatch: pytest.MonkeyPatch) -> None:
37
+ real_connect = duckdb.connect
38
+ monkeypatch.setattr(duckdb, "connect", lambda *a, **k: _JupyterLikeConnection(real_connect(*a, **k)))
39
+ connection._base_cons.clear() # force a fresh base connection through the patched connect
40
+ con = connect()
41
+ try:
42
+ assert con.execute("SELECT 1").fetchone() == (1,)
43
+ finally:
44
+ con.close()
45
+ connection._base_cons.clear()
@@ -1,7 +0,0 @@
1
- duckdb>=0.10
2
- pandas>=1.5
3
-
4
- [dev]
5
- pytest>=7
6
- mypy>=1.10
7
- pandas-stubs