Skip to content

Commit

Permalink
dropping oldest supported numpy (#276)
Browse files Browse the repository at this point in the history
* dropping oldest supported numpy

* format fix

* check no-build

* undo no-build

* changing  reqs

* dropping 3.8 adding 3.13

* fixing tests for overflows

* changing test phrasing

* handling invalid uint64 values

* not ready for python 3.13

* remove raises

* any negative number

---------

Co-authored-by: Ben Pedigo <benjamindpedigo@gmail.com>
  • Loading branch information
fcollman and bdpedigo authored Dec 10, 2024
1 parent 9564ad8 commit b5e3640
Show file tree
Hide file tree
Showing 6 changed files with 936 additions and 1,802 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: Test against different Python versions
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion caveclient/annotationengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def update_metadata(
metadata["user_id"] = user_id
if notice_text is not None:
if notice_text == "None":
metadata["notice_text"] = ''
metadata["notice_text"] = ""
else:
metadata["notice_text"] = notice_text

Expand Down
17 changes: 14 additions & 3 deletions caveclient/chunkedgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,16 @@ def is_valid_nodes(
np.array of bool
Array of whether these are valid IDs.
"""
node_ids = root_id_int_list_check(node_ids, make_unique=False)
node_ids = np.array(node_ids, dtype=np.int64)
invalid_mask = node_ids <= 0
valid_mask = ~invalid_mask

valid_node_ids = node_ids[valid_mask]

if valid_node_ids.size == 0:
return np.full(node_ids.shape, False, dtype=bool)

valid_node_ids = root_id_int_list_check(valid_node_ids, make_unique=False)

endpoint_mapping = self.default_url_mapping
url = self._endpoints["valid_nodes"].format_map(endpoint_mapping)
Expand All @@ -1343,15 +1352,17 @@ def is_valid_nodes(
)
)

data = {"node_ids": node_ids}
data = {"node_ids": valid_node_ids}
r = handle_response(
self.session.get(
url, data=json.dumps(data, cls=BaseEncoder), params=query_d
)
)
valid_ids = np.array(r["valid_roots"], np.uint64)
result = np.full(node_ids.shape, False, dtype=bool)
result[valid_mask] = np.isin(valid_node_ids, valid_ids)

return np.isin(node_ids, valid_ids)
return result

@_check_version_compatibility(
kwarg_use_constraints={
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies = [
"ipython>6",
"jsonschema",
"networkx",
"oldest-supported-numpy",
"numpy>1.19.3",
"packaging>=24.1",
"pandas<3.0.0",
"pyarrow>=3",
Expand All @@ -19,7 +19,7 @@ license = "MIT"
maintainers = [{ name = "CAVE Developers" }]
name = "caveclient"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.9"
version = "7.3.1"

[project.urls]
Expand Down
1 change: 1 addition & 0 deletions tests/test_chunkedgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,5 +1037,6 @@ def test_is_valid_nodes(self, myclient):
json=return_data,
match=[json_params_matcher(data)],
)

out = myclient.chunkedgraph.is_valid_nodes(query_nodes)
assert not np.any(out)
Loading

0 comments on commit b5e3640

Please sign in to comment.