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

Release v4.5.1 #91

Merged
merged 5 commits into from
Aug 8, 2024
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ repos:
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
rev: v0.5.6
hooks:
- id: ruff
args: [--fix, --select, I, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.359
rev: v1.1.374
hooks:
- id: pyright
additional_dependencies: [cython, httpretty, numpy, pytest]
2 changes: 1 addition & 1 deletion cryosparc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "4.5.0"
__version__ = "4.5.1"


def get_include():
Expand Down
4 changes: 2 additions & 2 deletions cryosparc/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def __new__(cls, field: Field, data: Data):

return obj

def __array_wrap__(self, obj, context=None):
def __array_wrap__(self, obj, context=None, return_scalar=False):
# This prevents wrapping single results such as aggregations from n.sum
# or n.median
return obj[()] if obj.shape == () else super().__array_wrap__(obj, context)
return obj[()] if obj.shape == () else super().__array_wrap__(obj, context, return_scalar) # type: ignore

def to_fixed(self) -> "Column":
"""
Expand Down
19 changes: 10 additions & 9 deletions cryosparc/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
Mapping,
MutableMapping,
Optional,
Sequence,
Set,
Tuple,
Type,
Expand Down Expand Up @@ -151,7 +152,7 @@ class Dataset(Streamable, MutableMapping[str, Column], Generic[R]):
_data: Data

@classmethod
def allocate(cls, size: int = 0, fields: List[Field] = []):
def allocate(cls, size: int = 0, fields: Sequence[Field] = []):
"""
Allocate a dataset with the given number of rows and specified fields.

Expand Down Expand Up @@ -716,11 +717,11 @@ def __init__(
List[Tuple[str, "ArrayLike"]],
Literal[None],
] = 0,
row_class: Type[R] = Row,
row_class=Row,
):
# Always initialize with at least a UID field
super().__init__()
self._row_class = row_class
self._row_class = row_class # type: ignore
self._rows = None

if isinstance(allocate, Dataset):
Expand All @@ -746,11 +747,11 @@ def __init__(
populate.append((field, allocate[field[0]]))
elif isinstance(allocate, Mapping):
for f, v in allocate.items():
a = n.array(v, copy=False)
a = n.asarray(v)
populate.append((safe_makefield(f, arraydtype(a)), a))
else:
for f, v in allocate:
a = n.array(v, copy=False)
a = n.asarray(v)
populate.append((safe_makefield(f, arraydtype(a)), a))

# Check that all entries are the same length
Expand Down Expand Up @@ -977,13 +978,13 @@ def prefixes(self) -> List[str]:
return list({f.split("/")[0] for f in self.fields(exclude_uid=True)})

@overload
def add_fields(self, fields: List[Field]) -> "Dataset[R]": ...
def add_fields(self, fields: Sequence[Field]) -> "Dataset[R]": ...
@overload
def add_fields(self, fields: List[str], dtypes: Union[str, List["DTypeLike"]]) -> "Dataset[R]": ...
def add_fields(self, fields: Sequence[str], dtypes: Union[str, Sequence["DTypeLike"]]) -> "Dataset[R]": ...
def add_fields(
self,
fields: Union[List[str], List[Field]],
dtypes: Union[str, List["DTypeLike"], Literal[None]] = None,
fields: Union[Sequence[str], Sequence[Field]],
dtypes: Union[str, Sequence["DTypeLike"], Literal[None]] = None,
) -> "Dataset[R]":
"""
Adds the given fields to the dataset. If a field with the same name
Expand Down
3 changes: 3 additions & 0 deletions cryosparc/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@
"particle",
"template",
"volume",
"volume_multi",
"mask",
"live",
"ml_model",
"symmetry_candidate",
"flex_mesh",
"flex_model",
"hyperparameter",
"denoise_model",
"annotation_model",
]
"""Supported data types for job inputs and outputs."""

Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "cryosparc-tools"
version = "4.5.0"
version = "4.5.1"
description = "Toolkit for interfacing with CryoSPARC"
readme = "README.md"
requires-python = ">=3.7"
Expand All @@ -20,7 +20,7 @@ classifiers = [
"Topic :: Software Development :: Libraries",
]
license = { file = "LICENSE" }
dependencies = ["numpy ~= 1.15", "typing-extensions >= 3.7"]
dependencies = ["numpy >= 1.15, < 3.0", "typing-extensions >= 3.7"]

[project.optional-dependencies]
dev = [
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

setup(
name="cryosparc_tools",
version="4.5.0",
version="4.5.1",
description="Toolkit for interfacing with CryoSPARC",
headers=["cryosparc/include/cryosparc-tools/dataset.h"],
ext_modules=cythonize(
Expand Down