From a1a0a9ec0c86be7ceae49f11983c3b0646793451 Mon Sep 17 00:00:00 2001 From: Phillip Ferentinos Date: Tue, 14 Oct 2025 10:34:32 -0500 Subject: [PATCH 1/4] build(py37): remove support for python3.7 BREAKING CHANGE: --- .github/super-linter.env | 4 ++-- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 4 ++-- pyproject.toml | 2 +- setup.cfg | 3 +-- super-linter.env | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/super-linter.env b/.github/super-linter.env index e696775..f3c0df6 100644 --- a/.github/super-linter.env +++ b/.github/super-linter.env @@ -10,5 +10,5 @@ VALIDATE_MARKDOWN=false VALIDATE_HTML_PRETTIER=false VALIDATE_PYTHON_PYLINT=false VALIDATE_PYTHON_RUFF=false -VALIDATE_PYTHON_PYINK=false -VALIDATE_PYTHON_ISORT=false \ No newline at end of file +VALIDATE_PYTHON_ISORT=false +VALIDATE_GIT_COMMITLINT=false \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86e0581..72ac8a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: statuses: write strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.8, 3.9] steps: - uses: actions/checkout@v4 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index d3a1ae1..4831b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ ## [1.1.1](https://github.com/cshamrick/stsauth/compare/v1.1.0...v1.1.1) (2024-09-20) -### Bug Fixes +### Bugfixes -* handle connection errors more gracefully ([0497547](https://github.com/cshamrick/stsauth/commit/049754726aeeccba43c5a0343c4a25a87758c587)) +- handle connection errors more gracefully ([0497547](https://github.com/cshamrick/stsauth/commit/049754726aeeccba43c5a0343c4a25a87758c587)) ## [1.1.0](https://github.com/cshamrick/stsauth/compare/v1.0.3...v1.1.0) (2023-10-03) diff --git a/pyproject.toml b/pyproject.toml index dcae026..d3068e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ legacy_tox_ini = """ [tox] skipsdist=True minversion=2.3.1 -envlist = py37,py38,py39 +envlist = py38,py39 [testenv] deps = diff --git a/setup.cfg b/setup.cfg index e8ba20f..07d630c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,14 +11,13 @@ classifiers = Development Status :: 4 - Beta Intended Audience :: Developers Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Operating System :: OS Independent Topic :: Utilities [options] -python_requires = >=3.6,<4.0 +python_requires = >=3.8,<4.0 packages = find: install_requires = boto3 <2 diff --git a/super-linter.env b/super-linter.env index b9972f5..f0405c2 100644 --- a/super-linter.env +++ b/super-linter.env @@ -11,8 +11,8 @@ VALIDATE_MARKDOWN=false VALIDATE_HTML_PRETTIER=false VALIDATE_PYTHON_PYLINT=false VALIDATE_PYTHON_RUFF=false -VALIDATE_PYTHON_PYINK=false VALIDATE_PYTHON_ISORT=false +VALIDATE_GIT_COMMITLINT=false FIX_YAML_PRETTIER=true FIX_MARKDOWN_PRETTIER=true From 079634560788bf3c151861e6a2cdf2e477618e64 Mon Sep 17 00:00:00 2001 From: Phillip Ferentinos Date: Wed, 15 Oct 2025 08:43:08 -0500 Subject: [PATCH 2/4] build: replace project setup.cfg fully with pyproject.toml --- .github/workflows/publish-pypi.yml | 2 +- Dockerfile | 7 +-- pyproject.toml | 85 +++++++++++++++++++++++++----- setup.cfg | 53 ------------------- 4 files changed, 77 insertions(+), 70 deletions(-) delete mode 100644 setup.cfg diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 58231e6..d91c5e7 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -29,7 +29,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install .[dist] + pip install --group dist - name: Build run: | python -m build diff --git a/Dockerfile b/Dockerfile index 1f774e3..2be01fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.8-slim as build +FROM python:3.9-slim AS build # checkov:skip=CKV_DOCKER_3 # checkov:skip=CKV_DOCKER_2 WORKDIR /usr/src/stsauth @@ -8,10 +8,11 @@ RUN apt-get update -y \ && apt-get install --no-install-recommends -y git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ - && pip install --no-cache-dir .[dist] \ + && pip install --upgrade pip \ + && pip install --no-cache-dir --group dist \ && python -m build -FROM python:3.8-slim as runtime +FROM python:3.9-slim AS runtime COPY --from=build /usr/src/stsauth/dist/*.whl /dist/ RUN pip install --no-cache-dir dist/stsauth*.whl diff --git a/pyproject.toml b/pyproject.toml index d3068e1..cc5f31e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,26 +2,85 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.0"] build-backend = "setuptools.build_meta" +[project] +name = "stsauth" +dynamic = ["version"] +authors = [{ name = "Scott Hamrick", email = "scott@scotthamrick.com" }] +description = "CLI tool for fetching AWS tokens." +readme = { file = "README.md", content-type = "text/markdown" } +license = { file = "LICENSE" } +# # This below format is for py3.9 and above +# license = "MIT" +# license-files = ["LICENSE"] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Operating System :: OS Independent", + "Topic :: Utilities", +] +requires-python = ">=3.8" +dependencies = [ + "boto3 <2", + "beautifulsoup4 <5", + "Click >=8,<9", + "click-log <0.4", + "requests <3", + "requests_ntlm <2", + "lxml <5", + "pyotp <3", + "urllib3<1.30", + "importlib_metadata;python_version<'3.8'", + "backoff<2.3", +] + +[dependency-groups] +dist = ["build", "twine"] +dev = ["ipython", "ipdb", "pylint"] +tests = ["tox", "mock", "nose", "flake8", "pytest", "coverage", "pytest-cov"] + +[project.scripts] +stsauth = "sts_auth.cli:cli" + +[project.urls] +Homepage = "https://github.com/cshamrick/stsauth" +Repository = "https://github.com/cshamrick/stsauth" +Issues = "https://github.com/cshamrick/stsauth/issues" +Changelog = "https://github.com/cshamrick/stsauth/blob/main/CHANGELOG.md" + [tool.black] line-length = 120 [tool.mypy] show_error_codes = true +[tool.setuptools.packages] +find = {} + [tool.setuptools_scm] write_to = "sts_auth/_version.py" [tool.tox] -legacy_tox_ini = """ -[tox] -skipsdist=True -minversion=2.3.1 -envlist = py38,py39 - -[testenv] -deps = - .[tests] -commands = - coverage run -m pytest {posargs} - coverage xml -""" \ No newline at end of file +requires = ["tox>=4"] +env_list = ["py38", "py39"] +skipsdist = true + +[tool.tox.env_run_base] +description = "Run test under {base_python}" +deps = ["."] +dependency_groups = ["tests"] +commands = [ + [ + "coverage", + "run", + "-m", + "pytest", + "{posargs}", + ], + [ + "coverage", + "xml", + ], +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 07d630c..0000000 --- a/setup.cfg +++ /dev/null @@ -1,53 +0,0 @@ -[metadata] -name = stsauth -author = Scott Hamrick -author_email = scott@scotthamrick.com -description = CLI tool for fetching AWS tokens. -license = MIT -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/cshamrick/stsauth -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Developers - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Operating System :: OS Independent - Topic :: Utilities - -[options] -python_requires = >=3.8,<4.0 -packages = find: -install_requires = - boto3 <2 - beautifulsoup4 <5 - Click >=8,<9 - click-log <0.4 - requests <3 - requests_ntlm <2 - lxml <5 - pyotp <3 - urllib3<1.30 - importlib_metadata;python_version<'3.8' - backoff<2.3 -[options.entry_points] -console_scripts = - stsauth=sts_auth.cli:cli - -[options.extras_require] -dist = - build - twine -dev = - ipython - ipdb - pylint -tests = - tox - mock - nose - flake8 - pytest - coverage - pytest-cov From 7563fffdefcfa78bbc87128fe5605931c8212d1c Mon Sep 17 00:00:00 2001 From: Phillip Ferentinos Date: Wed, 15 Oct 2025 09:16:43 -0500 Subject: [PATCH 3/4] ci(super-linter): update super-linter to v8.2.0, re-disable pyink --- .github/super-linter.env | 1 + .github/workflows/linter.yml | 2 +- Dockerfile | 2 +- super-linter.env | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/super-linter.env b/.github/super-linter.env index f3c0df6..cfade48 100644 --- a/.github/super-linter.env +++ b/.github/super-linter.env @@ -11,4 +11,5 @@ VALIDATE_HTML_PRETTIER=false VALIDATE_PYTHON_PYLINT=false VALIDATE_PYTHON_RUFF=false VALIDATE_PYTHON_ISORT=false +VALIDATE_PYTHON_PYINK=false VALIDATE_GIT_COMMITLINT=false \ No newline at end of file diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index bdd6123..877f038 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -29,6 +29,6 @@ jobs: # Ref: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable run: grep -v '^#' .github/super-linter.env >> "$GITHUB_ENV" - name: super-linter - uses: super-linter/super-linter/slim@v7.1.0 + uses: super-linter/super-linter/slim@v8.2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index 2be01fe..0f851e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update -y \ && apt-get install --no-install-recommends -y git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ - && pip install --upgrade pip \ + && pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir --group dist \ && python -m build diff --git a/super-linter.env b/super-linter.env index f0405c2..dc72507 100644 --- a/super-linter.env +++ b/super-linter.env @@ -12,6 +12,7 @@ VALIDATE_HTML_PRETTIER=false VALIDATE_PYTHON_PYLINT=false VALIDATE_PYTHON_RUFF=false VALIDATE_PYTHON_ISORT=false +VALIDATE_PYTHON_PYINK=false VALIDATE_GIT_COMMITLINT=false FIX_YAML_PRETTIER=true From 70abe7e6ec6dccd6d2c0d75380c60e3f860dcd0a Mon Sep 17 00:00:00 2001 From: Phillip Ferentinos Date: Wed, 15 Oct 2025 10:37:07 -0500 Subject: [PATCH 4/4] ci(super-linter): update super-linter and configuration --- .github/super-linter.env | 10 ++++++++-- .trivyignore.yaml | 7 +++++++ CHANGELOG.md | 2 +- sts_auth/cli.py | 2 +- super-linter.env | 10 ++++++++-- 5 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 .trivyignore.yaml diff --git a/.github/super-linter.env b/.github/super-linter.env index cfade48..218a28f 100644 --- a/.github/super-linter.env +++ b/.github/super-linter.env @@ -11,5 +11,11 @@ VALIDATE_HTML_PRETTIER=false VALIDATE_PYTHON_PYLINT=false VALIDATE_PYTHON_RUFF=false VALIDATE_PYTHON_ISORT=false -VALIDATE_PYTHON_PYINK=false -VALIDATE_GIT_COMMITLINT=false \ No newline at end of file +VALIDATE_PYTHON_RUFF_FORMAT=false +VALIDATE_GIT_COMMITLINT=false +VALIDATE_BIOME_FORMAT=false +VALIDATE_BIOME_LINT=false +VALIDATE_GITHUB_ACTIONS_ZIZMOR=false + +# Tool-specific configuration +TRIVY_IGNOREFILE=.trivyignore.yaml \ No newline at end of file diff --git a/.trivyignore.yaml b/.trivyignore.yaml new file mode 100644 index 0000000..00daf72 --- /dev/null +++ b/.trivyignore.yaml @@ -0,0 +1,7 @@ +misconfigurations: + - id: AVD-DS-0002 + paths: + - "Dockerfile" + - id: AVD-DS-0026 + paths: + - "Dockerfile" diff --git a/CHANGELOG.md b/CHANGELOG.md index 4831b5e..5f5534f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,7 +20,7 @@ ### Bugfixes -- **Dockerfile:** fix docker build ([d492181](https://github.com/cshamrick/stsauth/commit/d492181cf0e15cd50c303faf13d216322de2f4c4)) +- **Dockerfile:** fix Docker build ([d492181](https://github.com/cshamrick/stsauth/commit/d492181cf0e15cd50c303faf13d216322de2f4c4)) ### [1.0.1](https://github.com/cshamrick/stsauth/compare/v1.0.0...v1.0.1) (2021-07-29) diff --git a/sts_auth/cli.py b/sts_auth/cli.py index 627b671..0169f38 100644 --- a/sts_auth/cli.py +++ b/sts_auth/cli.py @@ -356,7 +356,7 @@ def prompt_for_role(account_map: Mapping[str, str], account_roles: collections.O if not role_selection_is_valid(selected_role_index, flat_roles): return prompt_for_role(account_map, account_roles) - role = next((v for v in flat_roles if int(v["num"]) == selected_role_index), None) + role = next((v for v in flat_roles if int(v["num"]) == selected_role_index), {}) utils.logger.debug("Selected Role: ") utils.logger.debug(role) diff --git a/super-linter.env b/super-linter.env index dc72507..d696c54 100644 --- a/super-linter.env +++ b/super-linter.env @@ -12,9 +12,15 @@ VALIDATE_HTML_PRETTIER=false VALIDATE_PYTHON_PYLINT=false VALIDATE_PYTHON_RUFF=false VALIDATE_PYTHON_ISORT=false -VALIDATE_PYTHON_PYINK=false +VALIDATE_PYTHON_RUFF_FORMAT=false VALIDATE_GIT_COMMITLINT=false +VALIDATE_BIOME_FORMAT=false +VALIDATE_BIOME_LINT=false +VALIDATE_GITHUB_ACTIONS_ZIZMOR=false FIX_YAML_PRETTIER=true FIX_MARKDOWN_PRETTIER=true -FIX_PYTHON_BLACK=true \ No newline at end of file +FIX_PYTHON_BLACK=true + +# Tool-specific configuration +TRIVY_IGNOREFILE=.trivyignore.yaml \ No newline at end of file