From 7adadd2fcb58bedf9b418e0eedf660b2832d2750 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 15 Oct 2025 11:05:22 -0400 Subject: [PATCH 1/7] Add github action to codespell main on push and PRs --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..b231667 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 From 6ea107a1b770381f179d929385bd5c91faaa0827 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 15 Oct 2025 11:05:22 -0400 Subject: [PATCH 2/7] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 1612940..7927849 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,3 +65,10 @@ omit = [ [tool.black] line-length = 120 + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git*,*.pdf' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From 84689b54c13ca9fd5f7f212017117a43fbce9995 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 15 Oct 2025 16:00:09 -0400 Subject: [PATCH 3/7] Add pre-commit definition for codespell --- .pre-commit-config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index efcfc92..9a0fdd5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,3 +10,9 @@ repos: hooks: - id: black files: ^src/|^tests/ + +- repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in .pre-commit-config.yaml + rev: v2.4.1 + hooks: + - id: codespell From c68f96d06d80beb9e3bfc8396441dbafed30c315 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 15 Oct 2025 16:17:39 -0400 Subject: [PATCH 4/7] Tune up codespell config to skip more --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7927849..00cd655 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,7 +68,7 @@ line-length = 120 [tool.codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file -skip = '.git*,*.pdf' +skip = '.git*,*.pdf,*.svg,data,./doc/releases' check-hidden = true # ignore-regex = '' # ignore-words-list = '' From 285bb1ea9cee5d159b84426e1e80accf0b9b8367 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 15 Oct 2025 16:17:49 -0400 Subject: [PATCH 5/7] [DATALAD RUNCMD] chore: run codespell throughout fixing a few typos interactively === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 4 ./tests/test_io/test_openephys.py", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- tests/test_io/test_openephys.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_io/test_openephys.py b/tests/test_io/test_openephys.py index 33f95f0..7c47894 100644 --- a/tests/test_io/test_openephys.py +++ b/tests/test_io/test_openephys.py @@ -97,7 +97,7 @@ def test_NP1_subset(): assert len(probe_lf.contact_positions) == 200 # Not specifying the stream_name should raise an Exception, because both the ProbeA-AP and - # ProbeA-LFP have custome channel selections + # ProbeA-LFP have custom channel selections with pytest.raises(AssertionError): probe = read_openephys(data_path / "OE_Neuropix-PXI-subset" / "settings.xml") From 0119110e87f3e0546b11dc774a67a03a50d62c21 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 15 Oct 2025 16:17:52 -0400 Subject: [PATCH 6/7] [DATALAD RUNCMD] chore: run codespell throughout fixing a few new typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- resources/generate_cambridgeneurotech_libray.py | 8 ++++---- resources/generate_neuropixels_library.py | 2 +- src/probeinterface/io.py | 2 +- src/probeinterface/neuropixels_tools.py | 6 +++--- src/probeinterface/probe.py | 2 +- src/probeinterface/probegroup.py | 2 +- src/probeinterface/utils.py | 2 +- src/probeinterface/wiring.py | 2 +- tests/test_io/test_spikeglx.py | 8 ++++---- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/resources/generate_cambridgeneurotech_libray.py b/resources/generate_cambridgeneurotech_libray.py index cdba673..84fb039 100644 --- a/resources/generate_cambridgeneurotech_libray.py +++ b/resources/generate_cambridgeneurotech_libray.py @@ -8,7 +8,7 @@ The script have been modified by Smauel Garcia (samuel.garcia@cnrs.fr): * more pytonic * improve code readability - * not more channel_device_index the order is the conatct index + * not more channel_device_index the order is the contact index * simpler function for plotting. 2021-04-02 @@ -72,7 +72,7 @@ def convert_probe_shape(listCoord): ''' - This is to convert reference point probe shape inputed in excel + This is to convert reference point probe shape inputted in excel as string 'x y x y x y that outline the shape of one shanck and can be converted to an array to draw the porbe ''' @@ -95,7 +95,7 @@ def get_contact_order(connector, probe_type): This will help to re-order the probe contact later on. """ - # first part of the function to opne the proper connector based on connector name + # first part of the function to open the proper connector based on connector name # header [0,1] is used to create a mutliindex df = pd.read_excel(probe_map_file, sheet_name=connector, header=[0,1]) @@ -188,7 +188,7 @@ def generate_CN_multi_shank(probe_info): def create_CN_figure(probe_name, probe): """ - Create custum figire for CN with custum colors + logo + Create custom figire for CN with custom colors + logo """ fig, ax = plt.subplots() fig.set_size_inches(18.5, 10.5) diff --git a/resources/generate_neuropixels_library.py b/resources/generate_neuropixels_library.py index ade3b74..9dbb034 100644 --- a/resources/generate_neuropixels_library.py +++ b/resources/generate_neuropixels_library.py @@ -51,7 +51,7 @@ def generate_all_npx(): probe = _make_npx_probe_from_description(pt_metadata, model_name, elec_ids, shank_ids) - # ploting + # plotting fig, axs = plt.subplots(ncols=2) ax = axs[0] diff --git a/src/probeinterface/io.py b/src/probeinterface/io.py index d3d7c5e..ccb391b 100644 --- a/src/probeinterface/io.py +++ b/src/probeinterface/io.py @@ -728,7 +728,7 @@ def read_csv(file: str | Path): def write_csv(file, probe): """ - Write contact postions into a 2 or 3 columns csv file + Write contact positions into a 2 or 3 columns csv file """ raise NotImplementedError diff --git a/src/probeinterface/neuropixels_tools.py b/src/probeinterface/neuropixels_tools.py index d101b62..c7f9151 100644 --- a/src/probeinterface/neuropixels_tools.py +++ b/src/probeinterface/neuropixels_tools.py @@ -67,7 +67,7 @@ def _load_np_probe_features(): "NP2020": "2020", # Ultra "NP1100": "1100", # Ultra probe - 1 bank - "NP1110": "1110", # Ultra probe - 16 banks no handle beacuse + "NP1110": "1110", # Ultra probe - 16 banks no handle because "NP1121": "1121", # Ultra probe - beta configuration # Opto "NP1300": "1300", # Opto probe @@ -103,7 +103,7 @@ def get_probe_length(probe_part_number: str) -> int: Returns ------- probe_length : int - Lenth of full probe (microns) + Length of full probe (microns) """ probe_length = 10_000 @@ -1128,7 +1128,7 @@ def get_saved_channel_indices_from_openephys_settings( if len(possible_custom_streams) > 1: warnings.warn( f"More than one custom parameters associated to {stream_name} " - f"found. Using fisrt one" + f"found. Using first one" ) custom_stream = possible_custom_streams[0] else: diff --git a/src/probeinterface/probe.py b/src/probeinterface/probe.py index 7b2be6c..fb7ac24 100644 --- a/src/probeinterface/probe.py +++ b/src/probeinterface/probe.py @@ -1154,7 +1154,7 @@ def add_probe_to_zarr_group(self, group: "zarr.Group") -> None: data = probe_arr[field_name] group.create_dataset(name=field_name, data=data, dtype=dtype, chunks=False) - # Annotations as a group (special attibutes are stored as annotations) + # Annotations as a group (special attributes are stored as annotations) annotations_group = group.create_group("annotations") for key, value in self.annotations.items(): annotations_group.attrs[key] = value diff --git a/src/probeinterface/probegroup.py b/src/probeinterface/probegroup.py index fc95a3f..ed55b25 100644 --- a/src/probeinterface/probegroup.py +++ b/src/probeinterface/probegroup.py @@ -226,7 +226,7 @@ def set_global_device_channel_indices(self, channels: np.array | list): f"Wrong channels size {channels.size} for the number of channels {self.get_contact_count()}" ) - # first reset previsous indices + # first reset previous indices for i, probe in enumerate(self.probes): n = probe.get_contact_count() probe.set_device_channel_indices([-1] * n) diff --git a/src/probeinterface/utils.py b/src/probeinterface/utils.py index 5a87acf..6e8aa8a 100644 --- a/src/probeinterface/utils.py +++ b/src/probeinterface/utils.py @@ -113,7 +113,7 @@ def generate_unique_ids(min: int, max: int, n: int, trials: int = 20) -> np.arra Parameters ---------- min : int - Minimun value permitted for an identifier + Minimum value permitted for an identifier max : int Maximum value permitted for an identifier n : int diff --git a/src/probeinterface/wiring.py b/src/probeinterface/wiring.py index 5208edf..0e0a5bb 100644 --- a/src/probeinterface/wiring.py +++ b/src/probeinterface/wiring.py @@ -60,7 +60,7 @@ 31, 30 ], - # from PDF documention of mini-amp-64 page 5 + # from PDF documentation of mini-amp-64 page 5 'cambridgeneurotech_mini-amp-64': [ # connector J2 TOP 41, 39, 38, 37, 35, 34, 33, 32, 29, 30, 28, 26, 25, 24, 22, 20, diff --git a/tests/test_io/test_spikeglx.py b/tests/test_io/test_spikeglx.py index 99b3a0a..ab51329 100644 --- a/tests/test_io/test_spikeglx.py +++ b/tests/test_io/test_spikeglx.py @@ -86,7 +86,7 @@ def test_NP2_4_shanks(): assert np.all(probe.contact_shape_params == {"width": contact_width}) assert np.all(probe.contact_shapes == contact_shape) - # This file does not save the channnels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) + # This file does not save the channels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) ypos = probe.contact_positions[:, 1] assert np.min(ypos) == pytest.approx(0) @@ -109,7 +109,7 @@ def test_NP2_2013_all(): assert np.all(probe.contact_shape_params == {"width": contact_width}) assert np.all(probe.contact_shapes == contact_shape) - # This file does not save the channnels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) + # This file does not save the channels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) ypos = probe.contact_positions[:, 1] assert np.min(ypos) == pytest.approx(0) @@ -132,7 +132,7 @@ def test_NP2_2013_subset(): assert np.all(probe.contact_shape_params == {"width": contact_width}) assert np.all(probe.contact_shapes == contact_shape) - # This file does not save the channnels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) + # This file does not save the channels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) ypos = probe.contact_positions[:, 1] assert np.min(ypos) == pytest.approx(0) @@ -154,7 +154,7 @@ def test_NP2_4_shanks_with_different_electrodes_saved(): assert np.all(probe.contact_shape_params == {"width": contact_width}) assert np.all(probe.contact_shapes == contact_shape) - # This file does not save the channnels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) + # This file does not save the channels from 0 as the one above (NP2_4_shanks_g0_t0.imec0.ap.meta) ypos = probe.contact_positions[:, 1] assert np.min(ypos) == pytest.approx(4080.0) assert np.max(ypos) == pytest.approx(4785.0) From 7d4c3374cf08aa6d2cfc264b1698d196f6d4e87d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 17 Oct 2025 13:00:09 -0400 Subject: [PATCH 7/7] Tune up pre-commit and config --- .pre-commit-config.yaml | 6 ++++-- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9a0fdd5..79cd6a9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,9 +10,11 @@ repos: hooks: - id: black files: ^src/|^tests/ - - repo: https://github.com/codespell-project/codespell # Configuration for codespell is in .pre-commit-config.yaml rev: v2.4.1 hooks: - - id: codespell + - id: codespell + additional_dependencies: + - tomli # for python_version < '3.11' + exclude: ^doc/releases/.*\.rst diff --git a/pyproject.toml b/pyproject.toml index 00cd655..5f397ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,4 +71,4 @@ line-length = 120 skip = '.git*,*.pdf,*.svg,data,./doc/releases' check-hidden = true # ignore-regex = '' -# ignore-words-list = '' +ignore-words-list = 'compiletime'