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

Update max py version to <3.14 #1094

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
37 changes: 27 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ name: graspologic Build
on:
push:
paths-ignore:
- '.all-contributorsrc'
- 'CONTRIBUTORS.md'
- ".all-contributorsrc"
- "CONTRIBUTORS.md"
branches-ignore:
- 'dev'
- 'main'
- "dev"
- "main"
pull_request:
paths-ignore:
- '.all-contributorsrc'
- 'CONTRIBUTORS.md'
- ".all-contributorsrc"
- "CONTRIBUTORS.md"
workflow_call:

env:
PYTHON_VERSION: '3.10'
POETRY_VERSION: '1.8.3'
PYTHON_VERSION: "3.10"
POETRY_VERSION: "1.8.3"

jobs:
build-reference-documentation:
Expand Down Expand Up @@ -87,10 +87,24 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_version: ["3.9", "3.10", "3.11", "3.12"]
python_version: ["3.10", "3.11", "3.12", "3.13"]
fail-fast: false
steps:
- uses: actions/checkout@v2

- name: Install OpenBLAS (Linux) # https://github.com/scipy/scipy/issues/16308
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libopenblas-dev

- name: Install OpenBLAS (macOS)
if: runner.os == 'macOS'
run: brew install openblas

- name: Install OpenBLAS (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: choco install openblas -y

- name: Set up Python ${{matrix.python_version}} ${{matrix.os}}
uses: actions/setup-python@v2
with:
Expand All @@ -100,7 +114,10 @@ jobs:
with:
poetry-version: $POETRY_VERSION
- name: Install dependencies
run: poetry install
run: |
pip install --upgrade pip setuptools wheel
pip install meson ninja
poetry install
- name: Run Unit Tests and Doctests Python ${{matrix.python_version}} ${{matrix.os}}
run: poetry run poe tests
- name: Run mypy type check Python ${{matrix.python_version}} ${{matrix.os}}
Expand Down
32 changes: 17 additions & 15 deletions graspologic/embed/mds.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,25 +99,12 @@ def __init__(
dissimilarity: Literal["euclidean", "precomputed"] = "euclidean",
svd_seed: Optional[int] = None,
) -> None:
# Check inputs
if n_components is not None:
if not isinstance(n_components, int):
msg = "n_components must be an integer, not {}.".format(
type(n_components)
)
raise TypeError(msg)
elif n_components <= 0:
msg = "n_components must be >= 1 or None."
raise ValueError(msg)
self.n_components = n_components

if dissimilarity not in ["euclidean", "precomputed"]:
msg = "Dissimilarity measure must be either 'euclidean' or 'precomputed'."
raise ValueError(msg)
# Set properties before error checking
self.dissimilarity = dissimilarity

self.n_elbows = n_elbows
self.svd_seed = svd_seed
self.n_components = n_components

def _compute_euclidean_distances(self, X: np.ndarray) -> np.ndarray:
"""
Expand Down Expand Up @@ -174,6 +161,21 @@ def fit(self, X: np.ndarray, y: Optional[Any] = None) -> "ClassicalMDS":
self : object
Returns an instance of self.
"""
# Check inputs
# ScikitLearn moved validations to fit(). See https://github.com/scikit-learn/scikit-learn/issues/30667
if self.n_components is not None:
if not isinstance(self.n_components, int):
msg = "n_components must be an integer, not {}.".format(
type(self.n_components)
)
raise TypeError(msg)
elif self.n_components <= 0:
msg = "n_components must be >= 1 or None."
raise ValueError(msg)

if self.dissimilarity not in ["euclidean", "precomputed"]:
msg = "Dissimilarity measure must be either 'euclidean' or 'precomputed'."
raise ValueError(msg)
# Check X type
if not isinstance(X, np.ndarray):
msg = "X must be a numpy array, not {}.".format(type(X))
Expand Down
1 change: 0 additions & 1 deletion graspologic/pipeline/embed/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@
from .embeddings import Embeddings, EmbeddingsView
from .laplacian_spectral_embedding import laplacian_spectral_embedding
from .omnibus_embedding import omnibus_embedding_pairwise

2 changes: 1 addition & 1 deletion graspologic/plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ def pairplot_with_gmm(
# allows for the legend to not overlap with plots while also keeping
# legend in frame
fig.subplots_adjust(right=0.85)
return fig, axes
return fig, axes # type: ignore


def _distplot(
Expand Down
6 changes: 4 additions & 2 deletions graspologic/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# This version placeholder will be replaced during package build.
# Do not commit this file.
__version__ ="0.0.0"#
__version__ = "0.0.0" #


#
def __version() -> str:
return __version__
return __version__
Loading
Loading