From 5e8ebf04cea1d93ec4d5a671ff0b2c2acf9b4bdc Mon Sep 17 00:00:00 2001 From: fuku Date: Mon, 10 Mar 2025 17:14:47 +0900 Subject: [PATCH] remove support python3.7 and update libs --- .github/workflows/acceptance-tests.yml | 4 ++-- .github/workflows/unit-tests.yml | 8 ++++---- Dockerfile | 4 ++-- Pipfile | 2 +- README.md | 2 +- nifcloud/session.py | 24 ++++++++++++++++++++++-- setup.py | 5 +++-- 7 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 35c62b4..9c93067 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -16,7 +16,7 @@ jobs: strategy: max-parallel: 1 matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v2 @@ -27,7 +27,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install pipenv - run: pip install pipenv==2023.5.19 + run: pip install pipenv==2024.4.1 - name: Install dependencies run: pipenv install --skip-lock -d diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 48e4f7c..826b3bb 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -5,7 +5,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.13"] steps: - name: Checkout uses: actions/checkout@v2 @@ -16,7 +16,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install pipenv - run: pip install pipenv==2023.5.19 + run: pip install pipenv==2024.4.1 - name: Install dependencies run: pipenv install --skip-lock -d @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Checkout uses: actions/checkout@v2 @@ -41,7 +41,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install pipenv - run: pip install pipenv==2023.5.19 + run: pip install pipenv==2024.4.1 - name: Install dependencies run: pipenv install --skip-lock -d diff --git a/Dockerfile b/Dockerfile index 7d590ba..5f7d38e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM python:3.11.3 +FROM python:3.13.2 WORKDIR /usr/local/app RUN apt-get update && apt-get install -y groff-base ADD Pipfile /usr/local/app -RUN pip install pipenv==2023.5.19 && pipenv install --skip-lock -d +RUN pip install pipenv==2024.4.1 && pipenv install --skip-lock -d ENTRYPOINT ["pipenv", "run"] diff --git a/Pipfile b/Pipfile index f129640..a230e4a 100644 --- a/Pipfile +++ b/Pipfile @@ -4,7 +4,7 @@ verify_ssl = true name = "pypi" [packages] -botocore = "==1.31.1" +botocore = "==1.37.10" [dev-packages] isort = "*" diff --git a/README.md b/README.md index 401c56d..b3cccbc 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ It works by feeding AWS-SDK-compatible model JSONs to botocore module. ## Requirements -- Python 3.7 or later +- Python 3.8 or later ## How to Install diff --git a/nifcloud/session.py b/nifcloud/session.py index e6ba445..6046284 100644 --- a/nifcloud/session.py +++ b/nifcloud/session.py @@ -1,9 +1,26 @@ +import ssl + from botocore import __version__ as botocore_version from botocore import session +from botocore.httpsession import URLLib3Session from botocore.session import get_session # noqa: F401 import nifcloud +# for ncl4lb +extra_ciphers = "AES256-SHA256" + +ssl_context = ssl.create_default_context() +default_ciphers = ssl_context.get_ciphers() +default_cipher_names = ":".join(c['name'] for c in default_ciphers) +ssl_context.set_ciphers(f"{default_cipher_names}:{extra_ciphers}") + + +class CustomURLLib3Session(URLLib3Session): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._manager.connection_pool_kw['ssl_context'] = ssl_context + class Session(session.Session): @@ -19,10 +36,13 @@ def create_client(self, service_name, region_name=None, api_version=None, use_ssl=True, verify=None, endpoint_url=None, nifcloud_access_key_id=None, nifcloud_secret_access_key=None, nifcloud_session_token=None, config=None): - return super(Session, self).create_client( + client = super(Session, self).create_client( service_name, region_name=region_name, api_version=api_version, use_ssl=use_ssl, verify=verify, endpoint_url=endpoint_url, aws_access_key_id=nifcloud_access_key_id, - aws_secret_access_key=nifcloud_secret_access_key, aws_session_token=nifcloud_session_token, config=config) + aws_secret_access_key=nifcloud_secret_access_key, aws_session_token=nifcloud_session_token, config=config + ) + client._endpoint.http_session = CustomURLLib3Session() + return client session.Session = Session diff --git a/setup.py b/setup.py index 3883416..d13baa0 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ def find_version(*file_paths): package_data={'nifcloud': ['data/*.json', 'data/*/*/*.json']}, include_package_data=True, - install_requires=['botocore==1.31.1'], + install_requires=['botocore==1.37.10'], license='Apache License 2.0', classifiers=( 'Development Status :: 5 - Production/Stable', @@ -45,10 +45,11 @@ def find_version(*file_paths): 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', ), )