Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add black-jupyter and nbstripout to pre-commit #1915

Merged
merged 1 commit into from
Feb 19, 2024
Merged

Add black-jupyter and nbstripout to pre-commit #1915

merged 1 commit into from
Feb 19, 2024

Conversation

giswqs
Copy link
Member

@giswqs giswqs commented Feb 19, 2024

This PR adds black-jupyter and nbstripout to pre-commit: format notebook using black and remove cell outputs from notebook. This can help clean up notebook changes from future PRs. This PR results in a large amount of file changes, but this will be a one-time only process and will standardize notebook formatting going forward.

    - repo: https://github.com/psf/black
      rev: 24.2.0
      hooks:
          - id: black-jupyter
            language_version: python3.11

    - repo: https://github.com/kynan/nbstripout
      rev: 0.7.1
      hooks:
          - id: nbstripout

Copy link

@github-actions github-actions bot temporarily deployed to pull request February 19, 2024 15:33 Inactive
@giswqs
Copy link
Member Author

giswqs commented Feb 19, 2024

Using the black formatter for now. We should consider switching to Ruff in the future, which is 10-100x faster than existing linters (like Flake8) and formatters (like Black).

https://github.com/astral-sh/ruff-pre-commit

- repo: https://github.com/astral-sh/ruff-pre-commit
  # Ruff version.
  rev: v0.2.2
  hooks:
    # Run the linter.
    - id: ruff
      types_or: [ python, pyi, jupyter ]
      args: [ --fix ]
    # Run the formatter.
    - id: ruff-format
      types_or: [ python, pyi, jupyter ]

@giswqs giswqs merged commit 9022985 into master Feb 19, 2024
15 checks passed
@giswqs giswqs deleted the black branch February 19, 2024 15:54
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.

None yet

1 participant