From 97013f0321e245c2e34b317e9d83e05eaae109ec Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 25 Aug 2026 10:59:19 +0100 Subject: [PATCH] build: use released probeinterface version for auto-prs and tests --- .../workflows/check_for_changes_in_NP_jsons.yml | 16 ++++++---------- .github/workflows/check_for_new_NP_probes.yml | 6 ++++-- .../generate_cambridge_neurotech_library.yml | 6 ++++-- tests.py | 11 ++++++++++- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check_for_changes_in_NP_jsons.yml b/.github/workflows/check_for_changes_in_NP_jsons.yml index 0c538ad..79759f3 100644 --- a/.github/workflows/check_for_changes_in_NP_jsons.yml +++ b/.github/workflows/check_for_changes_in_NP_jsons.yml @@ -24,18 +24,14 @@ jobs: with: python-version: '3.10' - # we just the release probeinterface to get the version number + # we use the released probeinterface, cloned so that the generation + # scripts under resources/ are available as well - name: Install probeinterface and matplotlib run: | - pip install probeinterface matplotlib - PROBEINTERFACE_VERSION=$(pip show probeinterface | grep Version | awk '{print $2}') - pip uninstall probeinterface --yes - git clone https://github.com/spikeinterface/probeinterface ./probeinterface - cd probeinterface - git fetch - git checkout tags/$PROBEINTERFACE_VERSION - cd .. - pip install ./probeinterface + PROBEINTERFACE_VERSION=$(git ls-remote --tags --refs --sort=-v:refname https://github.com/spikeinterface/probeinterface | head -n 1 | sed 's|.*refs/tags/||') + echo "Cloning probeinterface $PROBEINTERFACE_VERSION" + git clone --depth 1 --branch "$PROBEINTERFACE_VERSION" https://github.com/spikeinterface/probeinterface ./probeinterface + pip install ./probeinterface matplotlib - name: Generate full NP library and check for changes diff --git a/.github/workflows/check_for_new_NP_probes.yml b/.github/workflows/check_for_new_NP_probes.yml index ddd8a75..beb4650 100644 --- a/.github/workflows/check_for_new_NP_probes.yml +++ b/.github/workflows/check_for_new_NP_probes.yml @@ -24,10 +24,12 @@ jobs: with: python-version: '3.10' - # Clone dev version of probeinterface + # Clone the latest released version of probeinterface - name: Clone external repository run: | - git clone https://github.com/spikeinterface/probeinterface ./probeinterface + PROBEINTERFACE_VERSION=$(git ls-remote --tags --refs --sort=-v:refname https://github.com/spikeinterface/probeinterface | head -n 1 | sed 's|.*refs/tags/||') + echo "Cloning probeinterface $PROBEINTERFACE_VERSION" + git clone --depth 1 --branch "$PROBEINTERFACE_VERSION" https://github.com/spikeinterface/probeinterface ./probeinterface - name: Install probeinterface and matplotlib run: pip install ./probeinterface matplotlib diff --git a/.github/workflows/generate_cambridge_neurotech_library.yml b/.github/workflows/generate_cambridge_neurotech_library.yml index 4a067fa..b5fdc54 100644 --- a/.github/workflows/generate_cambridge_neurotech_library.yml +++ b/.github/workflows/generate_cambridge_neurotech_library.yml @@ -24,11 +24,13 @@ jobs: with: python-version: '3.10' - # Clone dev version of probeinterface + # Clone the latest released version of probeinterface - name: Clone external repositories run: | # probeinterface - git clone https://github.com/spikeinterface/probeinterface ./probeinterface + PROBEINTERFACE_VERSION=$(git ls-remote --tags --refs --sort=-v:refname https://github.com/spikeinterface/probeinterface | head -n 1 | sed 's|.*refs/tags/||') + echo "Cloning probeinterface $PROBEINTERFACE_VERSION" + git clone --depth 1 --branch "$PROBEINTERFACE_VERSION" https://github.com/spikeinterface/probeinterface ./probeinterface # cambridge neurotech probe maps git clone https://github.com/cambridge-neurotech/probe_maps.git ./probe_maps diff --git a/tests.py b/tests.py index c078064..c52703c 100644 --- a/tests.py +++ b/tests.py @@ -5,7 +5,16 @@ import pytest import requests -schema_url = "https://raw.githubusercontent.com/SpikeInterface/probeinterface/main/src/probeinterface/schema/probe.json.schema" +# Validate against the schema of the latest *released* probeinterface, not main: +# the catalog is meant to be readable by the version users actually install. +pypi_response = requests.get("https://pypi.org/pypi/probeinterface/json") +pypi_response.raise_for_status() +probeinterface_version = pypi_response.json()["info"]["version"] + +schema_url = ( + f"https://raw.githubusercontent.com/SpikeInterface/probeinterface/{probeinterface_version}/" + "src/probeinterface/schema/probe.json.schema" +) response = requests.get(schema_url) response.raise_for_status()