From 92e801bbac75c3df2170f35556161a62068e265a Mon Sep 17 00:00:00 2001 From: Steffen Schneider Date: Sun, 27 Oct 2024 15:18:36 +0100 Subject: [PATCH 1/4] Make bump_version script runnable on MacOS --- tools/bump_version.sh | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/tools/bump_version.sh b/tools/bump_version.sh index fbc161b1..fb89f413 100755 --- a/tools/bump_version.sh +++ b/tools/bump_version.sh @@ -1,7 +1,7 @@ #!/bin/bash # Bump the CEBRA version to the specified value. # Edits all relevant files at once. -# +# # Usage: # tools/bump_version.sh 0.3.1rc1 @@ -10,24 +10,36 @@ if [ -z ${version} ]; then >&1 echo "Specify a version number." >&1 echo "Usage:" >&1 echo "tools/bump_version.sh " + exit 1 +fi + +# Determine the correct sed command based on the OS +# On macOS, the `sed` command requires an empty string argument after `-i` for in-place editing. +# On Linux and other Unix-like systems, the `sed` command only requires `-i` for in-place editing. +if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS + SED_CMD="sed -i .bkp -e" +else + # Linux and other Unix-like systems + SED_CMD="sed -i -e" fi # python cebra version -sed -i "s/__version__ = .*/__version__ = \"${version}\"/" \ - cebra/__init__.py +$SED_CMD "s/__version__ = .*/__version__ = \"${version}\"/" cebra/__init__.py # reinstall script in root -sed -i "s/VERSION=.*/VERSION=${version}/" \ - reinstall.sh +$SED_CMD "s/VERSION=.*/VERSION=${version}/" reinstall.sh # Makefile -sed -i "s/CEBRA_VERSION := .*/CEBRA_VERSION := ${version}/" \ - Makefile +$SED_CMD "s/CEBRA_VERSION := .*/CEBRA_VERSION := ${version}/" Makefile -# Arch linux PKGBUILD -sed -i "s/pkgver=.*/pkgver=${version}/" \ - PKGBUILD +# Arch linux PKGBUILD +$SED_CMD "s/pkgver=.*/pkgver=${version}/" PKGBUILD # Dockerfile -sed -i "s/ENV WHEEL=cebra-.*\.whl/ENV WHEEL=cebra-${version}-py2.py3-none-any.whl/" \ - Dockerfile +$SED_CMD "s/ENV WHEEL=cebra-.*\.whl/ENV WHEEL=cebra-${version}-py2.py3-none-any.whl/" Dockerfile + +# Remove backup files +if [[ "$OSTYPE" == "darwin"* ]]; then + rm cebra/__init__.py.bkp reinstall.sh.bkp Makefile.bkp PKGBUILD.bkp Dockerfile.bkp +fi From acd193e9c5cacd27e6a3283cf8b1813645e2f40d Mon Sep 17 00:00:00 2001 From: Steffen Schneider Date: Sun, 27 Oct 2024 15:19:12 +0100 Subject: [PATCH 2/4] Bump version to 0.5.0rc1 --- Dockerfile | 2 +- Makefile | 2 +- PKGBUILD | 2 +- cebra/__init__.py | 2 +- reinstall.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d734ee6f..e8ac14a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ RUN make dist FROM cebra-base # install the cebra wheel -ENV WHEEL=cebra-0.4.0-py2.py3-none-any.whl +ENV WHEEL=cebra-0.5.0rc1-py2.py3-none-any.whl WORKDIR /build COPY --from=wheel /build/dist/${WHEEL} . RUN pip install --no-cache-dir ${WHEEL}'[dev,integrations,datasets]' diff --git a/Makefile b/Makefile index ca8c5480..a1e8d3b2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CEBRA_VERSION := 0.4.0 +CEBRA_VERSION := 0.5.0rc1 dist: python3 -m pip install virtualenv diff --git a/PKGBUILD b/PKGBUILD index 07fa3a1d..91ba4a4e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Steffen Schneider pkgname=python-cebra _pkgname=cebra -pkgver=0.4.0 +pkgver=0.5.0rc1 pkgrel=1 pkgdesc="Consistent Embeddings of high-dimensional Recordings using Auxiliary variables" url="https://cebra.ai" diff --git a/cebra/__init__.py b/cebra/__init__.py index 204cd2a2..edf1b5ee 100644 --- a/cebra/__init__.py +++ b/cebra/__init__.py @@ -66,7 +66,7 @@ import cebra.integrations.sklearn as sklearn -__version__ = "0.4.0" +__version__ = "0.5.0rc1" __all__ = ["CEBRA"] __allow_lazy_imports = False __lazy_imports = {} diff --git a/reinstall.sh b/reinstall.sh index 778f98eb..549982a1 100755 --- a/reinstall.sh +++ b/reinstall.sh @@ -15,7 +15,7 @@ pip uninstall -y cebra # Get version info after uninstalling --- this will automatically get the # most recent version based on the source code in the current directory. # $(tools/get_cebra_version.sh) -VERSION=0.4.0 +VERSION=0.5.0rc1 echo "Upgrading to CEBRA v${VERSION}" # Upgrade the build system (PEP517/518 compatible) From 13efc97d1a0fb6f718f0083ab9016e8c3286f7b6 Mon Sep 17 00:00:00 2001 From: Steffen Schneider Date: Wed, 22 Jan 2025 00:21:29 +0100 Subject: [PATCH 3/4] fix minor formatting issues --- cebra/integrations/sklearn/cebra.py | 4 +++- docs/source/conf.py | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cebra/integrations/sklearn/cebra.py b/cebra/integrations/sklearn/cebra.py index 9a74eeb6..d5473bac 100644 --- a/cebra/integrations/sklearn/cebra.py +++ b/cebra/integrations/sklearn/cebra.py @@ -28,9 +28,9 @@ import numpy as np import numpy.typing as npt import pkg_resources +import sklearn import sklearn.utils.validation as sklearn_utils_validation import torch -import sklearn from sklearn.base import BaseEstimator from sklearn.base import TransformerMixin from sklearn.utils.metaestimators import available_if @@ -43,12 +43,14 @@ import cebra.models import cebra.solver + def check_version(estimator): # NOTE(stes): required as a check for the old way of specifying tags # https://github.com/scikit-learn/scikit-learn/pull/29677#issuecomment-2334229165 from packaging import version return version.parse(sklearn.__version__) < version.parse("1.6.dev") + def _init_loader( is_cont: bool, is_disc: bool, diff --git a/docs/source/conf.py b/docs/source/conf.py index 025a988b..e88ff10f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -28,18 +28,13 @@ # -- Path setup -------------------------------------------------------------- -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# +import datetime import os import sys sys.path.insert(0, os.path.abspath(".")) -import datetime - -import cebra +import cebra # noqa: E402 def get_years(start_year=2021): @@ -247,6 +242,9 @@ def get_years(start_year=2021): # Download link for the notebook, see # https://nbsphinx.readthedocs.io/en/0.3.0/prolog-and-epilog.html + +# fmt: off +# flake8: noqa: E501 nbsphinx_prolog = r""" .. only:: html @@ -269,3 +267,5 @@ def get_years(start_year=2021): ---- """ +# fmt: on +# flake8: enable=E501 From 0bdb29a091b82e5d4823f9045748008c082673fc Mon Sep 17 00:00:00 2001 From: Steffen Schneider Date: Wed, 22 Jan 2025 00:28:16 +0100 Subject: [PATCH 4/4] remove commented code --- docs/source/conf.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index e88ff10f..c5e12b5a 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -151,11 +151,6 @@ def get_years(start_year=2021): "url": "https://twitter.com/cebraAI", "icon": "fab fa-twitter", }, - # { - # "name": "DockerHub", - # "url": "https://hub.docker.com/r/stffsc/cebra", - # "icon": "fab fa-docker", - # }, { "name": "PyPI", "url": "https://pypi.org/project/cebra/",