diff --git a/.github/workflows/docbuild.yml b/.github/workflows/docbuild.yml index e57d9a0..81b6d51 100644 --- a/.github/workflows/docbuild.yml +++ b/.github/workflows/docbuild.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.10", "3.11"] steps: - name: Checkout repo diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 47a5834..9dd97c8 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -8,7 +8,7 @@ jobs: strategy: max-parallel: 8 matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.10", "3.11"] steps: - name: Checkout repo @@ -19,9 +19,9 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install software run: | - python -m pip install --upgrade pip --use-feature=2020-resolver - python -m pip install coveralls --use-feature=2020-resolver - python -m pip install .[dev] --use-feature=2020-resolver + python -m pip install --upgrade pip + python -m pip install coveralls + python -m pip install .[dev] python -m pip install https://github.com/bboe/coveralls-python/archive/github_actions.zip - name: Configure run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a30267f..c25c21a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,5 @@ repos: - repo: https://github.com/python/black - rev: 22.1.0 + rev: 23.7.0 hooks: - id: black - language_version: python3.9 diff --git a/cloudknot/aws/base_classes.py b/cloudknot/aws/base_classes.py index 620fb91..6896fd6 100644 --- a/cloudknot/aws/base_classes.py +++ b/cloudknot/aws/base_classes.py @@ -251,6 +251,7 @@ def get_s3_params(): # Use set_s3_params to check for name availability # and write to config file + bucket = bucket.replace("_", "-") # S3 does not allow underscores set_s3_params(bucket=bucket, policy=policy, sse=sse) if policy is None: diff --git a/cloudknot/cloudknot.py b/cloudknot/cloudknot.py index 9251735..38da5fa 100644 --- a/cloudknot/cloudknot.py +++ b/cloudknot/cloudknot.py @@ -5,10 +5,9 @@ import logging import os -try: - from collections.abc import Iterable, namedtuple -except ImportError: - from collections import Iterable, namedtuple +from collections.abc import Iterable +from collections import namedtuple + from concurrent.futures import ThreadPoolExecutor from . import aws diff --git a/cloudknot/data/docker_reqs_ref_data/py3/ref1/Dockerfile b/cloudknot/data/docker_reqs_ref_data/py3/ref1/Dockerfile index 5b07533..6f0dc50 100644 --- a/cloudknot/data/docker_reqs_ref_data/py3/ref1/Dockerfile +++ b/cloudknot/data/docker_reqs_ref_data/py3/ref1/Dockerfile @@ -13,18 +13,17 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt # Create a default user. Available via runtime flag `--user cloudknot-user`. # Add user to "staff" group. # Give user a home directory. -RUN (id -u cloudknot-user >/dev/null 2>&1 || useradd cloudknot-user) \ - && addgroup cloudknot-user staff \ - && mkdir -p /home/cloudknot-user \ - && chown -R cloudknot-user:staff /home/cloudknot-user +RUN groupadd -f staff \ + && useradd --create-home --groups staff "cloudknot-user" -ENV HOME /home/cloudknot-user +# Copy the python script +COPY --chown="cloudknot-user" "unit-testing-func.py" "/home/cloudknot-user/" + +# Set user +USER "cloudknot-user" # Set working directory -WORKDIR /home/cloudknot-user +WORKDIR "/home/cloudknot-user" # Set entrypoint -ENTRYPOINT ["python", "/home/cloudknot-user/unit-testing-func.py"] - -# Copy the python script -COPY unit-testing-func.py /home/cloudknot-user/ +ENTRYPOINT ["/home/cloudknot-user/unit-testing-func.py"] diff --git a/cloudknot/data/docker_reqs_ref_data/py3/ref1/unit-testing-func.py b/cloudknot/data/docker_reqs_ref_data/py3/ref1/unit-testing-func.py index 55ddaa2..ecaeb66 100644 --- a/cloudknot/data/docker_reqs_ref_data/py3/ref1/unit-testing-func.py +++ b/cloudknot/data/docker_reqs_ref_data/py3/ref1/unit-testing-func.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import boto3 import cloudpickle import os diff --git a/cloudknot/data/docker_reqs_ref_data/py3/ref2/Dockerfile b/cloudknot/data/docker_reqs_ref_data/py3/ref2/Dockerfile index f332d1c..d4cbfe4 100644 --- a/cloudknot/data/docker_reqs_ref_data/py3/ref2/Dockerfile +++ b/cloudknot/data/docker_reqs_ref_data/py3/ref2/Dockerfile @@ -13,18 +13,17 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt # Create a default user. Available via runtime flag `--user unit-test-username`. # Add user to "staff" group. # Give user a home directory. -RUN (id -u unit-test-username >/dev/null 2>&1 || useradd unit-test-username) \ - && addgroup unit-test-username staff \ - && mkdir -p /home/unit-test-username \ - && chown -R unit-test-username:staff /home/unit-test-username +RUN groupadd -f staff \ + && useradd --create-home --groups staff "unit-test-username" -ENV HOME /home/unit-test-username +# Copy the python script +COPY --chown="unit-test-username" "test-func-input.py" "/home/unit-test-username/" + +# Set user +USER "unit-test-username" # Set working directory -WORKDIR /home/unit-test-username +WORKDIR "/home/unit-test-username" # Set entrypoint -ENTRYPOINT ["python", "/home/unit-test-username/test-func-input.py"] - -# Copy the python script -COPY test-func-input.py /home/unit-test-username/ +ENTRYPOINT ["/home/unit-test-username/test-func-input.py"] diff --git a/cloudknot/data/docker_reqs_ref_data/py3/ref2/test-func-input.py b/cloudknot/data/docker_reqs_ref_data/py3/ref2/test-func-input.py index 55ddaa2..ecaeb66 100644 --- a/cloudknot/data/docker_reqs_ref_data/py3/ref2/test-func-input.py +++ b/cloudknot/data/docker_reqs_ref_data/py3/ref2/test-func-input.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import boto3 import cloudpickle import os diff --git a/cloudknot/templates/Dockerfile.template b/cloudknot/templates/Dockerfile.template index cf1b8d8..259aa92 100644 --- a/cloudknot/templates/Dockerfile.template +++ b/cloudknot/templates/Dockerfile.template @@ -13,18 +13,17 @@ RUN pip install --no-cache-dir -r /tmp/requirements.txt${github_installs_string} # Create a default user. Available via runtime flag `--user ${username}`. # Add user to "staff" group. # Give user a home directory. -RUN (id -u ${username} >/dev/null 2>&1 || useradd ${username}) \ - && addgroup ${username} staff \ - && mkdir -p /home/${username} \ - && chown -R ${username}:staff /home/${username} +RUN groupadd -f staff \ + && useradd --create-home --groups staff "${username}" -ENV HOME /home/${username} +# Copy the python script +COPY --chown="${username}" "${script_base_name}" "/home/${username}/" + +# Set user +USER "${username}" # Set working directory -WORKDIR /home/${username} +WORKDIR "/home/${username}" # Set entrypoint -ENTRYPOINT ["python", "/home/${username}/${script_base_name}"] - -# Copy the python script -COPY ${script_base_name} /home/${username}/ +ENTRYPOINT ["/home/${username}/${script_base_name}"] diff --git a/cloudknot/templates/script.template b/cloudknot/templates/script.template index 6383ff1..d885e2e 100644 --- a/cloudknot/templates/script.template +++ b/cloudknot/templates/script.template @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 import boto3 import cloudpickle import os diff --git a/pyproject.toml b/pyproject.toml index 6d944aa..9d2a6ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,7 @@ exclude = ''' | build | dist )/ - | foo.py # also separately exclude a file named foo.py in - # the root of the project + | _version.py + | cli.py ) ''' diff --git a/setup.cfg b/setup.cfg index 86c839b..cc361d2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,9 +33,9 @@ setup_requires = setuptools_scm python_requires = >=3.6 install_requires = - awscli - boto3>=1.5.21 - botocore>=1.8.36 + boto3>=1.34.31 + awscli>=1.32.31 + botocore>=1.34.31 cloudpickle docker>=3.0.0 pipreqs>=0.4.11 @@ -53,18 +53,17 @@ console_scripts = [options.extras_require] dev = - black==20.8b1 + black==23.7.0 coverage==5.3 flake8==3.8.3 numpydoc==1.1.0 - moto>=2.2.13.dev2 - responses==0.12.0 - pre-commit==2.9.2 + moto[cloudformation]==4.1.5 + pre-commit==3.3.3 pydocstyle==5.1.1 pytest-cov==2.10.1 pytest-xdist[psutil]==2.1.0 - pytest==6.0.1 - sphinx==3.2.1 + pytest==7.4.0 + sphinx==5.0.0 maint = rapidfuzz==0.12.2