Skip to content

Commit

Permalink
Replace black with ruff format (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
dantp-ai authored Aug 15, 2024
1 parent 1bd739b commit 37816fc
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 87 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"charliermarsh.ruff",
"ms-python.flake8",
"ms-python.mypy-type-checker"
],
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"python.formatting.provider": "black",
"python.formatting.provider": "ruff",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint-format-typecheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ jobs:
with:
imageName: ghcr.io/${{ secrets.GH_DOCKER_REGISTRY_NAMESPACE }}/devcontainer-ghactions-poetry
runCmd: |
poetry run black --check .
poetry run ruff check --fix
poetry run ruff format .
poetry run mypy src tests
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ repos:
pass_filenames: false
language: system
types: [python]
- id: black
name: black
entry: poetry run black
- id: ruff-check
name: ruff check
entry: poetry run ruff check --fix
language: system
types: [python]
- id: ruff
name: ruff
entry: poetry run ruff check --fix
- id: ruff-format
name: ruff format
entry: poetry run ruff format
language: system
types: [python]
types: [python]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This repository has a small yet instructive project that shows you how to create
Specifically, the project is a simple Python app whose dependencies are managed by [Poetry](https://python-poetry.org/).

* It contains some simple tests (for example purposes) that are run with pytest.
* It uses black, ruff, and mypy for linting, formatting, and type checking.
* It uses ruff for linting and formatting, and mypy for type checking.
* Finally, it has two Github actions workflows for:

1. linting, formatting, and type checking.
Expand Down
71 changes: 1 addition & 70 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ ml = ["scipy"]
visualization = ["matplotlib"]

[tool.poetry.group.dev.dependencies]
black = "^24.8.0"
mypy = "^1.11.1"
pre-commit = "^3.8.0"
pytest = "^8.3.2"
Expand All @@ -33,9 +32,6 @@ build-backend = "poetry.core.masonry.api"
warn_unused_configs = true
disallow_untyped_defs = true

[tool.black]
target-version = ["py311"]
line-length = 88

[tool.ruff]
target-version = "py311"
target-version = "py311"
line-length = 88

0 comments on commit 37816fc

Please sign in to comment.