Skip to content

Commit

Permalink
Sync deploy-to-aws with main (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
tibdex committed Jan 5, 2024
2 parents efab097 + 8614451 commit ddb82ef
Show file tree
Hide file tree
Showing 11 changed files with 534 additions and 613 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ description: Set up Python, install Poetry and the dependencies
runs:
using: "composite"
steps:
- run: pipx install poetry==1.5.1
- run: pipx install poetry==1.7.0
shell: bash
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
cache: poetry
python-version: "3.9"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: poetry run app format --check
- run: poetry run app lint --check
Expand Down
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",
"tamasfe.even-better-toml"
],
Expand Down
16 changes: 6 additions & 10 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
{
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnType": true
},
"black-formatter.importStrategy": "fromEnvironment",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"python.analysis.autoImportCompletions": true,
"python.formatting.provider": "black",
"python.languageServer": "Pylance",
"python.linting.mypyCategorySeverity.note": "Error",
"python.linting.mypyEnabled": true,
"python.testing.pytestArgs": [
"--capture=no", "--verbose"
"--capture=no",
"--verbose"
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"ruff.importStrategy": "fromEnvironment"
"python.testing.unittestEnabled": false
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.2
FROM python:3.9.12-slim AS builder

RUN --mount=type=cache,target=/root/.cache pip install poetry==1.3.1
RUN --mount=type=cache,target=/root/.cache pip install poetry==1.7.0
RUN poetry config virtualenvs.create false

COPY poetry.lock pyproject.toml ./
Expand Down
3 changes: 2 additions & 1 deletion app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from types import TracebackType

import atoti as tt
from typing_extensions import Self

from .config import Config
from .load_tables import load_tables
Expand Down Expand Up @@ -34,7 +35,7 @@ def close(self) -> None:
self._stop_refreshing_data()
self.session.close()

def __enter__(self) -> App:
def __enter__(self) -> Self:
return self

def __exit__(
Expand Down
2 changes: 1 addition & 1 deletion app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Config(BaseSettings):
velib_data_base_path: Union[HttpUrl, DirectoryPath] = TypeAdapter(
HttpUrl
).validate_python(
"https://velib-metropole-opendata.smoove.pro/opendata/Velib_Metropole"
"https://velib-metropole-opendata.smovengo.cloud/opendata/Velib_Metropole"
)

@field_validator("user_content_storage")
Expand Down
12 changes: 7 additions & 5 deletions app/util/reverse_geocode.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from collections.abc import Iterable, Mapping, Set
from collections.abc import Iterable, Mapping, Set as AbstractSet
from datetime import timedelta
from functools import wraps
from io import StringIO
Expand Down Expand Up @@ -31,14 +31,16 @@


def _cache(
function: Callable[Concatenate[Set[_Coordinates], _P], _ReverseGeocodedCoordinates],
function: Callable[
Concatenate[AbstractSet[_Coordinates], _P], _ReverseGeocodedCoordinates
],
/,
) -> Callable[Concatenate[Set[_Coordinates], _P], _ReverseGeocodedCoordinates]:
) -> Callable[Concatenate[AbstractSet[_Coordinates], _P], _ReverseGeocodedCoordinates]:
cache: _ReverseGeocodedCoordinates = {}

@wraps(function)
def function_wrapper(
coordinates: Set[_Coordinates],
coordinates: AbstractSet[_Coordinates],
/,
*args: _P.args,
**kwargs: _P.kwargs,
Expand All @@ -53,7 +55,7 @@ def function_wrapper(

@_cache
def _reverse_geocode(
coordinates: Set[_Coordinates],
coordinates: AbstractSet[_Coordinates],
/,
*,
reverse_geocoding_path: HttpUrl | Path,
Expand Down
4 changes: 3 additions & 1 deletion cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def build_docker(tag: str) -> None:

@app.command(help="Format the project files.")
def format(*, check: _CheckOption = False) -> None: # noqa: A001
run_command(["black", *(["--check"] if check else []), "."], run_with_poetry=True)
run_command(
["ruff", "format", *(["--check"] if check else []), "."], run_with_poetry=True
)


@app.command(help="Lint the project files.")
Expand Down
Loading

0 comments on commit ddb82ef

Please sign in to comment.