Skip to content

Conversation

@emmaai
Copy link
Contributor

@emmaai emmaai commented Mar 3, 2025

Proposed changes

Add pre-commit hook to check duplicate notebooks before commit, both locally and remotely. Aiming to save human from sanity-checking as much as possible.

Closes issues (optional)

N/A
If there are duplicates, the output should be

ubuntu@ip-10-0-13-183:~/work/dea-notebooks$ git commit -a -m "add test"
Check for duplicate .ipynb filenames.....................................Failed
- hook id: check-duplicate-ipynb
- exit code: 1

Checking for duplicate .ipynb filenames...
Duplicate .ipynb filenames detected in repository and staged changes:
test1.ipynb
Commit rejected! Ensure unique .ipynb filenames.

Checklist

If this is a notebook, then have you:

  • Checked the structure of the notebook follows our DEA-notebooks template
  • Removed any unused Python packages from Load packages
  • Removed any unused/empty code cells
  • Removed any guidance cells (e.g. General advice)
  • Ensured that all code cells follow the PEP8 standard for code. The jupyterlab_code_formatter tool can be used to format code cells to a consistent style: select each code cell, then click Edit and then one of the Apply X Formatter options (YAPF or Black are recommended).
  • Included relevant tags in the final notebook cell (refer to the DEA Tags Index, and re-use tags if possible)
  • Tested notebook on the DEA Sandbox
  • Cleared all outputs, run notebook from start to finish, and save the notebook in the state where all cells have been sequentially evaluated
  • If applicable, update the Notebook currently compatible with line below the notebook title to reflect the environments the notebook is compatible with
  • Check for any spelling mistakes using the DEA Sandbox's built-in spellchecker (double click on markdown cells then right-click on pink highlighted words). For example:

sandbox_spellchecker

@robbibt robbibt merged commit 9730554 into develop Mar 3, 2025
1 check passed
@robbibt robbibt deleted the add_pre_push_hook branch March 3, 2025 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants