From 3c495f6903483e25610143ecbc4e337f73eeca8c Mon Sep 17 00:00:00 2001 From: Joy Machado Date: Mon, 20 Jan 2025 14:51:44 +0100 Subject: [PATCH] update python versions --- .github/workflows/python-release.yml | 8 ++++---- .github/workflows/python-test.yml | 22 +++++++++++----------- Dockerfile | 2 +- setup.py | 23 ++++++++++++----------- src/ecs_deplojo/cli.py | 5 ----- tests/conftest.py | 17 +++++++---------- tox.ini | 15 +++++++++------ 7 files changed, 44 insertions(+), 48 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 21caa6f..90029cb 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -8,11 +8,11 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Install build requirements run: python -m pip install wheel - name: Build package diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index e630df4..afd7f43 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -7,11 +7,11 @@ jobs: format: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - uses: actions/checkout@v4 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Install dependencies run: pip install tox - name: Validate formatting @@ -22,11 +22,11 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.9, 3.10, 3.11, 3.12] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -46,15 +46,15 @@ jobs: runs-on: ubuntu-latest needs: [test] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/download-artifact@master with: name: coverage-data path: . - - name: Set up Python 3.7 - uses: actions/setup-python@v1 + - name: Set up Python 3.12 + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/Dockerfile b/Dockerfile index 6264e17..cefa5d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.7-alpine +FROM python:3.12-alpine RUN adduser -S app app diff --git a/setup.py b/setup.py index 2662dd1..a30c499 100644 --- a/setup.py +++ b/setup.py @@ -5,18 +5,18 @@ install_requires = [ "boto3>=1.36.2", - "click==7.0", - "pyaml==16.12.2", + "click==8.1.8", + "pyaml==25.1.0", "pytz", ] tests_requires = [ - "coverage[toml]==5.0.3", - "flake8==3.7.8", - "isort==5.0.6", - "moto==1.3.14", - "pytest==5.4.3", - "pytest-cov==2.10.0", + "coverage[toml]==7.6.10", + "flake8", + "isort", + "moto", + "pytest==8.3.4", + "pytest-cov==6.0.0", ] with open("README.rst") as fh: @@ -45,8 +45,9 @@ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], ) diff --git a/src/ecs_deplojo/cli.py b/src/ecs_deplojo/cli.py index 0ab822d..e420ea9 100644 --- a/src/ecs_deplojo/cli.py +++ b/src/ecs_deplojo/cli.py @@ -12,11 +12,6 @@ from ecs_deplojo.logger import logger from ecs_deplojo.task_definitions import generate_task_definitions -try: - from botocore.compat import six -except ImportError: - pass - class VarType(click.ParamType): name = "var" diff --git a/tests/conftest.py b/tests/conftest.py index 6ca9c76..31f9da7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,6 @@ import boto3 import moto import pytest -from moto.ec2 import ec2_backend from moto.ec2 import utils as ec2_utils from ecs_deplojo.connection import Connection @@ -14,21 +13,19 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__)) -@pytest.yield_fixture(scope="function") +@pytest.fixture(scope="function") def cluster(): - - with moto.mock_ecs(), moto.mock_ec2(): + with moto.mock_aws(): boto3.setup_default_session(region_name="eu-west-1") - ec2 = boto3.resource("ec2", region_name="eu-west-1") + ec2_resource = boto3.resource("ec2", region_name="eu-west-1") + ec2_client = boto3.client("ec2", region_name="eu-west-1") ecs = boto3.client("ecs", region_name="eu-west-1") - - known_amis = list(ec2_backend.describe_images()) - - test_instance = ec2.create_instances( - ImageId=known_amis[0].id, MinCount=1, MaxCount=1 + test_instance = ec2_resource.create_instances( + ImageId="ami-12c6146b", MinCount=1, MaxCount=1 )[0] + instance_id_document = json.dumps( ec2_utils.generate_instance_identity_document(test_instance) ) diff --git a/tox.ini b/tox.ini index dfe7d4f..b2a1745 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,21 @@ [tox] -envlist = py36,py37,py38 +envlist = py39,py310,py311,py312,py313 [gh-actions] python = - 3.6: py36 - 3.7: py37 - 3.8: py38 + 3.9: py39 + 3.10: py310 + 3.11: py311 + 3.12: py312 + 3.13: py313 + [testenv] commands = coverage run --source ecs_deplojo --parallel -m pytest {posargs} extras = test [testenv:coverage-report] -basepython = python3.7 +basepython = python3.12 deps = coverage[toml] skip_install = true commands = @@ -21,7 +24,7 @@ commands = coverage report [testenv:format] -basepython = python3.7 +basepython = python3.12 deps = black isort