Skip to content

Commit

Permalink
Upgrade pynamodb alejandroroiz (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandroroiz authored Dec 18, 2023
1 parent 7236b90 commit d3c8239
Show file tree
Hide file tree
Showing 14 changed files with 243 additions and 74 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.5.1
6.5.2
7 changes: 3 additions & 4 deletions confidant/models/blind_credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from pynamodb.indexes import GlobalSecondaryIndex, AllProjection

from confidant import settings
from confidant.models.session_cls import DDBSession
from confidant.models.connection_cls import DDBConnection
from confidant.models.non_null_unicode_set_attribute import (
NonNullUnicodeSetAttribute
)
Expand All @@ -33,8 +31,9 @@ class Meta:
if settings.DYNAMODB_URL:
host = settings.DYNAMODB_URL
region = settings.AWS_DEFAULT_REGION
connection_cls = DDBConnection
session_cls = DDBSession
connect_timeout_seconds = settings.PYNAMO_CONNECT_TIMEOUT_SECONDS
read_timeout_seconds = settings.PYNAMO_READ_TIMEOUT_SECONDS
max_pool_connection = settings.PYNAMO_CONNECTION_POOL_SIZE

id = UnicodeAttribute(hash_key=True)
revision = NumberAttribute()
Expand Down
10 changes: 0 additions & 10 deletions confidant/models/connection_cls.py

This file was deleted.

12 changes: 6 additions & 6 deletions confidant/models/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
from pynamodb.indexes import GlobalSecondaryIndex, AllProjection

from confidant import settings
from confidant.models.session_cls import DDBSession
from confidant.models.connection_cls import DDBConnection
from confidant.services import keymanager
from confidant.services.ciphermanager import CipherManager

Expand Down Expand Up @@ -64,8 +62,9 @@ class Meta:
if settings.DYNAMODB_URL:
host = settings.DYNAMODB_URL
region = settings.AWS_DEFAULT_REGION
connection_cls = DDBConnection
session_cls = DDBSession
connect_timeout_seconds = settings.PYNAMO_CONNECT_TIMEOUT_SECONDS
read_timeout_seconds = settings.PYNAMO_READ_TIMEOUT_SECONDS
max_pool_connection = settings.PYNAMO_CONNECTION_POOL_SIZE

data_type_date_index = DataTypeDateIndex()

Expand Down Expand Up @@ -237,8 +236,9 @@ class Meta:
if settings.DYNAMODB_URL:
host = settings.DYNAMODB_URL
region = settings.AWS_DEFAULT_REGION
connection_cls = DDBConnection
session_cls = DDBSession
connect_timeout_seconds = settings.PYNAMO_CONNECT_TIMEOUT_SECONDS
read_timeout_seconds = settings.PYNAMO_READ_TIMEOUT_SECONDS
max_pool_connection = settings.PYNAMO_CONNECTION_POOL_SIZE

archive_date = UTCDateTimeAttribute(default=datetime.now)
data_type_date_index = ArchiveDataTypeDateIndex()
Expand Down
7 changes: 3 additions & 4 deletions confidant/models/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from pynamodb.indexes import GlobalSecondaryIndex, AllProjection

from confidant import settings
from confidant.models.session_cls import DDBSession
from confidant.models.connection_cls import DDBConnection
from confidant.models.non_null_unicode_set_attribute import (
NonNullUnicodeSetAttribute
)
Expand All @@ -32,8 +30,9 @@ class Meta:
if settings.DYNAMODB_URL:
host = settings.DYNAMODB_URL
region = settings.AWS_DEFAULT_REGION
connection_cls = DDBConnection
session_cls = DDBSession
connect_timeout_seconds = settings.PYNAMO_CONNECT_TIMEOUT_SECONDS
read_timeout_seconds = settings.PYNAMO_READ_TIMEOUT_SECONDS
max_pool_connection = settings.PYNAMO_CONNECTION_POOL_SIZE

id = UnicodeAttribute(hash_key=True)
data_type = UnicodeAttribute()
Expand Down
15 changes: 0 additions & 15 deletions confidant/models/session_cls.py

This file was deleted.

7 changes: 3 additions & 4 deletions confidant/scripts/migrate_bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from pynamodb.models import Model

from confidant import settings
from confidant.models.session_cls import DDBSession
from confidant.models.connection_cls import DDBConnection

logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler(sys.stdout))
Expand All @@ -27,8 +25,9 @@ class Meta:
if settings.DYNAMODB_URL:
host = settings.DYNAMODB_URL
region = settings.AWS_DEFAULT_REGION
connection_cls = DDBConnection
session_cls = DDBSession
connect_timeout_seconds = settings.PYNAMO_CONNECT_TIMEOUT_SECONDS
read_timeout_seconds = settings.PYNAMO_READ_TIMEOUT_SECONDS
max_pool_connection = settings.PYNAMO_CONNECTION_POOL_SIZE
id = UnicodeAttribute(hash_key=True)
enabled = BooleanAttribute(default=True)

Expand Down
3 changes: 2 additions & 1 deletion confidant/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ def str_env(var_name, default=''):
DYNAMODB_CREATE_TABLE = bool_env('DYNAMODB_CREATE_TABLE', False)
# Connection pool size for PynamoDB connections to DynamoDB
PYNAMO_CONNECTION_POOL_SIZE = int_env('PYNAMO_CONNECTION_POOL_SIZE', 100)
PYNAMO_REQUEST_TIMEOUT_SECONDS = int_env('PYNAMO_REQUEST_TIMEOUT_SECONDS', 1)
PYNAMO_CONNECT_TIMEOUT_SECONDS = int_env('PYNAMO_CONNECT_TIMEOUT_SECONDS', 1)
PYNAMO_READ_TIMEOUT_SECONDS = int_env('PYNAMO_READ_TIMEOUT_SECONDS', 1)
# page limit size for history API endpoints listing
HISTORY_PAGE_LIMIT = int_env('HISTORY_PAGE_LIMIT')
if HISTORY_PAGE_LIMIT == 0:
Expand Down
3 changes: 2 additions & 1 deletion docs/root/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ request that could be general networking failures, attempting to avoid request
pileups. If this setting is too aggressive, you can adjust it via:

```
export PYNAMO_REQUEST_TIMEOUT_SECONDS=1
export PYNAMO_CONNECT_TIMEOUT_SECONDS=1
export PYNAMO_READ_TIMEOUT_SECONDS=1
```

To avoid recreating connections to dynamodb on each request, we open a larger
Expand Down
4 changes: 2 additions & 2 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ boto3==1.9.227
# License: MIT
# Upstream url: http://jlafon.io/pynamodb.html
# Use: For DynamoDB storage
pynamodb>=3.2.1,<4
pynamodb==5.5.1

# cryptography is a package which provides cryptographic recipes and
# primitives to Python developers.
Expand Down Expand Up @@ -143,7 +143,7 @@ statsd
# License: Apache2
# Upstream url: https://github.com/lyft/python-kmsauth
# Use: kmsauth support library
kmsauth==0.6.2
kmsauth==0.6.3

