Skip to content

Commit

Permalink
replace black with ruff in precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
lkeegan committed Jul 15, 2024
1 parent b9f45b8 commit 806ec04
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
16 changes: 9 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
repos:
# Run Black - the uncompromising Python code formatter
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black-jupyter

# Add some general purpose useful hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
Expand All @@ -20,6 +14,15 @@ repos:
# Unify file endings
- id: end-of-file-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix]
- id: ruff-format
types_or: [python, pyi, jupyter]

# Make sure that Jupyter notebooks under version control
# have their outputs stripped before committing
- repo: https://github.com/kynan/nbstripout
Expand All @@ -36,6 +39,5 @@ repos:
args:
[
--ignore-missing-imports,
--disallow-untyped-defs,
--warn-redundant-casts,
]
15 changes: 13 additions & 2 deletions notebooks/prototyping.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"cell_type": "markdown",
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"It is very easy to go from doing this to creating and running a pytest test instead."
]
Expand Down Expand Up @@ -82,7 +81,7 @@
"id": "8",
"metadata": {},
"source": [
"Then in any cell where we define a pytest test (i.e. any function whose name begins with test that contains assertions), we can add the magic `%%ipytest` to execute it using pytest:"
"Then in any cell where we define a pytest test (i.e. any function whose name begins with `test` that contains assertions), we can add the magic `%%ipytest` to execute it using pytest:"
]
},
{
Expand Down Expand Up @@ -135,6 +134,18 @@
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_board_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def sample_valid_n_x_y(draw: st.DrawFn) -> tuple[int, int, int]:

@given(n_x_y=sample_valid_n_x_y())
def test_property_empty_board_is_empty_with_composite(
n_x_y: tuple[int, int, int]
n_x_y: tuple[int, int, int],
) -> None:
# no assume required here as all the x,y we generate are < n
n, x, y = n_x_y
Expand Down

0 comments on commit 806ec04

Please sign in to comment.