From df869b08280f6f3378a6dde39028d4551cbdfbcb Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Thu, 27 Feb 2025 22:16:41 +0100 Subject: [PATCH 1/5] Fixed linting warnings --- transip_client/tests/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transip_client/tests/tests.py b/transip_client/tests/tests.py index fc911d8..9176f79 100644 --- a/transip_client/tests/tests.py +++ b/transip_client/tests/tests.py @@ -1,7 +1,7 @@ import json import os -from unittest import TestCase, skip +from unittest import TestCase from unittest.mock import call, patch, Mock from pathlib import Path @@ -225,7 +225,7 @@ class RunTestCase(TestCase): self.assertEqual(result.exit_code, 0) self.mocked_get.assert_called_with( - f"https://other-provider.com/domains/foobar.com/dns", + "https://other-provider.com/domains/foobar.com/dns", headers={"Authorization": "Bearer token"}, ) @@ -243,7 +243,7 @@ class RunTestCase(TestCase): ) self.mocked_put.assert_called_with( - f"https://other-provider.com/domains/foobar.com/dns", + "https://other-provider.com/domains/foobar.com/dns", data=expected_json, headers={"Authorization": "Bearer token"}, ) From 9a50b78a16a9b59797a4f53d1844905741feabe0 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 28 Feb 2025 08:15:59 +0100 Subject: [PATCH 2/5] Add a Dockerfile --- .dockerignore | 1 + Dockerfile | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..2b29f27 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +tests diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a0bb3d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM ghcr.io/astral-sh/uv:python3.11-bookworm + +ENV UV_CACHE_DIR=/app/.cache/uv + +RUN useradd --shell /bin/bash --uid 1000 transip_client + +USER transip_client + +WORKDIR /app + +RUN mkdir --parents /app/.cache/uv + +# only install dependencies +RUN --mount=type=cache,uid=1000,target=/app/.cache/uv \ + --mount=type=bind,source=uv.lock,target=/app/uv.lock \ + --mount=type=bind,source=pyproject.toml,target=/app/pyproject.toml \ + uv sync --frozen --no-install-project + +COPY pyproject.toml uv.lock /app +COPY transip_client /app/transip_client + +# install dependencies + project +RUN --mount=type=cache,uid=1000,target=/app/.cache/uv uv sync --frozen + +ENTRYPOINT ["uv", "run", "--", "transip-listen"] From 76f80c5032884b96f7af034d44976906f888fd27 Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 28 Feb 2025 08:16:19 +0100 Subject: [PATCH 3/5] Remove dangling __init__.py file --- __init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 __init__.py diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 From 3e84b1dfedb9072a6b54d3fb9a2cb4db08f61afe Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 28 Feb 2025 08:22:24 +0100 Subject: [PATCH 4/5] Include isort linting for ruff --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7f91a00..da9b3a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,9 @@ build-backend = 'setuptools.build_meta' [tool.uv] environments = ["sys_platform == 'linux'"] +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F", "I"] + [tool.ruff.lint.isort] lines-between-types=1 lines-after-imports=2 From 595f93cb612b5e3d43150a93704ba9254657ebfd Mon Sep 17 00:00:00 2001 From: Sonny Bakker Date: Fri, 28 Feb 2025 08:25:58 +0100 Subject: [PATCH 5/5] Fix formatting --- transip_client/tests/tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transip_client/tests/tests.py b/transip_client/tests/tests.py index 9176f79..ec05227 100644 --- a/transip_client/tests/tests.py +++ b/transip_client/tests/tests.py @@ -1,9 +1,9 @@ import json import os -from unittest import TestCase -from unittest.mock import call, patch, Mock from pathlib import Path +from unittest import TestCase +from unittest.mock import Mock, call, patch from click.testing import CliRunner from requests import HTTPError