diff --git a/.copier-answers.yml b/.copier-answers.yml index dc6c0ac..116d653 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,6 +1,6 @@ # Autogenerated. Do not edit this by hand, use `copier update`. --- -_commit: 0.5.0 +_commit: 0.5.2 _src_path: https://github.com/lkubb/salt-extension-copier author: EITR Technologies, LLC author_email: devops@eitr.tech @@ -24,7 +24,7 @@ os_support: - Windows package_name: consul project_name: consul -python_requires: '3.8' +python_requires: '3.9' relax_pylint: true salt_version: '3006' source_url: https://github.com/salt-extensions/saltext-consul diff --git a/.github/workflows/deploy-docs-action.yml b/.github/workflows/deploy-docs-action.yml index d4bf10d..4a935b5 100644 --- a/.github/workflows/deploy-docs-action.yml +++ b/.github/workflows/deploy-docs-action.yml @@ -71,7 +71,7 @@ jobs: - name: Upload Exit Status if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: exitstatus-${{ github.job }} path: exitstatus diff --git a/.github/workflows/docs-action.yml b/.github/workflows/docs-action.yml index 8a5c751..8d284ec 100644 --- a/.github/workflows/docs-action.yml +++ b/.github/workflows/docs-action.yml @@ -10,7 +10,7 @@ jobs: timeout-minutes: 10 steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: fetch-depth: 0 @@ -35,7 +35,7 @@ jobs: nox --force-color -e docs - name: Upload built docs as artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: html-docs path: docs/_build/html @@ -48,7 +48,7 @@ jobs: - name: Upload Exit Status if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: exitstatus-${{ github.job }} path: exitstatus diff --git a/.github/workflows/get-changed-files.yml b/.github/workflows/get-changed-files.yml index 3e568c0..3d61e7e 100644 --- a/.github/workflows/get-changed-files.yml +++ b/.github/workflows/get-changed-files.yml @@ -17,7 +17,7 @@ jobs: changed-files: ${{ toJSON(steps.changed-files.outputs) }} steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Get Changed Files id: changed-files diff --git a/.github/workflows/package-action.yml b/.github/workflows/package-action.yml index 818b1aa..80b656c 100644 --- a/.github/workflows/package-action.yml +++ b/.github/workflows/package-action.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: fetch-depth: 0 @@ -38,7 +38,7 @@ jobs: run: python -m build --outdir dist/ - name: Upload build artifacts - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 if: always() with: name: salt-extension-${{ inputs.version }}-packages @@ -53,7 +53,7 @@ jobs: - name: Upload Exit Status if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: exitstatus-${{ github.job }} path: exitstatus diff --git a/.github/workflows/pre-commit-action.yml b/.github/workflows/pre-commit-action.yml index ebf639a..cbdfdb4 100644 --- a/.github/workflows/pre-commit-action.yml +++ b/.github/workflows/pre-commit-action.yml @@ -23,7 +23,7 @@ jobs: apt-get install -y enchant-2 git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev git config --global --add safe.directory "$(pwd)" - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Install Pre-Commit run: | @@ -49,7 +49,7 @@ jobs: - name: Upload Exit Status if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: exitstatus-${{ github.job }} path: exitstatus diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 33eded8..bb0bfa2 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -13,7 +13,7 @@ jobs: version: ${{ steps.get_version.outputs.version }} steps: - name: Checkout code - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - name: Extract tag name id: get_version diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml index 88242f3..81a30f7 100644 --- a/.github/workflows/test-action.yml +++ b/.github/workflows/test-action.yml @@ -12,16 +12,15 @@ jobs: strategy: fail-fast: false - max-parallel: 4 + max-parallel: 3 matrix: include: - - {salt-version: "3006.9", python-version: "3.8"} - {salt-version: "3006.9", python-version: "3.9"} - {salt-version: "3006.9", python-version: "3.10"} - {salt-version: "3007.1", python-version: "3.10"} steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: fetch-depth: 2 # coverage: Issue detecting commit SHA @@ -63,7 +62,7 @@ jobs: flags: ${{ steps.codecov-flags.outputs.flags }},project name: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project use_oidc: true - version: v0.7.5 + version: v0.7.6 - name: Upload Tests Code Coverage uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 @@ -74,11 +73,11 @@ jobs: flags: ${{ steps.codecov-flags.outputs.flags }},tests name: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests use_oidc: true - version: v0.7.5 + version: v0.7.6 - name: Upload Logs if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log path: artifacts/runtests-*.log @@ -91,7 +90,7 @@ jobs: - name: Upload Exit Status if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: exitstatus-${{ github.job }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }} path: exitstatus @@ -106,11 +105,11 @@ jobs: max-parallel: 2 matrix: include: - - {salt-version: "3006.9", python-version: "3.8"} - - {salt-version: "3007.1", python-version: "3.8"} + - {salt-version: "3006.9", python-version: "3.9"} + - {salt-version: "3007.1", python-version: "3.9"} steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: fetch-depth: 2 @@ -169,7 +168,7 @@ jobs: flags: ${{ steps.codecov-flags.outputs.flags }},project name: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project use_oidc: true - version: v0.7.5 + version: v0.7.6 - name: Upload Tests Code Coverage uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 @@ -180,11 +179,11 @@ jobs: flags: ${{ steps.codecov-flags.outputs.flags }},tests name: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests use_oidc: true - version: v0.7.5 + version: v0.7.6 - name: Upload Logs if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log path: artifacts/runtests-*.log @@ -197,7 +196,7 @@ jobs: - name: Upload Exit Status if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: exitstatus-${{ github.job }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }} path: exitstatus @@ -212,11 +211,11 @@ jobs: max-parallel: 2 matrix: include: - - {salt-version: "3006.9", python-version: "3.9"} + - {salt-version: "3006.9", python-version: "3.10"} - {salt-version: "3007.1", python-version: "3.10"} steps: - - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: fetch-depth: 2 @@ -258,7 +257,7 @@ jobs: flags: ${{ steps.codecov-flags.outputs.flags }},project name: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-project use_oidc: true - version: v0.7.5 + version: v0.7.6 - name: Upload Tests Code Coverage uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 @@ -269,11 +268,11 @@ jobs: flags: ${{ steps.codecov-flags.outputs.flags }},tests name: ${{ runner.os }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}-tests use_oidc: true - version: v0.7.5 + version: v0.7.6 - name: Upload Logs if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: runtests-${{ runner.os }}-py${{ matrix.python-version }}-Salt${{ matrix.salt-version }}.log path: artifacts/runtests-*.log @@ -286,7 +285,7 @@ jobs: - name: Upload Exit Status if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: exitstatus-${{ github.job }}-Py${{ matrix.python-version }}-Salt${{ matrix.salt-version }} path: exitstatus diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8a05cb4..ab2ecf0 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,9 +59,9 @@ repos: rev: 32151ac97cbfd7f9dcd22e49516fb32266db45b4 # v3.16.0 hooks: - id: pyupgrade - name: Rewrite Code to be Py3.8+ + name: Rewrite Code to be Py3.9+ args: [ - --py38-plus, + --py39-plus, ] exclude: src/saltext/consul/version.py @@ -70,25 +70,25 @@ repos: hooks: - id: isort args: [ - --py 38, + --py 39, ] exclude: src/saltext/consul/(__init__|version).py - repo: https://github.com/psf/black - rev: b965c2a5026f8ba399283ba3e01898b012853c79 # 24.8.0 + rev: 1b2427a2b785cc4aac97c19bb4b9a0de063f9547 # 24.10.0 hooks: - id: black args: [-l 100] exclude: src/saltext/consul/version.py - repo: https://github.com/adamchainz/blacken-docs - rev: 4c97c4a0d921007af6fefae92d8447cfbf63720b # 1.18.0 + rev: d4e2940d27621c7f20215459be05703947618b7b # 1.19.0 hooks: - id: blacken-docs args: [--skip-errors] files: ^(docs/.*\.rst|src/saltext/consul/.*\.py)$ additional_dependencies: - - black==24.8.0 + - black==24.10.0 # <---- Formatting ----------------------------------------------------------------------------- # ----- Security ------------------------------------------------------------------------------> @@ -123,8 +123,8 @@ repos: files: ^((setup|noxfile)|src/.*)\.py$ require_serial: true additional_dependencies: - - nox==2024.4.15 - - uv==0.4.18 # Makes this hook much faster + - nox==2024.10.9 + - uv==0.4.22 # Makes this hook much faster - id: nox alias: lint-tests @@ -134,8 +134,8 @@ repos: files: ^tests/.*\.py$ require_serial: true additional_dependencies: - - nox==2024.4.15 - - uv==0.4.18 # Makes this hook much faster + - nox==2024.10.9 + - uv==0.4.22 # Makes this hook much faster - repo: https://github.com/Mateusz-Grzelinski/actionlint-py rev: 27445053da613c660ed5895d9616662059a53ca7 # v1.7.3.17 diff --git a/.pylintrc b/.pylintrc index 55234bc..58685c0 100755 --- a/.pylintrc +++ b/.pylintrc @@ -93,7 +93,7 @@ prefer-stubs=no # Minimum Python version to use for version dependent checks. Will default to # the version used to run pylint. -py-version=3.8 +py-version=3.9 # Discover python modules and packages in the file system subtree. recursive=no diff --git a/noxfile.py b/noxfile.py index acddd9c..8fe9a8e 100755 --- a/noxfile.py +++ b/noxfile.py @@ -21,7 +21,7 @@ nox.options.default_venv_backend = "uv|virtualenv" # Python versions to test against -PYTHON_VERSIONS = ("3", "3.8", "3.9", "3.10") +PYTHON_VERSIONS = ("3", "3.9", "3.10") # Be verbose when running under a CI context CI_RUN = ( os.environ.get("JENKINS_URL") or os.environ.get("CI") or os.environ.get("DRONE") is not None @@ -30,7 +30,7 @@ SKIP_REQUIREMENTS_INSTALL = os.environ.get("SKIP_REQUIREMENTS_INSTALL", "0") == "1" EXTRA_REQUIREMENTS_INSTALL = os.environ.get("EXTRA_REQUIREMENTS_INSTALL") -COVERAGE_REQUIREMENT = os.environ.get("COVERAGE_REQUIREMENT") or "coverage==7.6.1" +COVERAGE_REQUIREMENT = os.environ.get("COVERAGE_REQUIREMENT") or "coverage==7.6.3" SALT_REQUIREMENT = os.environ.get("SALT_REQUIREMENT") or "salt>=3006" if SALT_REQUIREMENT == "salt==master": SALT_REQUIREMENT = "git+https://github.com/saltstack/salt.git@master" @@ -72,8 +72,8 @@ def _get_session_python_version_info(session): def _get_pydir(session): version_info = _get_session_python_version_info(session) - if version_info < (3, 8): - session.error("Only Python >= 3.8 is supported") + if version_info < (3, 9): + session.error("Only Python >= 3.9 is supported") return f"py{version_info[0]}.{version_info[1]}" diff --git a/pyproject.toml b/pyproject.toml index 29f2b98..e497b62 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,14 +25,13 @@ classifiers = [ "Programming Language :: Cython", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", ] -requires-python = ">= 3.8" +requires-python = ">= 3.9" dynamic = ["version"] dependencies = [ "salt>=3006", diff --git a/tests/functional/cache/helpers.py b/tests/functional/cache/helpers.py index a6f4d4b..68dbadd 100644 --- a/tests/functional/cache/helpers.py +++ b/tests/functional/cache/helpers.py @@ -128,10 +128,13 @@ def run_common_cache_tests(subtests, cache): assert before_storage <= timestamp <= after_storage with subtests.test("If the module raises SaltCacheError then it should make it out of updated"): - with patch.dict( - cache.modules._dict, - {f"{cache.driver}.updated": MagicMock(side_effect=SaltCacheError)}, - ), pytest.raises(SaltCacheError): + with ( + patch.dict( + cache.modules._dict, + {f"{cache.driver}.updated": MagicMock(side_effect=SaltCacheError)}, + ), + pytest.raises(SaltCacheError), + ): cache.updated(bank="kaboom", key="oops") with subtests.test("cache.cache right after a value is cached should not update the cache"): @@ -148,12 +151,15 @@ def run_common_cache_tests(subtests, cache): assert result == fetch_result == expected_value - with subtests.test( - "cache.cache should update the value with the result of fun when value was updated longer than expiration", - ), patch( - "salt.cache.Cache.updated", - return_value=42, # Dec 31, 1969... time to update the cache! - autospec=True, + with ( + subtests.test( + "cache.cache should update the value with the result of fun when value was updated longer than expiration", + ), + patch( + "salt.cache.Cache.updated", + return_value=42, # Dec 31, 1969... time to update the cache! + autospec=True, + ), ): expected_value = "this is the return value woo woo woo" cache.store(bank=bank, key=good_key, data="not this value") @@ -164,12 +170,15 @@ def run_common_cache_tests(subtests, cache): assert cache_result == fetch_result == expected_value - with subtests.test( - "cache.cache should update the value with all of the outputs from loop_fun if loop_fun was provided", - ), patch( - "salt.cache.Cache.updated", - return_value=42, - autospec=True, + with ( + subtests.test( + "cache.cache should update the value with all of the outputs from loop_fun if loop_fun was provided", + ), + patch( + "salt.cache.Cache.updated", + return_value=42, + autospec=True, + ), ): expected_value = "SOME HUGE STRING OKAY?" @@ -185,12 +194,15 @@ def run_common_cache_tests(subtests, cache): assert cache_result == fetch_result assert "".join(fetch_result) == expected_value - with subtests.test( - "cache.cache should update the value if the stored value is empty but present and expiry is way in the future" - ), patch( - "salt.cache.Cache.updated", - return_value=time.time() * 2, - autospec=True, + with ( + subtests.test( + "cache.cache should update the value if the stored value is empty but present and expiry is way in the future" + ), + patch( + "salt.cache.Cache.updated", + return_value=time.time() * 2, + autospec=True, + ), ): # Unclear if this was intended behavior: currently any falsey data will # be updated by cache.cache. If this is incorrect, this test should