-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Upgrade python/pytest + migrate to ruff
- Loading branch information
1 parent
66f6767
commit c94aee3
Showing
14 changed files
with
383 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[tools] | ||
python = "3.11" | ||
poetry = "latest" | ||
|
||
[env] | ||
_.file = '../../.env' | ||
_.python.venv = { path = "../../.venv", create = false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.venv | ||
.pytest_cache | ||
.ruff_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
fail_fast: true | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: ruff-check | ||
name: Ruff check | ||
entry: poetry run ruff check | ||
args: [--fix] | ||
language: system | ||
types: [file, python] | ||
- id: ruff-format | ||
name: Ruff format | ||
entry: poetry run ruff format | ||
language: system | ||
types: [file, python] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
FROM python:3.11-bookworm | ||
FROM 007065811408.dkr.ecr.eu-west-3.amazonaws.com/python-3-11:1 | ||
|
||
RUN \ | ||
apt-get -y update \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
WORKDIR /app | ||
|
||
RUN pip3 install --upgrade pip \ | ||
&& pip3 install -U setuptools | ||
COPY pyproject.toml poetry.lock poetry.toml ./ | ||
|
||
RUN pip install poetry | ||
# Poetry complains if no README.md exists | ||
RUN touch README.md | ||
|
||
COPY poetry.lock /home/src/nurse/poetry.lock | ||
COPY pyproject.toml /home/src/nurse/pyproject.toml | ||
RUN POETRY_NO_INTERACTION=1 poetry install | ||
|
||
WORKDIR /home/src/nurse | ||
COPY . . | ||
|
||
ARG REQUIREMENTS=common | ||
ENV REQUIREMENTS $REQUIREMENTS | ||
RUN mkdir requirements | ||
RUN poetry export -f requirements.txt --without-hashes > requirements/$REQUIREMENTS.txt | ||
RUN poetry export -f requirements.txt --without-hashes --with dev > requirements/dev.txt | ||
|
||
RUN pip3 install -r requirements/$REQUIREMENTS.txt | ||
|
||
COPY . /home/src/nurse | ||
CMD ["bash"] | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
version: '3.0' | ||
|
||
services: | ||
|
||
nurse: | ||
build: | ||
context: . | ||
args: | ||
- REQUIREMENTS=dev | ||
tty: true | ||
working_dir: /home/src/nurse | ||
working_dir: /app | ||
volumes: | ||
- ./.:/home/src/nurse | ||
- ./.:/app | ||
- /app/.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
virtualenvs.create = true | ||
virtualenvs.in-project = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[tool.poetry] | ||
name = "nurse" | ||
version = "0.5.1" | ||
description = "A thoughtful dependency injection framework 💉" | ||
description = "A thoughtful dependency injection framework" | ||
authors = ["ducdetronquito <[email protected]>"] | ||
|
||
readme = "README.rst" | ||
|
@@ -13,11 +13,24 @@ keywords = ["dependency", "injection"] | |
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
|
||
|
||
[tool.poetry.group.dev.dependencies] | ||
flake8 = "^6.1.0" | ||
pytest = "^3.0" | ||
black = { version = "*", allow-prereleases = true } | ||
pytest = "^8.0" | ||
ruff = "^0.7.3" | ||
pre-commit = "^4.0.1" | ||
pytest-cov = "^6.0.0" | ||
|
||
[build-system] | ||
requires = ["poetry>=0.12"] | ||
build-backend = "poetry.masonry.api" | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.pytest.ini_options] | ||
addopts = ["--import-mode=importlib"] | ||
pythonpath = "./" | ||
|
||
[tool.ruff] | ||
# Use black default line length to avoid to many changes at first | ||
line-length = 88 | ||
# It would be preferable to use python's standard "project.requires-python" | ||
# but poetry does not comply with it. | ||
target-version = "py311" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters