Skip to content

Commit 7cc7964

Browse files
authored
Merge pull request #7 from workflowai/guillaume/fix-types-enable-ruff
Fix types enable ruff
2 parents bb66ad2 + 5c672af commit 7cc7964

33 files changed

+191
-131
lines changed

.github/workflows/publish.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ jobs:
2121
run: |
2222
poetry config virtualenvs.in-project true
2323
poetry install --all-extras
24+
25+
- name: Check package version matches tag
26+
run: |
27+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
28+
PACKAGE_VERSION=$(poetry version -s)
29+
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
30+
echo "Error: Tag version ($TAG_VERSION) does not match package version ($PACKAGE_VERSION)"
31+
exit 1
32+
fi
2433
2534
- name: Build Python package
2635
run: poetry build

examples/__init__.py

Whitespace-only changes.

examples/city_to_capital_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class CityToCapitalTaskInput(BaseModel):
1212

1313
class CityToCapitalTaskOutput(BaseModel):
1414
capital: str = Field(
15-
description="The capital of the specified city", examples=["Tokyo"]
15+
description="The capital of the specified city", examples=["Tokyo"],
1616
)
1717

1818

examples/run_task.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
from examples.city_to_capital_task import CityToCapitalTask, CityToCapitalTaskInput
88

99

10-
def main(city: str):
10+
def main(city: str) -> None:
1111
client = workflowai.start()
1212
task = CityToCapitalTask()
1313

14-
async def _inner():
14+
async def _inner() -> None:
1515
task_input = CityToCapitalTaskInput(city=city)
1616
task_run = await client.run(task, task_input)
1717

poetry.lock

Lines changed: 20 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "workflowai"
3-
version = "0.1.3"
3+
version = "0.2.0"
44
description = ""
55
authors = ["Guillaume Aquilina <guillaume@workflowai.com>"]
66
readme = "README.md"
@@ -14,10 +14,10 @@ typer = { version = "^0.12.3", optional = true }
1414
rich = { version = "^13.7.1", optional = true }
1515

1616
[tool.poetry.group.dev.dependencies]
17-
pyright = "^1.1.367"
17+
pyright = "^1.1.381"
1818
pytest = "^8.2.2"
1919
pytest-asyncio = "^0.23.7"
20-
ruff = "^0.4.9"
20+
ruff = "^0.5.0"
2121
freezegun = "^1.5.1"
2222
pre-commit = "^3.7.1"
2323
pytest-httpx = "^0.30.0"
@@ -29,13 +29,30 @@ cli = ["typer", "rich"]
2929
[tool.poetry.scripts]
3030
workflowai = "workflowai.cli.main:main"
3131

32+
[tool.ruff]
33+
line-length = 120
34+
3235
[tool.ruff.lint]
33-
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
34-
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
35-
# McCabe complexity (`C901`) by default.
36-
# TODO: enable C901 and other rules about documentation
37-
select = ["E4", "E7", "E9", "F", "T201", "TID251"]
38-
ignore = []
36+
select = ["ALL"]
37+
38+
ignore = [
39+
"D",
40+
"PLC",
41+
"FA",
42+
"TRY",
43+
"ANN",
44+
"RET504",
45+
"TCH",
46+
"PTH",
47+
"PLR",
48+
"EM101",
49+
"EM102",
50+
"FBT001",
51+
"FBT002",
52+
"TD",
53+
"PYI051",
54+
"FIX002",
55+
]
3956

4057
# Allow fix for all enabled rules (when `--fix`) is provided.
4158
fixable = ["ALL"]
@@ -44,6 +61,7 @@ unfixable = []
4461
[tool.ruff.lint.per-file-ignores]
4562
# in bin we use rich.print
4663
"bin/*" = ["T201"]
64+
"*_test.py" = ["S101"]
4765

4866
[tool.pyright]
4967
pythonVersion = "3.9"

tests/__init__.py

Whitespace-only changes.

tests/e2e/__init__.py

Whitespace-only changes.

tests/e2e/deploy_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ async def test_deploy_task(wai: workflowai.Client):
2828

2929
# Run using the environment and the same input
3030
task_run2 = await wai.run(
31-
task, task_input=CityToCapitalTaskInput(city="Osaka"), environment="dev"
31+
task, task_input=CityToCapitalTaskInput(city="Osaka"), environment="dev",
3232
)
3333
# IDs will match since we are using cache
3434
assert task_run.id == task_run2.id
3535

3636
# Run using the environment and a different input
3737
task_run3 = await wai.run(
38-
task, task_input=CityToCapitalTaskInput(city="Toulouse"), environment="dev"
38+
task, task_input=CityToCapitalTaskInput(city="Toulouse"), environment="dev",
3939
)
4040
assert task_run3.task_output.capital == "Paris"
4141
assert task_run3.id != task_run2.id

tests/models/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)