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 #177

Merged
merged 7 commits into from
Oct 29, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ jobs:
run: |
python -m mypy replicate
python -m ruff .
python -m black --check .
python -m ruff format --check .
- name: Test
run: python -m pytest
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"recommendations": [
"charliermarsh.ruff",
"ms-python.black-formatter",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.mypy-type-checker"
Expand Down
9 changes: 6 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
},
}
},
"python.languageServer": "Pylance",
"python.testing.pytestArgs": [
Expand All @@ -25,7 +25,10 @@
"--show-column-numbers",
"--no-pretty"
],
"ruff.args": [
"ruff.lint.args": [
"--config=pyproject.toml"
],
"ruff.format.args": [
"--config=pyproject.toml"
],
}
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ authors = [{ name = "Replicate, Inc." }]
requires-python = ">=3.8"
dependencies = ["packaging", "pydantic>1", "httpx>=0.21.0,<1"]
optional-dependencies = { dev = [
"black",
"mypy",
"pytest",
"pytest-asyncio",
"pytest-recording",
"respx",
"ruff",
"ruff>=0.1.3",
] }

[project.urls]
Expand Down Expand Up @@ -56,6 +55,7 @@ ignore = [
"ANN003", # Missing type annotation for `**kwargs`
"ANN101", # Missing type annotation for self in method
"ANN102", # Missing type annotation for cls in classmethod
"W191", # Indentation contains tabs
]

[tool.ruff.per-file-ignores]
Expand Down
2 changes: 1 addition & 1 deletion replicate/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def trainings(self) -> TrainingCollection:
def deployments(self) -> DeploymentCollection:
return DeploymentCollection(client=self)

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

Expand Down
3 changes: 2 additions & 1 deletion replicate/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@


def encode_json(
obj: Any, upload_file: Callable[[io.IOBase], str] # noqa: ANN401
obj: Any, # noqa: ANN401
upload_file: Callable[[io.IOBase], str],
) -> Any: # noqa: ANN401
"""
Return a JSON-compatible version of the object.
Expand Down
2 changes: 1 addition & 1 deletion replicate/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Version(BaseModel):
openapi_schema: dict
"""An OpenAPI description of the model inputs and outputs."""

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

Expand Down
15 changes: 2 additions & 13 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@ annotated-types==0.5.0
# via pydantic
anyio==3.7.1
# via httpcore
black==23.7.0
# via replicate (pyproject.toml)
certifi==2023.7.22
# via
# httpcore
# httpx
click==8.1.6
# via black
h11==0.14.0
# via httpcore
httpcore==0.17.3
Expand All @@ -36,18 +32,11 @@ multidict==6.0.4
mypy==1.4.1
# via replicate (pyproject.toml)
mypy-extensions==1.0.0
# via
# black
# mypy
# via mypy
packaging==23.1
# via
# black
# pytest
# replicate (pyproject.toml)
pathspec==0.11.1
# via black
platformdirs==3.9.1
# via black
pluggy==1.2.0
# via pytest
pydantic==2.0.3
Expand All @@ -67,7 +56,7 @@ pyyaml==6.0.1
# via vcrpy
respx==0.20.2
# via replicate (pyproject.toml)
ruff==0.0.278
ruff==0.1.3
# via replicate (pyproject.toml)
sniffio==1.3.0
# via
Expand Down