Skip to content

Commit 7db8497

Browse files
authored
[GH-40] Update package versions and tooling (#41)
* [GH-40] chore: update package versions in pre-commit and pyproject * [GH-40] chore: update rest of packages * [GH-40] chore: lint * [GH-40] chore: update psycop * [GH-40] chore: update top level pacakges * [GH-40] chore: update lock file * [GH-40] chore: allow MacOS tests
1 parent ba3d0c7 commit 7db8497

File tree

10 files changed

+441
-362
lines changed

10 files changed

+441
-362
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
- name: Install poetry 📚
6565
run: pipx install poetry
6666

67-
- name: Set up Python 3.9 🐍
67+
- name: Set up Python ${{ env.PYTHON_VERSION }} 🐍
6868
uses: actions/setup-python@v4
6969
with:
7070
python-version: ${{ env.PYTHON_VERSION }}

.pre-commit-config.yaml

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@ default_language_version:
44

55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.3.0
7+
rev: v4.4.0
88
hooks:
9+
- id: check-added-large-files
910
- id: trailing-whitespace
1011
- id: end-of-file-fixer
1112
- id: check-yaml
1213
- id: debug-statements
13-
- id: requirements-txt-fixer
14+
# - id: pretty-format-json
1415
- repo: https://github.com/psf/black
15-
rev: 22.6.0
16+
rev: 23.10.1
1617
hooks:
1718
- id: black
1819
- repo: https://github.com/charliermarsh/ruff-pre-commit
19-
rev: 'v0.0.241'
20+
rev: 'v0.1.3'
2021
hooks:
2122
- id: ruff
2223
- repo: https://github.com/PyCQA/isort
2324
rev: 5.12.0
2425
hooks:
2526
- id: isort
2627
- repo: https://github.com/codespell-project/codespell
27-
rev: v2.2.2
28+
rev: v2.2.5
2829
hooks:
2930
- id: codespell

poetry.lock

+390-313
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ repository = "https://github.com/nickatnight/cookiecutter-fastapi-backend"
1212
python = "^3.9"
1313

1414
[tool.poetry.group.dev.dependencies]
15-
cookiecutter = "^2.1.1"
16-
pytest = "^7.2.1"
17-
pytest-cookies = "0.6.1"
18-
sh = "^2.0.2"
19-
binaryornot = "^0.4.4"
20-
pre-commit = "^3.0.4"
21-
pytest-instafail = "^0.4.2"
15+
cookiecutter = "2.4.0"
16+
pytest = "7.4.3"
17+
pytest-cookies = "0.7.0"
18+
sh = "2.0.6"
19+
binaryornot = "0.4.4"
20+
pre-commit = "3.5.0"
21+
pytest-instafail = "0.5.0"
2222

2323
[tool.ruff]
2424
line-length = 100

tests/test_bake_project.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
if sys.platform.startswith("win"):
1515
pytest.skip("sh doesn't support windows", allow_module_level=True)
16-
elif sys.platform.startswith("darwin") and os.getenv("CI"):
17-
# "CI" env var is provided by GHA runner
18-
pytest.skip("skipping slow macOS tests on CI", allow_module_level=True)
16+
# elif sys.platform.startswith("darwin") and os.getenv("CI"):
17+
# # "CI" env var is provided by GHA runner
18+
# pytest.skip("skipping slow macOS tests on CI", allow_module_level=True)
1919

2020
SUPPORTED_COMBINATIONS = [
2121
{"include_example_api": "no"},

{{ cookiecutter.project_slug }}/.pre-commit-config.yaml

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ default_language_version:
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
6-
rev: v4.3.0
6+
rev: v4.4.0
77
hooks:
8+
- id: check-added-large-files
89
- id: trailing-whitespace
910
- id: end-of-file-fixer
1011
- id: check-yaml
1112
- id: debug-statements
12-
- id: requirements-txt-fixer
13+
- id: pretty-format-json
1314
- repo: https://github.com/psf/black
14-
rev: 22.6.0
15+
rev: 23.10.1
1516
hooks:
1617
- id: black
1718
args: ["--config=./{{ cookiecutter.backend_container_name }}/pyproject.toml"]
1819
- repo: https://github.com/charliermarsh/ruff-pre-commit
19-
rev: 'v0.0.241'
20+
rev: 'v0.1.3'
2021
hooks:
2122
- id: ruff
2223
- repo: https://github.com/PyCQA/isort
@@ -25,11 +26,11 @@ repos:
2526
- id: isort
2627
args: ["--settings-path=./{{ cookiecutter.backend_container_name }}/pyproject.toml"]
2728
- repo: https://github.com/codespell-project/codespell
28-
rev: v2.2.2
29+
rev: v2.2.5
2930
hooks:
3031
- id: codespell
3132
# - repo: https://github.com/pre-commit/mirrors-mypy
32-
# rev: v0.982
33+
# rev: v1.6.1
3334
# hooks:
3435
# - id: mypy
3536
# args: ["--config-file=./{{ cookiecutter.backend_container_name }}/pyproject.toml"]

{{ cookiecutter.project_slug }}/{{ cookiecutter.backend_container_name }}/pyproject.toml

+21-21
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,29 @@ authors = ["nickatnight <[email protected]>"]
66

77
[tool.poetry.dependencies]
88
python = "~{{ cookiecutter.py_version }}"
9-
alembic = "^1.8.1"
10-
asyncpg = "^0.26.0"
11-
fastapi = "^0.92.0"
12-
psycopg2-binary = "^2.9.3"
13-
sqlmodel = "^0.0.8"
14-
uvicorn = {extras = ["standard"], version = "^0.20.0"}
15-
redis = "^4.5.1"
16-
fastapi-cache2 = {extras = ["redis"], version = "^0.1.9"}
17-
PyYAML = "^6.0"
18-
httpx = "^0.23.3"
19-
gunicorn = "^20.1.0"
9+
alembic = "1.12.1"
10+
asyncpg = "0.28.0"
11+
fastapi = "0.104.0"
12+
psycopg2-binary = "2.9.9"
13+
sqlmodel = "0.0.10"
14+
uvicorn = {extras = ["standard"], version = "0.23.2"}
15+
redis = "4.6.0"
16+
fastapi-cache2 = {extras = ["redis"], version = "0.2.1"}
17+
PyYAML = "6.0.1"
18+
httpx = "0.25.0"
19+
gunicorn = "21.0.1"
2020

2121
[tool.poetry.dev-dependencies]
22-
black = "^22.6.0"
23-
isort = "^5.12.0"
24-
mock = "^4.0.3"
25-
pytest = "^7.2.1"
26-
pytest-cov = "^4.0.0"
27-
pytest-mock = "^3.10.0"
28-
pytest-asyncio = "^0.19.0"
29-
mypy = "^0.982"
30-
ruff = "^0.0.241"
31-
requests = "^2.28.2"
22+
black = "23.10.1"
23+
isort = "5.12.0"
24+
pytest = "7.4.3"
25+
pytest-cov = "4.1.0"
26+
pytest-mock = "3.12.0"
27+
pytest-asyncio = "0.21.1"
28+
mypy = "1.6.1"
29+
ruff = "0.1.3"
30+
requests = "2.31.0"
31+
sqlalchemy-stubs = "0.4"
3232

3333
[tool.isort]
3434
multi_line_output = 3

{{ cookiecutter.project_slug }}/{{ cookiecutter.backend_container_name }}/src/api/v1/meme.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ async def memes(
3131
skip=skip, limit=limit, sort_field=sort_field, sort_order=sort_order
3232
)
3333

34-
return IGetResponseBase[List[IMemeRead]](data=memes)
34+
return IGetResponseBase[List[IMemeRead]](data=memes) # type: ignore

{{ cookiecutter.project_slug }}/{{ cookiecutter.backend_container_name }}/src/core/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ class Settings(BaseSettings):
1919
POSTGRES_HOST: str = Field(default="", env="POSTGRES_HOST")
2020
POSTGRES_PORT: str = Field(default="", env="POSTGRES_PORT")
2121
POSTGRES_DB: str = Field(default="", env="POSTGRES_DB")
22+
POSTGRES_URL: Optional[str] = None
2223

2324
REDIS_HOST: str = Field(default="", env="REDIS_HOST")
2425
REDIS_PORT: str = Field(default="", env="REDIS_PORT")
2526

2627
DB_POOL_SIZE: int = Field(default=83, env="DB_POOL_SIZE")
2728
WEB_CONCURRENCY: int = Field(default=9, env="WEB_CONCURRENCY")
2829
MAX_OVERFLOW: int = Field(default=64, env="MAX_OVERFLOW")
29-
POOL_SIZE: Optional[int]
30-
POSTGRES_URL: Optional[str]
30+
POOL_SIZE: Optional[int] = None
3131

3232
@validator("POOL_SIZE", pre=True)
3333
def build_pool(cls, v: Optional[str], values: Dict[str, Any]) -> Any:

{{ cookiecutter.project_slug }}/{{ cookiecutter.backend_container_name }}/src/repositories/sqlalchemy.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def create(self, obj_in: CreateSchemaType, **kwargs: Any) -> ModelType:
4747
async def get(self, **kwargs: Any) -> Optional[ModelType]:
4848
logger.info(f"Fetching [{self._model.__class__.__name__}] object by [{kwargs}]")
4949

50-
query = select(self._model).filter_by(**kwargs)
50+
query = select(self._model).filter_by(**kwargs) # type: ignore
5151
response = await self.db.execute(query)
5252
scalar: Optional[ModelType] = response.scalar_one_or_none()
5353

@@ -97,12 +97,12 @@ async def all(
9797
query = select(self._model).offset(skip).limit(limit).order_by(order_by)
9898

9999
response = await self.db.execute(query)
100-
return response.scalars().all()
100+
return response.scalars().all() # type: ignore
101101

102102
async def f(self, **kwargs: Any) -> List[ModelType]:
103103
logger.info(f"Fetching [{self._model.__class__.__name__}] object by [{kwargs}]")
104104

105-
query = select(self._model).filter_by(**kwargs)
105+
query = select(self._model).filter_by(**kwargs) # type: ignore
106106
response = await self.db.execute(query)
107107
scalars: List[ModelType] = response.scalars().all()
108108

0 commit comments

Comments
 (0)