Skip to content

Commit

Permalink
build: Replace black with ruff format
Browse files Browse the repository at this point in the history
And also run it.
  • Loading branch information
alexpovel committed Mar 11, 2024
1 parent 1f1b466 commit 63396b9
Show file tree
Hide file tree
Showing 7 changed files with 995 additions and 995 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Generally, even when running in a `devbox shell`, `poetry run` is necessary:
- devbox sets up what used to be system-wide packages (Python, poetry, ...) deterministically and automatically
- within the devbox virtual environment, we still manage and use a Python virtual environment through `poetry run`

That way, we get the normal Python package management for normal Python packages (`ruff`, `black`, `pytest`, ...), and devbox for the overarching rest.
That way, we get the normal Python package management for normal Python packages (`ruff`, `pytest`, ...), and devbox for the overarching rest.

Lastly, for bonus points, set up pre-commit hooks:

Expand Down
6 changes: 3 additions & 3 deletions ancv/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def render(
path: Path = typer.Argument(
Path("resume.json"),
help="File path to the JSON resume file.",
)
),
) -> None:
"""Locally renders the JSON resume at the given file path."""

Expand All @@ -90,7 +90,7 @@ def validate(
path: Path = typer.Argument(
Path("resume.json"),
help="File path to the JSON resume file.",
)
),
) -> None:
"""Checks the validity of the given JSON resume without rendering."""

Expand Down Expand Up @@ -225,7 +225,7 @@ def generate_schema() -> None:
def main(
verbose: bool = typer.Option(
False, "--verbose", "-v", help="Turn on verbose logging output."
)
),
) -> None:
"""CLI-wide, global options.
Expand Down
30 changes: 15 additions & 15 deletions ancv/data/models/resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ class WorkItem(BaseModel):
model_config = ConfigDict(extra="allow")

name: t.Annotated[t.Optional[str], Field(description="e.g. Facebook")] = None
location: t.Annotated[
t.Optional[str], Field(description="e.g. Menlo Park, CA")
] = None
location: t.Annotated[t.Optional[str], Field(description="e.g. Menlo Park, CA")] = (
None
)
description: t.Annotated[
t.Optional[str], Field(description="e.g. Social Media Company")
] = None
Expand Down Expand Up @@ -263,9 +263,9 @@ class VolunteerItem(BaseModel):

model_config = ConfigDict(extra="allow")

organization: t.Annotated[
t.Optional[str], Field(description="e.g. Facebook")
] = None
organization: t.Annotated[t.Optional[str], Field(description="e.g. Facebook")] = (
None
)
position: t.Annotated[
t.Optional[str], Field(description="e.g. Software Engineer")
] = None
Expand Down Expand Up @@ -323,9 +323,9 @@ class Award(BaseModel):
Field(description="e.g. One of the 100 greatest minds of the century"),
] = None
date: datetime.date | None = None
awarder: t.Annotated[
t.Optional[str], Field(description="e.g. Time Magazine")
] = None
awarder: t.Annotated[t.Optional[str], Field(description="e.g. Time Magazine")] = (
None
)
summary: t.Annotated[
t.Optional[str],
Field(description="e.g. Received for my work with Quantum Physics"),
Expand All @@ -340,9 +340,9 @@ class Publication(BaseModel):

model_config = ConfigDict(extra="allow")

name: t.Annotated[
t.Optional[str], Field(description="e.g. The World Wide Web")
] = None
name: t.Annotated[t.Optional[str], Field(description="e.g. The World Wide Web")] = (
None
)
publisher: t.Annotated[
t.Optional[str], Field(description="e.g. IEEE, Computer Magazine")
] = None
Expand All @@ -369,9 +369,9 @@ class Project(BaseModel):

model_config = ConfigDict(extra="allow")

name: t.Annotated[
t.Optional[str], Field(description="e.g. The World Wide Web")
] = None
name: t.Annotated[t.Optional[str], Field(description="e.g. The World Wide Web")] = (
None
)
description: t.Annotated[
t.Optional[str],
Field(description="Short summary of project. e.g. Collated works of 2017."),
Expand Down
3 changes: 1 addition & 2 deletions ancv/web/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ class Runnable(ABC):
"""A server object that can be `run`, enabling different server implementations."""

@abstractmethod
def run(self, context: ServerContext) -> None:
...
def run(self, context: ServerContext) -> None: ...


class APIHandler(Runnable):
Expand Down
2 changes: 1 addition & 1 deletion devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"scripts": {
"build-image": "docker build --progress=plain --tag \"$LIBRARY\"/\"$LIBRARY\":$(poetry version --short) .",
"format-check": "poetry run black --check --diff \"$LIBRARY\"",
"format-check": "poetry run ruff format --check --diff",
"install-hooks": "pre-commit install --hook-type pre-push --hook-type pre-commit --hook-type commit-msg",
"lint": "poetry run ruff --verbose .",
"make-depgraph.svg": "poetry run pydeps --max-bacon=4 --cluster -T svg -o depgraph.svg \"$LIBRARY\"",
Expand Down
Loading

0 comments on commit 63396b9

Please sign in to comment.