Skip to content

Commit 99d6d1e

Browse files
authored
Replace black with ruff format (#177)
See https://docs.astral.sh/ruff/formatter/ --------- Signed-off-by: Mattt Zmuda <mattt@replicate.com>
1 parent cc1c767 commit 99d6d1e

File tree

8 files changed

+15
-23
lines changed

8 files changed

+15
-23
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ jobs:
3737
run: |
3838
python -m mypy replicate
3939
python -m ruff .
40-
python -m black --check .
40+
python -m ruff format --check .
4141
- name: Test
4242
run: python -m pytest

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"recommendations": [
33
"charliermarsh.ruff",
4-
"ms-python.black-formatter",
54
"ms-python.python",
65
"ms-python.vscode-pylance",
76
"ms-python.mypy-type-checker"

.vscode/settings.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
"files.insertFinalNewline": true,
88
"files.trimFinalNewlines": true,
99
"[python]": {
10-
"editor.defaultFormatter": "ms-python.black-formatter",
10+
"editor.defaultFormatter": "charliermarsh.ruff",
1111
"editor.formatOnSave": true,
1212
"editor.codeActionsOnSave": {
1313
"source.fixAll": true,
1414
"source.organizeImports": true
15-
},
15+
}
1616
},
1717
"python.languageServer": "Pylance",
1818
"python.testing.pytestArgs": [
@@ -25,7 +25,10 @@
2525
"--show-column-numbers",
2626
"--no-pretty"
2727
],
28-
"ruff.args": [
28+
"ruff.lint.args": [
29+
"--config=pyproject.toml"
30+
],
31+
"ruff.format.args": [
2932
"--config=pyproject.toml"
3033
],
3134
}

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ authors = [{ name = "Replicate, Inc." }]
1212
requires-python = ">=3.8"
1313
dependencies = ["packaging", "pydantic>1", "httpx>=0.21.0,<1"]
1414
optional-dependencies = { dev = [
15-
"black",
1615
"mypy",
1716
"pytest",
1817
"pytest-asyncio",
1918
"pytest-recording",
2019
"respx",
21-
"ruff",
20+
"ruff>=0.1.3",
2221
] }
2322

2423
[project.urls]
@@ -56,6 +55,7 @@ ignore = [
5655
"ANN003", # Missing type annotation for `**kwargs`
5756
"ANN101", # Missing type annotation for self in method
5857
"ANN102", # Missing type annotation for cls in classmethod
58+
"W191", # Indentation contains tabs
5959
]
6060

6161
[tool.ruff.per-file-ignores]

replicate/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def trainings(self) -> TrainingCollection:
9898
def deployments(self) -> DeploymentCollection:
9999
return DeploymentCollection(client=self)
100100

101-
def run(self, model_version: str, **kwargs) -> Union[Any, Iterator[Any]]:
101+
def run(self, model_version: str, **kwargs) -> Union[Any, Iterator[Any]]: # noqa: ANN401
102102
"""
103103
Run a model and wait for its output.
104104

replicate/json.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313

1414
def encode_json(
15-
obj: Any, upload_file: Callable[[io.IOBase], str] # noqa: ANN401
15+
obj: Any, # noqa: ANN401
16+
upload_file: Callable[[io.IOBase], str],
1617
) -> Any: # noqa: ANN401
1718
"""
1819
Return a JSON-compatible version of the object.

replicate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Version(BaseModel):
3030
openapi_schema: dict
3131
"""An OpenAPI description of the model inputs and outputs."""
3232

33-
def predict(self, **kwargs) -> Union[Any, Iterator[Any]]:
33+
def predict(self, **kwargs) -> Union[Any, Iterator[Any]]: # noqa: ANN401
3434
"""
3535
DEPRECATED: Use `replicate.run()` instead.
3636

requirements-dev.txt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@ annotated-types==0.5.0
88
# via pydantic
99
anyio==3.7.1
1010
# via httpcore
11-
black==23.7.0
12-
# via replicate (pyproject.toml)
1311
certifi==2023.7.22
1412
# via
1513
# httpcore
1614
# httpx
17-
click==8.1.6
18-
# via black
1915
h11==0.14.0
2016
# via httpcore
2117
httpcore==0.17.3
@@ -36,18 +32,11 @@ multidict==6.0.4
3632
mypy==1.4.1
3733
# via replicate (pyproject.toml)
3834
mypy-extensions==1.0.0
39-
# via
40-
# black
41-
# mypy
35+
# via mypy
4236
packaging==23.1
4337
# via
44-
# black
4538
# pytest
4639
# replicate (pyproject.toml)
47-
pathspec==0.11.1
48-
# via black
49-
platformdirs==3.9.1
50-
# via black
5140
pluggy==1.2.0
5241
# via pytest
5342
pydantic==2.0.3
@@ -67,7 +56,7 @@ pyyaml==6.0.1
6756
# via vcrpy
6857
respx==0.20.2
6958
# via replicate (pyproject.toml)
70-
ruff==0.0.278
59+
ruff==0.1.3
7160
# via replicate (pyproject.toml)
7261
sniffio==1.3.0
7362
# via

0 commit comments

Comments
 (0)