Skip to content

Bump actions/setup-python from 4 to 5 #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,24 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8
pip install -r requirements.txt -r dev-requirements.txt
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# exit-zero treats all errors as warnings.
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Lint with PyLint
run: pylint --rcfile=.pylintrc src/aws_secretsmanager_caching
- name: Test with pytest
run: |
pytest test/unit/
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ To use this client you must have:
This library requires the following standard dependencies:
* botocore
* setuptools_scm
* setuptools

For development and testing purposes, this library requires the following additional dependencies:
* pytest
Expand All @@ -31,6 +32,8 @@ For development and testing purposes, this library requires the following additi
* codecov
* pylint
* sphinx
* flake8
* tox

Please review the `requirements.txt` and `dev-requirements.txt` file for specific version requirements.

Expand Down
8 changes: 5 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
pytest
pytest-cov
pytest-sugar
pytest>=8
pytest-cov>=5
pytest-sugar>=1
codecov>=1.4.0
pylint>1.9.4
sphinx>=1.8.4
tox>=4
flake8>=7
5 changes: 2 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from importlib.metadata import version
from datetime import datetime
from pkg_resources import get_distribution
import os
import shutil

version = get_distribution('aws_secretsmanager_caching').version
project = u'AWS Secrets Manager Python Caching Client'

# If you use autosummary, this ensures that any stale autogenerated files are
Expand Down Expand Up @@ -32,7 +31,7 @@
copyright = u'%s, Amazon.com' % datetime.now().year

# The full version, including alpha/beta/rc tags.
release = version
release = version('aws_secretsmanager_caching')

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
botocore>=1.12
setuptools_scm>=3.2
setuptools>=69
2 changes: 1 addition & 1 deletion src/aws_secretsmanager_caching/cache/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_secret_value(self, version_stage=None):
if not value and self._exception:
raise self._exception
return deepcopy(value)

def refresh_secret_now(self):
"""Force a refresh of the cached secret.
:rtype: None
Expand Down
6 changes: 3 additions & 3 deletions src/aws_secretsmanager_caching/secret_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"""High level AWS Secrets Manager caching client."""
from copy import deepcopy

from importlib.metadata import version, PackageNotFoundError
import botocore.config
import botocore.session
from pkg_resources import DistributionNotFound, get_distribution

from .cache import LRUCache, SecretCacheItem
from .config import SecretCacheConfig
Expand All @@ -25,8 +25,8 @@ class SecretCache:
"""Secret Cache client for AWS Secrets Manager secrets"""

try:
__version__ = get_distribution('aws_secretsmanager_caching').version
except DistributionNotFound:
__version__ = version('aws_secretsmanager_caching')
except PackageNotFoundError:
__version__ = '0.0.0'

def __init__(self, config=SecretCacheConfig(), client=None):
Expand Down
10 changes: 6 additions & 4 deletions test/unit/test_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ def test_refresh_now(self):

ttl = config.secret_refresh_interval

# New refresh time will use the ttl and will be less than the old refresh time that was artificially set a month ahead
# The new refresh time will be between now + ttl and now + (ttl / 2) if the secret was immediately refreshed
self.assertTrue(new_refresh_time < old_refresh_time and new_refresh_time < datetime.now(timezone.utc) + timedelta(ttl))
# New refresh time will use the ttl and will be less than the old refresh time
# that was artificially set a month ahead
# The new refresh time will be between now + ttl and now + (ttl / 2)
# if the secret was immediately refreshed
self.assertTrue(new_refresh_time < old_refresh_time
and new_refresh_time < datetime.now(timezone.utc) + timedelta(ttl))


def test_datetime_fix_is_refresh_needed(self):
secret_cached_object = TestSecretCacheObject.TestObject(SecretCacheConfig(), None, None)

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


[tox]
envlist = py36, py37, flake8, pylint
envlist = py38, py39, py310, py311, py312, flake8, pylint
skip_missing_interpreters = true

[testenv]
Expand Down
Loading