Skip to content

Commit

Permalink
Add ruff, remove old 3.7 compat code
Browse files Browse the repository at this point in the history
  • Loading branch information
ojii committed Oct 3, 2023
1 parent 9677ebc commit 860862b
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 17 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,20 @@ jobs:
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: poetry install --extras aiohttp --extras httpx
- run: poetry run black --check src/ tests/

ruff:
timeout-minutes: 10
needs: lock
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/cache@v3
with:
path: poetry.lock
key: ${{ github.sha }}-3.11
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: poetry install --extras aiohttp --extras httpx
- run: poetry run ruff check src/ tests/
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ repos:
language: system
types: [python]
pass_filenames: false
- id: ruff
name: ruff
entry: poetry run ruff
language: system
types: [python]
pass_filenames: false
args: ['check', 'src', 'tests']

10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ isort = "^5.8.0"
types-freezegun = "^1.1.6"
urllib3 = "< 1.27"
furo = "^2023.9.10"
ruff = "^0.0.292"

[tool.pytest.ini_options]
asyncio_mode = "auto"
Expand All @@ -64,6 +65,15 @@ files = [
"tests/",
]

[tool.ruff]
ignore = [
"E722", # Do not use bare `except`
"E501", # Line too long (104 > 88 characters)
]
select = [
"E", "F", "T201",
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
9 changes: 0 additions & 9 deletions src/aiodynamo/_compat.py

This file was deleted.

4 changes: 1 addition & 3 deletions src/aiodynamo/http/types.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from dataclasses import dataclass
from typing import Awaitable, Callable, Dict, Optional, Union

from aiodynamo._compat import Literal
from typing import Awaitable, Callable, Dict, Literal, Optional, Union


@dataclass(frozen=True)
Expand Down
4 changes: 1 addition & 3 deletions src/aiodynamo/types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import decimal
from enum import Enum
from typing import Any, Callable, Dict, List, Union

from ._compat import TypedDict
from typing import Any, Callable, Dict, List, TypedDict, Union

Timeout = Union[float, int]
Numeric = Union[float, int, decimal.Decimal]
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def supports_transactions(client: Client, table: TableName) -> None:
[ConditionCheck(table, {"h": "h", "r": "r"}, F("h").does_not_exist())]
)
except UnknownOperation:
raise pytest.skip(f"Transactions not supported")
raise pytest.skip("Transactions not supported")


@pytest.fixture(scope="session")
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ async def test_transact_write_items_update(client: Client, table: TableName) ->
Update(
table=table,
key={"h": "h", "r": "1"},
expression=F("s").set(f"changed"),
expression=F("s").set("changed"),
)
]
await client.transact_write_items(items=updates)
Expand Down

0 comments on commit 860862b

Please sign in to comment.