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 nbqa to pre-commit #141

Closed
adamgayoso opened this issue Jan 13, 2023 · 3 comments
Closed

Add nbqa to pre-commit #141

adamgayoso opened this issue Jan 13, 2023 · 3 comments
Assignees

Comments

@adamgayoso
Copy link
Member

adamgayoso commented Jan 13, 2023

Something like this works:

  - repo: https://github.com/nbQA-dev/nbQA
    rev: 1.6.1
    hooks:
      - id: nbqa-pyupgrade
        args: [--py38-plus]
      - id: nbqa-black
      - id: nbqa-isort
      - id: nbqa-ruff
        args: [--fix]
      - id: nbqa
        entry: nbqa blacken-docs
        name: nbqa-blacken-docs
        alias: nbqa-blacken-docs
        additional_dependencies: [blacken-docs]
        args: [--nbqa-md]
      - id: nbqa
        entry: nbqa mdformat
        name: nbqa-mdformat
        alias: nbqa-mdformat
        additional_dependencies:
          [
            mdformat,
            mdformat-black,
            mdformat-frontmatter,
            mdformat-web,
            mdformat-myst,
          ]
        args: [--nbqa-md]

This would also be a good to do when switching to ruff as it will read configs in the toml

@grst grst mentioned this issue Feb 22, 2023
7 tasks
@adamgayoso
Copy link
Member Author

So with ruff we can drop isort here. I found mdformat to be helpful

@flying-sheep
Copy link
Member

pyupgrade too. so:

  - repo: https://github.com/nbQA-dev/nbQA
    rev: 1.6.1
    hooks:
      - id: nbqa-black
      - id: nbqa-ruff
        args: [--fix]
      - id: nbqa
        entry: nbqa blacken-docs
        name: nbqa-blacken-docs
        alias: nbqa-blacken-docs
        additional_dependencies: [blacken-docs]
        args: [--nbqa-md]
      - id: nbqa
        entry: nbqa mdformat
        name: nbqa-mdformat
        alias: nbqa-mdformat
        additional_dependencies:
          - mdformat
          - mdformat-black
          - mdformat-frontmatter
          - mdformat-web
          - mdformat-myst
        args: [--nbqa-md]

@grst
Copy link
Collaborator

grst commented Nov 28, 2023

superseded by #237

@grst grst closed this as completed Nov 28, 2023
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

No branches or pull requests

3 participants