# License: Apache2
# Upstream url: https://pypi.python.org/pypi/toasted-marshmallow
Expand Down
219 changes: 219 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# cd ~/src/confidant-private/upstream && run-piptools
#
async-timeout==4.0.2
# via redis
attrs==23.1.0
# via toastedmarshmallow
authomatic==1.2.1
# via -r requirements.in
blinker==1.6.2
# via -r requirements.in
boto3==1.9.227
# via
# -r requirements.in
# kmsauth
botocore==1.12.227
# via
# -r requirements.in
# boto3
# pynamodb
# s3transfer
cachetools==5.2.0
# via -r requirements.in
cerberus==1.3.4
# via -r requirements.in
certifi==2023.5.7
# via requests
cffi==1.15.1
# via
# -r requirements.in
# cryptography
charset-normalizer==3.1.0
# via requests
click==7.1.2
# via flask
coverage[toml]==7.2.7
# via pytest-cov
cryptography==41.0.1
# via
# -r requirements.in
# jwcrypto
# pyopenssl
# types-pyopenssl
# types-redis
deprecated==1.2.14
# via jwcrypto
docutils==0.15.2
# via botocore
exceptiongroup==1.1.1
# via pytest
fakeredis==2.17.0
# via -r requirements.in
flask==1.1.4
# via
# -r requirements.in
# flask-script
# flask-session
# flask-sslify
flask-script==2.0.5
# via -r requirements.in
flask-session==0.2.3
# via -r requirements.in
flask-sslify==0.1.5
# via -r requirements.in
gevent==22.10.2
# via
# -r requirements.in
# pytest-gevent
greenlet==2.0.2
# via
# -r requirements.in
# gevent
guard==1.0.1
# via -r requirements.in
gunicorn==20.1.0
# via -r requirements.in
idna==3.4
# via requests
iniconfig==2.0.0
# via pytest
isodate==0.6.1
# via python3-saml
itsdangerous==1.1.0
# via flask
jinja2==2.11.3
# via flask
jmespath==0.10.0
# via
# boto3
# botocore
jwcrypto==1.5.0
# via -r requirements.in
kmsauth==0.6.3
# via -r requirements.in
lru-dict==1.2.0
# via -r requirements.in
lxml==4.9.2
# via
# python3-saml
# xmlsec
markupsafe==2.0.1
# via jinja2
mypy==1.4.1
# via -r requirements.in
mypy-extensions==1.0.0
# via mypy
ndg-httpsclient==0.5.1
# via -r requirements.in
packaging==23.1
# via pytest
pluggy==1.2.0
# via pytest
pyasn1==0.5.0
# via
# -r requirements.in
# ndg-httpsclient
pycparser==2.21
# via cffi
pyjwt==2.7.0
# via -r requirements.in
pynamodb==5.5.1
# via -r requirements.in
pyopenssl==23.2.0
# via
# -r requirements.in
# ndg-httpsclient
pytest==7.4.0
# via
# -r requirements.in
# pytest-cov
# pytest-env
# pytest-gevent
# pytest-lazy-fixture
# pytest-mock
pytest-cov==4.1.0
# via -r requirements.in
pytest-env==0.8.2
# via -r requirements.in
pytest-gevent==1.1.0
# via -r requirements.in
pytest-lazy-fixture==0.6.3
# via -r requirements.in
pytest-mock==3.11.1
# via -r requirements.in
python-dateutil==2.8.2
# via botocore
python-json-logger==2.0.7
# via -r requirements.in
python3-saml==1.15.0
# via -r requirements.in
pytz==2023.3
# via -r requirements.in
pyyaml==6.0
# via -r requirements.in
redis==4.6.0
# via
# -r requirements.in
# fakeredis
requests==2.31.0
# via -r requirements.in
s3transfer==0.2.1
# via boto3
six==1.16.0
# via
# isodate
# python-dateutil
sortedcontainers==2.4.0
# via fakeredis
statsd==4.0.1
# via -r requirements.in
toastedmarshmallow==2.15.2.post1
# via -r requirements.in
tomli==2.0.1
# via
# coverage
# mypy
# pytest
types-pyopenssl==23.2.0.1
# via types-redis
types-pytz==2023.3.0.0
# via -r requirements.in
types-pyyaml==6.0.12.10
# via -r requirements.in
types-redis==4.6.0.0
# via -r requirements.in
types-requests==2.31.0.1
# via -r requirements.in
types-urllib3==1.26.25.13
# via types-requests
typing-extensions==4.7.0
# via mypy
urllib3==1.25.11
# via
# botocore
# requests
werkzeug==1.0.1
# via flask
wrapt==1.15.0
# via deprecated
xmlsec==1.3.13
# via python3-saml
zope-event==5.0
# via gevent
zope-interface==6.0
# via gevent

pip==23.1.2
# via -r piptools_requirements.txt
setuptools==68.0.0
# via
# -r piptools_requirements.txt
# cerberus
# gevent
# gunicorn
# zope-event
# zope-interface
Loading

0 comments on commit d3c8239

Please sign in to comment.