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

Replace black with ruff format #11

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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