Skip to content

Add pre-commit and migrate to Ruff - #478

Open
savannahostrowski wants to merge 4 commits into
python:mainfrom
savannahostrowski:ruff-and-precommit
Open

savannahostrowski wants to merge 4 commits into
python:mainfrom
savannahostrowski:ruff-and-precommit

Conversation

@savannahostrowski

Copy link
Copy Markdown
Member

I figured we could start aligning with the conventions we have in CPython: replacing black + flake8 with ruff, and adding pre-commit to streamline things and catch lint failures before they hit CI.

I haven't bumped line length to 79 here (would be a fairly mechanical 30-ish file reformat) but happy to do that if we think it's worthwhile. Also haven't touched the typechecker but would be interested in opinions on whether we should migrate from pyright to mypy.

Comment thread .pre-commit-config.yaml
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: e05c5c0818279e5ac248ac9e954431ba58865e61 # frozen: v0.15.7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread .github/workflows/ci.yml
run: python -m pip install .[test]
- name: Run lints
run: ./lint.sh
run: python -m pip install ".[test]"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyperf does this in a separate job:

https://github.com/psf/pyperf/blob/main/.github/workflows/lint.yml#L5

What do you think about this approach?

This branch has not been deployed

No deployments
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.

2 participants