From 24b2b5790f5c061d67c83227f84db3e93015b173 Mon Sep 17 00:00:00 2001 From: Arnab Biswas Date: Tue, 4 Feb 2025 13:16:17 -0800 Subject: [PATCH 01/14] Update CONTRIBUTING.md fix broken link to documentation --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6963b567..393972ad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ Developers are encouraged to contribute to various areas of development. This co Feel free to work on any section of code that you believe you can improve. More importantly, remember to thoroughly test all your classes and functions, and to provide clear, detailed comments within your code. This not only aids others in using the library, but also facilitates future maintenance and further development. -For more detailed information about NeMoS modules, including design choices and implementation details, visit the [`For Developers`](https://nemos.readthedocs.io/en/latest/developers_notes/) section of the package documentation. +For more detailed information about NeMoS modules, including design choices and implementation details, visit the [`For Developers`](https://nemos.readthedocs.io/en/latest/developers_notes/README.html) section of the package documentation. ## Contributing to the code From 8361cf886aed492e645c8a59957b6b279ec88056 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 16:37:59 -0500 Subject: [PATCH 02/14] first attempt add link checks --- .github/workflows/ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e967ed2..b091999a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: - name: Run tox run: tox -e check - prevent_docs_absolute_links: + prevent_docs_absolute_links_and_check_readme: runs-on: ubuntu-latest steps: - name: Checkout code @@ -81,6 +81,15 @@ jobs: - name: Check links run: ./bash_scripts/prevent_absolute_links_to_docs.sh + - name: Install markdown-link-check + run: npm install -g markdown-link-check + + - name: Check links in README.md + run: markdown-link-check README.md --config .markdown-link-check.json + + - name: Check links in CONTRIBUTING.md + run: markdown-link-check CONTRIBUTING.md --config .markdown-link-check.json + check: if: ${{ !github.event.pull_request.draft }} needs: From 15bb1ce55be8a9fc2c2a3c52d9dc97252bc4fa2c Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 16:40:57 -0500 Subject: [PATCH 03/14] push ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b091999a..8c18a1cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: - name: Run tox run: tox -e check - prevent_docs_absolute_links_and_check_readme: + prevent_docs_absolute_links: runs-on: ubuntu-latest steps: - name: Checkout code From d220a809ebfaf198c1c7ab4c144ce8d3faef9b7e Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 16:42:45 -0500 Subject: [PATCH 04/14] add --- .github/workflows/ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c18a1cf..6be36058 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,14 +81,17 @@ jobs: - name: Check links run: ./bash_scripts/prevent_absolute_links_to_docs.sh - - name: Install markdown-link-check - run: npm install -g markdown-link-check + check-links: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 - - name: Check links in README.md - run: markdown-link-check README.md --config .markdown-link-check.json + - name: Install markdown-link-check + run: npm install -g markdown-link-check - - name: Check links in CONTRIBUTING.md - run: markdown-link-check CONTRIBUTING.md --config .markdown-link-check.json + - name: Check links in README.md + run: markdown-link-check README.md --config .markdown-link-check.json check: if: ${{ !github.event.pull_request.draft }} @@ -96,6 +99,7 @@ jobs: - tox_tests - prevent_docs_absolute_links - tox_check + - check-links runs-on: ubuntu-latest steps: - name: Decide whether all tests and notebooks succeeded From e57033c7fed625ed3b7274ded65c3a0226dc28f4 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 16:44:49 -0500 Subject: [PATCH 05/14] add --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6be36058..2283b9b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,10 @@ jobs: run: npm install -g markdown-link-check - name: Check links in README.md - run: markdown-link-check README.md --config .markdown-link-check.json + run: markdown-link-check README.md + + - name: Check links in CONTRIBUTING.md + run: markdown-link-check CONTRIBUTING.md check: if: ${{ !github.event.pull_request.draft }} From 1694ed0d6010f3832a172e69b5213b4e17bfb306 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 16:48:40 -0500 Subject: [PATCH 06/14] added --- .github/workflows/ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2283b9b7..04efa7c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,11 +90,9 @@ jobs: - name: Install markdown-link-check run: npm install -g markdown-link-check - - name: Check links in README.md - run: markdown-link-check README.md - - - name: Check links in CONTRIBUTING.md - run: markdown-link-check CONTRIBUTING.md + - name: Check links in root Markdown files + run: | + find . -maxdepth 1 -name "*.md" | xargs -n1 markdown-link-check || exit 1 check: if: ${{ !github.event.pull_request.draft }} From b6ef8939378e53639302d85f57235f850e20bb81 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 16:54:07 -0500 Subject: [PATCH 07/14] use a md check action --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04efa7c4..eef1aeca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,12 +87,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install markdown-link-check - run: npm install -g markdown-link-check - - - name: Check links in root Markdown files - run: | - find . -maxdepth 1 -name "*.md" | xargs -n1 markdown-link-check || exit 1 + - name: Check Markdown links (Root Folder Only) + uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + folder-path: "./" # Only checks Markdown files in the root folder + use-verbose-mode: yes # Provides detailed output check: if: ${{ !github.event.pull_request.draft }} From 7cc96016c10715cf4237658e603f2d42bd9ce7cb Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 16:59:08 -0500 Subject: [PATCH 08/14] try config file to only search files not in the static website (those are checked at teh html level directly) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eef1aeca..9d52b023 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,7 +90,7 @@ jobs: - name: Check Markdown links (Root Folder Only) uses: gaurav-nelson/github-action-markdown-link-check@v1 with: - folder-path: "./" # Only checks Markdown files in the root folder + config-file: .markdown-link-check.json use-verbose-mode: yes # Provides detailed output check: From a222a15be53d90bc15d087cd2222f29bdfaa4eb0 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 17:01:22 -0500 Subject: [PATCH 09/14] add conf --- .markdown-link-check.json | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .markdown-link-check.json diff --git a/.markdown-link-check.json b/.markdown-link-check.json new file mode 100644 index 00000000..b3339d8c --- /dev/null +++ b/.markdown-link-check.json @@ -0,0 +1,8 @@ +{ + "files": [ + "README.md", + "CONTRIBUTING.md", + "CODE_OF_CONDUCT.md" + ], +} + From dc1fe2577fe6f119d453006bc5e00d91aefb5432 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 17:06:56 -0500 Subject: [PATCH 10/14] remove config and add file path option --- .github/workflows/ci.yml | 3 +-- .markdown-link-check.json | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 .markdown-link-check.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d52b023..93c07866 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,8 +90,7 @@ jobs: - name: Check Markdown links (Root Folder Only) uses: gaurav-nelson/github-action-markdown-link-check@v1 with: - config-file: .markdown-link-check.json - use-verbose-mode: yes # Provides detailed output + file-path: "README.md CONTRIBUTING.md CODE_OF_CONDUCT.md" check: if: ${{ !github.event.pull_request.draft }} diff --git a/.markdown-link-check.json b/.markdown-link-check.json deleted file mode 100644 index b3339d8c..00000000 --- a/.markdown-link-check.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "files": [ - "README.md", - "CONTRIBUTING.md", - "CODE_OF_CONDUCT.md" - ], -} - From e5d1106a61bb36e32a124b203e579e1fb759c47e Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 17:11:34 -0500 Subject: [PATCH 11/14] do not use action --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93c07866..e09e5d66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,10 +87,15 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Check Markdown links (Root Folder Only) - uses: gaurav-nelson/github-action-markdown-link-check@v1 - with: - file-path: "README.md CONTRIBUTING.md CODE_OF_CONDUCT.md" + - name: Install markdown-link-check + run: npm install -g markdown-link-check + + - name: Check links in root Markdown files + run: | + set -o pipefail # Ensure failures propagate in pipes + find . -maxdepth 1 -name "*.md" | while read file; do + markdown-link-check "$file" || exit 1 # Exit if any file has dead links + done check: if: ${{ !github.event.pull_request.draft }} From 70ecb43f32322d19c4e22f8867bbcca498c6ed2c Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 17:14:03 -0500 Subject: [PATCH 12/14] try to set error flag --- .github/workflows/ci.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e09e5d66..38359b33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,10 +92,12 @@ jobs: - name: Check links in root Markdown files run: | - set -o pipefail # Ensure failures propagate in pipes - find . -maxdepth 1 -name "*.md" | while read file; do - markdown-link-check "$file" || exit 1 # Exit if any file has dead links + set -o pipefail # Ensure failure propagates properly + ERROR=0 # Initialize error flag + for file in $(find . -maxdepth 1 -name "*.md"); do + markdown-link-check "$file" || ERROR=1 # If any file fails, set ERROR=1 done + exit $ERROR # Exit with failure status if any file had dead links check: if: ${{ !github.event.pull_request.draft }} From 718850309d40cc0d4548064a43b7952165ebd167 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 17:49:30 -0500 Subject: [PATCH 13/14] fix all links and make sure ci fails --- .github/workflows/ci.yml | 11 ++++----- CONTRIBUTING.md | 4 ++-- README.md | 10 ++++---- bash_scripts/check_markdown_links.sh | 35 ++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 14 deletions(-) create mode 100755 bash_scripts/check_markdown_links.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38359b33..c461db69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,14 +90,11 @@ jobs: - name: Install markdown-link-check run: npm install -g markdown-link-check + - name: Make .sh executable + run: chmod +x bash_scripts/check_markdown_links.sh + - name: Check links in root Markdown files - run: | - set -o pipefail # Ensure failure propagates properly - ERROR=0 # Initialize error flag - for file in $(find . -maxdepth 1 -name "*.md"); do - markdown-link-check "$file" || ERROR=1 # If any file fails, set ERROR=1 - done - exit $ERROR # Exit with failure status if any file had dead links + run: ./bash_scripts/check_markdown_links.sh check: if: ${{ !github.event.pull_request.draft }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 393972ad..10b139ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ pip install -e .[dev] ``` > [!NOTE] -> In order to install `nemos` in editable mode you will need a Python virtual environment. Please see our documentation [here](https://nemos.readthedocs.io/en/latest/installation/) that provides guidance on how to create and activate a virtual environment. +> In order to install `nemos` in editable mode you will need a Python virtual environment. Please see our documentation [here](https://nemos.readthedocs.io/en/latest/installation.html) that provides guidance on how to create and activate a virtual environment. 3) Add the upstream branch: @@ -184,7 +184,7 @@ it must have an `.py` extension, and it must be contained within the `tests` dir add it to the tests-to-run. > [!NOTE] -> If you have many variants on a test you wish to run, you should make use of pytest's `parameterize` mark. See the official documentation [here](https://docs.pytest.org/en/stable/how-to/parametrize.html) and NeMoS [`test_error_invalid_entry`](https://github.com/flatironinstitute/nemos/blob/main/tests/test_vallidation.py#L27) for a concrete implementation. +> If you have many variants on a test you wish to run, you should make use of pytest's `parameterize` mark. See the official documentation [here](https://docs.pytest.org/en/stable/how-to/parametrize.html) and NeMoS [`test_error_invalid_entry`](https://github.com/flatironinstitute/nemos/blob/main/tests/test_validation.py) for a concrete implementation. > [!NOTE] > If you are using an object that gets used in multiple tests (such as a model with certain data, regularizer, or solver), you should use pytest's `fixtures` to avoid having to load or instantiate the object multiple times. Look at our `conftest.py` to see already available fixtures for your tests. See the official documentation [here](https://docs.pytest.org/en/stable/how-to/fixtures.html). diff --git a/README.md b/README.md index ba998584..22bc21d8 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ We provide a **Poisson GLM** for analyzing spike counts, and a **Gamma GLM** for The package is under active development and more methods will be added in the future. For those looking to get a better grasp of the Generalized Linear Model, we recommend checking out the -Neuromatch Academy's lesson [here](https://compneuro.neuromatch.io/tutorials/W1D3_GeneralizedLinearModels/student/W1D3_Tutorial1.htmls) and Jonathan Pillow's tutorial +Neuromatch Academy's lesson [here](https://compneuro.neuromatch.io/tutorials/W1D3_GeneralizedLinearModels/student/W1D3_Tutorial1.html) and Jonathan Pillow's tutorial from Cosyne 2018 [here](https://www.youtube.com/watch?v=NFeGW5ljUoI&t=424s). ## Overview @@ -99,7 +99,7 @@ ll = glm.score(X, y) This second example demonstrates feature construction by convolving the simultaneously recorded population spike counts with a bank of filters, utilizing the basis in `conv` mode. -The figure above show the GLM scheme for a single neuron, however in NeMoS you can fit jointly the whole population with the [`PopulationGLM`](https://nemos.readthedocs.io/en/latest/generated/how_to_guide/plot_04_population_glm/) object. +The figure above show the GLM scheme for a single neuron, however in NeMoS you can fit jointly the whole population with the [`PopulationGLM`](https://nemos.readthedocs.io/en/latest/how_to_guide/plot_03_population_glm.html) object. #### Feature Representation @@ -127,8 +127,8 @@ firing_rate = glm.predict(X) ll = glm.score(X, spike_counts) ``` -For a deeper dive, see our [Quickstart](https://nemos.readthedocs.io/en/latest/quickstart/) guide and consider using [pynapple](https://github.com/pynapple-org/pynapple) for data exploration and preprocessing. When initializing the GLM object, you may optionally specify an [observation -model](https://nemos.readthedocs.io/en/latest/reference/nemos/observation_models/) and a [regularizer](https://nemos.readthedocs.io/en/latest/reference/nemos/regularizer/). +For a deeper dive, see our [Quickstart](https://nemos.readthedocs.io/en/latest/quickstart.html) guide and consider using [pynapple](https://github.com/pynapple-org/pynapple) for data exploration and preprocessing. When initializing the GLM object, you may optionally specify an [observation +model](https://nemos.readthedocs.io/en/latest/api_reference.html#the-nemos-observation-models-module) and a [regularizer](https://nemos.readthedocs.io/en/latest/api_reference.html#the-nemos-regularizer-module). > **Note: Multi-epoch Convolution** > @@ -149,7 +149,7 @@ Run the following `pip` command in your virtual environment. python -m pip install nemos ``` -For more details, including specifics for GPU users and developers, refer to NeMoS [docs](https://nemos.readthedocs.io/en/latest/installation/). +For more details, including specifics for GPU users and developers, refer to NeMoS [docs](https://nemos.readthedocs.io/en/latest/installation.html). ## Disclaimer diff --git a/bash_scripts/check_markdown_links.sh b/bash_scripts/check_markdown_links.sh new file mode 100755 index 00000000..9830a303 --- /dev/null +++ b/bash_scripts/check_markdown_links.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Fail script if any command fails +set -e + +# Find markdown-link-check path +MARKDOWN_LINK_CHECK=$(which markdown-link-check || echo "") + +# If markdown-link-check is not found, print an error and exit +if [[ -z "$MARKDOWN_LINK_CHECK" ]]; then + echo "❌ ERROR: markdown-link-check command not found. Make sure it is installed globally." + exit 1 +fi + +echo "🔍 Checking Markdown links in root directory..." + +# Initialize an error flag +ERROR=0 +LOG_FILE=$(mktemp) # Temporary file to store output + +# Find all Markdown files in the root directory and check links +for file in $(find .. -maxdepth 1 -name "*.md"); do + echo "📂 Checking $file..." + + # Run markdown-link-check and capture output + $MARKDOWN_LINK_CHECK "$file" 2>&1 | tee -a "$LOG_FILE" +done + +# Check if "ERROR:" appears in the log file +if grep -q "ERROR:" "$LOG_FILE"; then + echo "🚨 Link check failed! Please fix broken links." + exit 1 +else + echo "✅ All links are valid." +fi From 6d9a72e9217b48cd9ecdfc64c07c8299e81a3373 Mon Sep 17 00:00:00 2001 From: BalzaniEdoardo Date: Tue, 4 Feb 2025 17:53:54 -0500 Subject: [PATCH 14/14] fix relative path in bash script --- bash_scripts/check_markdown_links.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bash_scripts/check_markdown_links.sh b/bash_scripts/check_markdown_links.sh index 9830a303..529d36fe 100755 --- a/bash_scripts/check_markdown_links.sh +++ b/bash_scripts/check_markdown_links.sh @@ -19,7 +19,7 @@ ERROR=0 LOG_FILE=$(mktemp) # Temporary file to store output # Find all Markdown files in the root directory and check links -for file in $(find .. -maxdepth 1 -name "*.md"); do +for file in $(find . -maxdepth 1 -name "*.md"); do echo "📂 Checking $file..." # Run markdown-link-check and capture output