diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 0d7ca41..50114c8 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -15,7 +15,7 @@ jobs: - name: Install Poetry uses: abatilo/actions-poetry@v2.0.0 with: - poetry-version: 1.1.11 + poetry-version: 1.1.15 - name: Install dependencies run: | poetry config virtualenvs.in-project true @@ -43,7 +43,7 @@ jobs: - name: Install Poetry uses: abatilo/actions-poetry@v2.0.0 with: - poetry-version: 1.1.11 + poetry-version: 1.1.15 - name: Install dependencies run: | poetry config virtualenvs.in-project true @@ -78,7 +78,7 @@ jobs: - name: Install Poetry uses: abatilo/actions-poetry@v2.0.0 with: - poetry-version: 1.1.11 + poetry-version: 1.1.15 - name: Install dependencies run: | poetry config virtualenvs.in-project true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe6df70..94051b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,3 +10,10 @@ repos: rev: 22.10.0 hooks: - id: black + - repo: local + hooks: + - id: pylint + name: pylint + entry: pylint + language: system + types: [python] diff --git a/README.md b/README.md index 6888ee4..3ec5809 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,16 @@ [![codecov](https://codecov.io/gh/max-pfeiffer/python-poetry/branch/main/graph/badge.svg?token=WQI2SJJLZN)](https://codecov.io/gh/max-pfeiffer/uvicorn-poetry) ![pipeline workflow](https://github.com/max-pfeiffer/python-poetry/actions/workflows/pipeline.yml/badge.svg) # python-poetry -A Python Docker image with Poetry installed and ready to use. +A Python Docker image with [Poetry](https://python-poetry.org/) installed and +ready to use. You can use this image as base image for your own application +which uses [Poetry](https://python-poetry.org/) for dependency management. + +## Docker Image Features +1. Poetry versions: + 2. v1.1.15 + 3. v1.2.2 +3. Python versions: + 4. v3.7 + 5. v3.8 + 6. v3.9 + 5. v3.10 diff --git a/build/Dockerfile b/build/Dockerfile index a0dd011..38623f8 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,9 +1,8 @@ # References: using official Python images # https://hub.docker.com/_/python ARG OFFICIAL_PYTHON_IMAGE -ARG IMAGE_POETRY_VERSION -ARG APPLICATION_SERVER_PORT FROM ${OFFICIAL_PYTHON_IMAGE} +ARG POETRY_VERSION LABEL maintainer="Max Pfeiffer " @@ -18,7 +17,7 @@ LABEL maintainer="Max Pfeiffer " ENV PIP_NO_CACHE_DIR=off \ PIP_DISABLE_PIP_VERSION_CHECK=on \ PIP_DEFAULT_TIMEOUT=100 \ - POETRY_VERSION=${IMAGE_POETRY_VERSION} \ + POETRY_VERSION=${POETRY_VERSION} \ POETRY_HOME="/opt/poetry" ENV PATH="$POETRY_HOME/bin:$PATH" diff --git a/build/constants.py b/build/constants.py index 835ed5d..f0381f1 100644 --- a/build/constants.py +++ b/build/constants.py @@ -1,25 +1,73 @@ PYTHON_POETRY_IMAGE_NAME: str = "pfeiffermax/python-poetry" TARGET_ARCHITECTURES: list[str] = [ - "python3.9.14-bullseye-poetry1.2.1", - "python3.9.14-slim-bullseye-poetry1.2.1", - "python3.10.7-bullseye-poetry1.2.1", - "python3.10.7-slim-bullseye-poetry1.2.1", + "poetry1.1.15-python3.7.14-bullseye", + "poetry1.1.15-python3.7.14-slim-bullseye", + "poetry1.1.15-python3.8.14-bullseye", + "poetry1.1.15-python3.8.14-slim-bullseye", + "poetry1.1.15-python3.9.14-bullseye", + "poetry1.1.15-python3.9.14-slim-bullseye", + "poetry1.1.15-python3.10.7-bullseye", + "poetry1.1.15-python3.10.7-slim-bullseye", + "poetry1.2.2-python3.7.14-bullseye", + "poetry1.2.2-python3.7.14-slim-bullseye", + "poetry1.2.2-python3.8.14-bullseye", + "poetry1.2.2-python3.8.14-slim-bullseye", + "poetry1.2.2-python3.9.14-bullseye", + "poetry1.2.2-python3.9.14-slim-bullseye", + "poetry1.2.2-python3.10.7-bullseye", + "poetry1.2.2-python3.10.7-slim-bullseye", ] BASE_IMAGES: dict = { - TARGET_ARCHITECTURES[0]: "python:3.9.14-bullseye", - TARGET_ARCHITECTURES[1]: "python:3.9.14-slim-bullseye", - TARGET_ARCHITECTURES[2]: "python:3.10.7-bullseye", - TARGET_ARCHITECTURES[3]: "python:3.10.7-slim-bullseye", + TARGET_ARCHITECTURES[0]: "python:3.7.14-bullseye", + TARGET_ARCHITECTURES[1]: "python:3.7.14-slim-bullseye", + TARGET_ARCHITECTURES[2]: "python:3.8.14-bullseye", + TARGET_ARCHITECTURES[3]: "python:3.8.14-slim-bullseye", + TARGET_ARCHITECTURES[4]: "python:3.9.14-bullseye", + TARGET_ARCHITECTURES[5]: "python:3.9.14-slim-bullseye", + TARGET_ARCHITECTURES[6]: "python:3.10.7-bullseye", + TARGET_ARCHITECTURES[7]: "python:3.10.7-slim-bullseye", + TARGET_ARCHITECTURES[8]: "python:3.7.14-bullseye", + TARGET_ARCHITECTURES[9]: "python:3.7.14-slim-bullseye", + TARGET_ARCHITECTURES[10]: "python:3.8.14-bullseye", + TARGET_ARCHITECTURES[11]: "python:3.8.14-slim-bullseye", + TARGET_ARCHITECTURES[12]: "python:3.9.14-bullseye", + TARGET_ARCHITECTURES[13]: "python:3.9.14-slim-bullseye", + TARGET_ARCHITECTURES[14]: "python:3.10.7-bullseye", + TARGET_ARCHITECTURES[15]: "python:3.10.7-slim-bullseye", } PYTHON_VERSIONS: dict = { - TARGET_ARCHITECTURES[0]: "3.9.14", - TARGET_ARCHITECTURES[1]: "3.9.14", - TARGET_ARCHITECTURES[2]: "3.10.7", - TARGET_ARCHITECTURES[3]: "3.10.7", + TARGET_ARCHITECTURES[0]: "3.7.14", + TARGET_ARCHITECTURES[1]: "3.7.14", + TARGET_ARCHITECTURES[2]: "3.8.14", + TARGET_ARCHITECTURES[3]: "3.8.14", + TARGET_ARCHITECTURES[4]: "3.9.14", + TARGET_ARCHITECTURES[5]: "3.9.14", + TARGET_ARCHITECTURES[6]: "3.10.7", + TARGET_ARCHITECTURES[7]: "3.10.7", + TARGET_ARCHITECTURES[8]: "3.7.14", + TARGET_ARCHITECTURES[9]: "3.7.14", + TARGET_ARCHITECTURES[10]: "3.8.14", + TARGET_ARCHITECTURES[11]: "3.8.14", + TARGET_ARCHITECTURES[12]: "3.9.14", + TARGET_ARCHITECTURES[13]: "3.9.14", + TARGET_ARCHITECTURES[14]: "3.10.7", + TARGET_ARCHITECTURES[15]: "3.10.7", } POETRY_VERSIONS: dict = { - TARGET_ARCHITECTURES[0]: "1.2.1", - TARGET_ARCHITECTURES[1]: "1.2.1", - TARGET_ARCHITECTURES[2]: "1.2.1", - TARGET_ARCHITECTURES[3]: "1.2.1", + TARGET_ARCHITECTURES[0]: "1.1.15", + TARGET_ARCHITECTURES[1]: "1.1.15", + TARGET_ARCHITECTURES[2]: "1.1.15", + TARGET_ARCHITECTURES[3]: "1.1.15", + TARGET_ARCHITECTURES[4]: "1.1.15", + TARGET_ARCHITECTURES[5]: "1.1.15", + TARGET_ARCHITECTURES[6]: "1.1.15", + TARGET_ARCHITECTURES[7]: "1.1.15", + TARGET_ARCHITECTURES[8]: "1.2.2", + TARGET_ARCHITECTURES[9]: "1.2.2", + TARGET_ARCHITECTURES[10]: "1.2.2", + TARGET_ARCHITECTURES[11]: "1.2.2", + TARGET_ARCHITECTURES[12]: "1.2.2", + TARGET_ARCHITECTURES[13]: "1.2.2", + TARGET_ARCHITECTURES[14]: "1.2.2", + TARGET_ARCHITECTURES[15]: "1.2.2", } diff --git a/build/images.py b/build/images.py index 29b5676..ebfdfca 100644 --- a/build/images.py +++ b/build/images.py @@ -39,7 +39,7 @@ def build(self, target_architecture: str, version: str = None) -> Image: buildargs: dict[str, str] = { "OFFICIAL_PYTHON_IMAGE": BASE_IMAGES[target_architecture], - "IMAGE_POETRY_VERSION": POETRY_VERSIONS[target_architecture], + "POETRY_VERSION": POETRY_VERSIONS[target_architecture], } tag: str = f"{self.image_name}:{self.version_tag}-{target_architecture}" diff --git a/poetry.lock b/poetry.lock index 7e626f9..9663779 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,6 +1,6 @@ [[package]] name = "astroid" -version = "2.12.10" +version = "2.12.11" description = "An abstract syntax tree for Python with inference support." category = "dev" optional = false @@ -298,14 +298,14 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [[package]] name = "pylint" -version = "2.15.3" +version = "2.15.4" description = "python code static checker" category = "dev" optional = false python-versions = ">=3.7.2" [package.dependencies] -astroid = ">=2.12.10,<=2.14.0-dev0" +astroid = ">=2.12.11,<=2.14.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = ">=0.2" isort = ">=4.2.5,<6" @@ -504,12 +504,12 @@ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" [metadata] lock-version = "1.1" python-versions = "3.9.*" -content-hash = "1431103148ae79762a67cf49e2f4e44c3985b25cf11eabbc31051bad73404768" +content-hash = "182745dab486629e5730d8cfece0aedf7c193a6a19ba463e23365e1c32e17a66" [metadata.files] astroid = [ - {file = "astroid-2.12.10-py3-none-any.whl", hash = "sha256:997e0c735df60d4a4caff27080a3afc51f9bdd693d3572a4a0b7090b645c36c5"}, - {file = "astroid-2.12.10.tar.gz", hash = "sha256:81f870105d892e73bf535da77a8261aa5bde838fa4ed12bb2f435291a098c581"}, + {file = "astroid-2.12.11-py3-none-any.whl", hash = "sha256:867a756bbf35b7bc07b35bfa6522acd01f91ad9919df675e8428072869792dce"}, + {file = "astroid-2.12.11.tar.gz", hash = "sha256:2df4f9980c4511474687895cbfdb8558293c1a826d9118bb09233d7c2bff1c83"}, ] attrs = [ {file = "attrs-22.1.0-py2.py3-none-any.whl", hash = "sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c"}, @@ -718,8 +718,8 @@ py = [ {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, ] pylint = [ - {file = "pylint-2.15.3-py3-none-any.whl", hash = "sha256:7f6aad1d8d50807f7bc64f89ac75256a9baf8e6ed491cc9bc65592bc3f462cf1"}, - {file = "pylint-2.15.3.tar.gz", hash = "sha256:5fdfd44af182866999e6123139d265334267339f29961f00c89783155eacc60b"}, + {file = "pylint-2.15.4-py3-none-any.whl", hash = "sha256:629cf1dbdfb6609d7e7a45815a8bb59300e34aa35783b5ac563acaca2c4022e9"}, + {file = "pylint-2.15.4.tar.gz", hash = "sha256:5441e9294335d354b7bad57c1044e5bd7cce25c433475d76b440e53452fa5cb8"}, ] pyparsing = [ {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, diff --git a/pyproject.toml b/pyproject.toml index 3d79a25..4817976 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,12 +10,11 @@ python = "3.9.*" python-dotenv = "0.21.0" [tool.poetry.dev-dependencies] -pylint = "2.15.3" +pylint = "2.15.4" pytest = "7.1.3" pytest-cov = "4.0.0" coverage = "6.5.0" docker = "6.0.0" -requests = "2.28.1" black = "22.10.0" pre-commit = "2.20.0" semver = "2.13.0" diff --git a/tests/configuration/test_poetry_version.py b/tests/configuration/test_poetry_version.py index f48aaca..d59f998 100644 --- a/tests/configuration/test_poetry_version.py +++ b/tests/configuration/test_poetry_version.py @@ -33,4 +33,4 @@ def test_poetry_configuration( poetry_version: str = POETRY_VERSIONS[ image_tag_components.target_architecture ] - assert f"Poetry (version {poetry_version})" in output.decode("utf-8") + assert poetry_version in output.decode("utf-8") diff --git a/tests/utils.py b/tests/utils.py index aab92c3..66ce46c 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -17,7 +17,7 @@ def create_from_tag(cls, tag: str): target_architecture_index = [ index for index, tag_part in enumerate(image_tag_parts) - if tag_part.startswith("python") + if tag_part.startswith("poetry") ][0] version: str = "-".join(image_tag_parts[:target_architecture_index])