Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependencies and support Python 3.13 #385

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
# There is a bug in Python 3.13.0 which breaks Vamb's tests, fixed in 3.13.1
python-version: ["3.10", "3.11", "3.12", "3.13.1"]

steps:
- uses: actions/checkout@v3
Expand Down
22 changes: 11 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
dynamic = ["version"]
name = "vamb"
dependencies = [
"numpy == 1.26.4",
"torch == 2.3.1",
"pycoverm == 0.6.0",
"networkx == 3.2", # 3.3 drops Python 3.9 support
"scikit-learn == 1.5.0",
"numpy == 2.2.1",
"torch == 2.5.1",
"pycoverm == 0.6.2",
"networkx == 3.4.2",
"scikit-learn == 1.6.0",
"dadaptation == 3.2",
"loguru == 0.7.2",
"pyhmmer == 0.10.12",
"pyrodigal == 3.4.1",
"loguru == 0.7.3",
"pyhmmer == 0.10.15",
"pyrodigal == 3.6.3",
]
# Currently pycoverm does not have binaries for Python > 3.12.
# The dependency resolver, will not error on Python 3.13, but attempt
# Currently pycoverm does not have binaries for Python > 3.13.
# The dependency resolver, will not error on Python 3.14, but attempt
# to build pycoverm from source, but will not get the deps required for that.
requires-python = "<3.13,>=3.9.0"
requires-python = "<3.14,>=3.10.0"
scripts = {vamb = "vamb.__main__:main"}

[project.optional-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions test/test_vambtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ def test_axes(self):
)

def test_axis_bounds(self):
with self.assertRaises(np.AxisError):
with self.assertRaises(np.exceptions.AxisError):
vamb.vambtools.zscore(self.arr, axis=-1)

with self.assertRaises(np.AxisError):
with self.assertRaises(np.exceptions.AxisError):
vamb.vambtools.zscore(self.arr, axis=2)

def test_integer(self):
Expand Down
4 changes: 3 additions & 1 deletion vamb/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,9 @@ def load(
"""

# Forcably load to CPU even if model was saves as GPU model
dictionary = _torch.load(path, map_location=lambda storage, loc: storage)
dictionary = _torch.load(
path, map_location=lambda storage, loc: storage, weights_only=True
)

nsamples = dictionary["nsamples"]
alpha = dictionary["alpha"]
Expand Down
4 changes: 3 additions & 1 deletion vamb/semisupervised_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,9 @@ def load(cls, path, cuda=False, evaluate=True):
"""

# Forcably load to CPU even if model was saves as GPU model
dictionary = _torch.load(path, map_location=lambda storage, loc: storage)
dictionary = _torch.load(
path, map_location=lambda storage, loc: storage, weights_only=False
)

nsamples = dictionary["nsamples"]
nlabels = dictionary["nlabels"]
Expand Down
4 changes: 3 additions & 1 deletion vamb/taxvamb_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,9 @@ def load(cls, path, nodes, table_parent, cuda=False, evaluate=True):
"""

# Forcably load to CPU even if model was saves as GPU model
dictionary = _torch.load(path, map_location=lambda storage, loc: storage)
dictionary = _torch.load(
path, map_location=lambda storage, loc: storage, weights_only=False
)

nsamples = dictionary["nsamples"]
nlabels = dictionary["nlabels"]
Expand Down
2 changes: 1 addition & 1 deletion vamb/vambtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def zscore(
"""

if axis is not None and (axis >= array.ndim or axis < 0):
raise _np.AxisError(str(axis))
raise _np.exceptions.AxisError(str(axis))

if inplace and not _np.issubdtype(array.dtype, _np.floating):
raise TypeError("Cannot convert a non-float array to zscores")
Expand Down
Loading