Skip to content

Commit

Permalink
reemplaza black por ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
albertotb committed Dec 7, 2023
1 parent abf15ba commit fa2bd3c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ repos:
rev: v0.1.0
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix, --show-fixes, --exit-non-zero-on-fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ lint.select = [
"B", # flake8-bugbear
"SIM", # flake8-simplify
"I", # isort
"D", # pydocstyle
"C401", # flake8-comprehensions: unnecessary-generator-set
"C402", # flake8-comprehensions: unnecessary-generator-dict
"C403", # flake8-comprehensions: unnecessary-list-comprehension-set
Expand All @@ -50,6 +51,16 @@ lint.select = [
"W605", # pycodestyle: invalid-escape-sequence
]

# Ignore D100 Missing docstring in public module
ignore = ["D100"]
[tool.ruff.per-file-ignores]
# Also ignore `D104` in all `__init__.py` files.
"__init__.py" = ["D104"]
"tests/*.py" = ["D"]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.pytest.ini_options]
minversion = "7"
testpaths = ["tests"]
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip-tools
pytest
black
ruff
mypy
pre-commit
16 changes: 4 additions & 12 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ anyio==3.7.1
# -c requirements.txt
# fastapi
# starlette
black==23.10.0
# via template (pyproject.toml)
build==1.0.3
# via pip-tools
cfgv==3.4.0
# via pre-commit
click==8.1.7
# via
# -c requirements.txt
# black
# pip-tools
# typer
# uvicorn
Expand All @@ -49,9 +46,7 @@ iniconfig==2.0.0
mypy==1.6.1
# via template (pyproject.toml)
mypy-extensions==1.0.0
# via
# black
# mypy
# via mypy
nodeenv==1.8.0
# via pre-commit
numpy==1.26.1
Expand All @@ -61,21 +56,16 @@ numpy==1.26.1
# template (pyproject.toml)
packaging==23.2
# via
# black
# build
# pytest
pandas==2.1.1
# via
# -c requirements.txt
# template (pyproject.toml)
pathspec==0.11.2
# via black
pip-tools==7.3.0
# via template (pyproject.toml)
platformdirs==3.11.0
# via
# black
# virtualenv
# via virtualenv
pluggy==1.3.0
# via pytest
pre-commit==3.5.0
Expand All @@ -102,6 +92,8 @@ pytz==2023.3.post1
# pandas
pyyaml==6.0.1
# via pre-commit
ruff==0.1.7
# via template (pyproject.toml)
six==1.16.0
# via
# -c requirements.txt
Expand Down
1 change: 1 addition & 0 deletions template/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

@app.get("/")
def read_root() -> dict[str, str]:
"""Check API version."""
return {"template-api": f"version {__version__}"}


Expand Down
1 change: 1 addition & 0 deletions template/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


def print_version() -> None:
"""Print package version."""
print(f"Template version {__version__}")


Expand Down
1 change: 0 additions & 1 deletion tests/test_trivial.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ def test_print_version():

@pytest.mark.optional
def test_optional():
"""Remove me when instantiating this template for another repo"""
assert 2 + 2 == 4

0 comments on commit fa2bd3c

Please sign in to comment.