Skip to content

Commit

Permalink
Merge pull request #88 from cuenca-mx/update/py3-13-deps
Browse files Browse the repository at this point in the history
Update/py3 13 deps
  • Loading branch information
pachCode authored Jan 15, 2025
2 parents b8c5874 + d7184bb commit 0f34f85
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 44 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@master
- name: Set up Python 3.8
uses: actions/setup-python@v2.2.2
- uses: actions/checkout@v4
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.13
- name: Install dependencies
run: pip install -qU setuptools wheel twine
- name: Generating distribution archives
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.13
- name: Install dependencies
run: make install-test
- name: Lint
Expand All @@ -20,11 +20,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand All @@ -38,11 +38,11 @@ jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v2.2.2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.13
- name: Install dependencies
run: make install-test
- name: Generate coverage report
Expand All @@ -51,9 +51,9 @@ jobs:
export SSL_CERT_FILE=$(pwd)/tests/localhost.crt
pytest --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.5.0
uses: codecov/codecov-action@v5
with:
token: 1455e721-304d-43a9-b346-bcdacfac6631
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SHELL := bash
PATH := ./venv/bin:${PATH}
PYTHON = python3.8
PYTHON = python3.13
PROJECT = mongoengine_plus
isort = isort $(PROJECT) tests setup.py
black = black -S -l 79 --target-version py38 $(PROJECT) tests setup.py
black = black -S -l 79 --target-version py313 $(PROJECT) tests setup.py


venv:
Expand Down
2 changes: 1 addition & 1 deletion mongoengine_plus/types/encrypted_string/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def cache_kms_data_key(
content = (
'{'
'"EncryptionAlgorithm":"SYMMETRIC_DEFAULT",'
f'"Plaintext":"{decrypted_data_key}"'
f'"Plaintext": "{decrypted_data_key}"'
'}'
)

Expand Down
4 changes: 2 additions & 2 deletions mongoengine_plus/types/enum_field.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from enum import Enum
from typing import Type
from typing import Any, Type, Union

from mongoengine.base import BaseField

Expand All @@ -18,7 +18,7 @@ def __init__(self, enum: Type[Enum], *args, **kwargs):
kwargs['choices'] = [choice for choice in enum]
super(EnumField, self).__init__(*args, **kwargs)

def __get_value(self, enum: Enum) -> str:
def __get_value(self, enum: Enum) -> Union[str, Any]:
return enum.value if hasattr(enum, 'value') else enum

def to_python(self, value: Enum) -> Enum: # pragma: no cover
Expand Down
2 changes: 1 addition & 1 deletion mongoengine_plus/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.2.2'
__version__ = '1.0.0'
20 changes: 10 additions & 10 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
black==22.3.0
flake8==3.9.*
isort==5.8.*
mypy==0.812
moto[server,kms]==5.0.8
pytest==6.2.*
pytest-asyncio==0.15.1
pytest-cov==2.12.*
pytest-freezegun==0.4.*
testcontainers==3.7.1
black==24.10.0
flake8==7.1.1
isort==5.13.2
mypy==1.14.1
moto[server,kms]==5.0.26
pytest==8.3.4
pytest-asyncio==0.25.2
pytest-cov==6.0.0
pytest-freezegun==0.4.2
testcontainers==4.9.0
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
blinker==1.8.2
dnspython==2.1.0
mongoengine==0.27.0
blinker==1.9.0
dnspython==2.7.0
mongoengine==0.29.1
pymongo==3.13.0
pymongocrypt==1.9.2
boto3==1.34.106
pymongocrypt==1.12.2
boto3==1.35.95
18 changes: 11 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@
packages=find_packages(),
include_package_data=True,
package_data=dict(mongoengine_plus=['py.typed']),
python_requires='>=3.8',
python_requires='>=3.9',
install_requires=[
'mongoengine>=0.20.0',
'dnspython>=2.0.0,<2.2.0',
'pymongo>=3.11.0,<4.0.0',
'pymongocrypt>=1.9.2,<2.0.0',
'boto3>=1.34.106',
'mongoengine>=0.29.1',
'dnspython>=2.7.0',
'pymongo>=3.13.0,<4.0.0',
'pymongocrypt>=1.12.2,<2.0.0',
'boto3>=1.34.106,<1.35.96',
],
classifiers=[
'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',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
Expand Down
5 changes: 5 additions & 0 deletions tests/models/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,8 @@ def test_mongo_to_dict():
'lastname': 'other',
}
assert model_dict['code'] == 0


def test_mongo_to_dict_with_none():
result = mongo_to_dict(None)
assert result == {}
2 changes: 1 addition & 1 deletion tests/types/test_encrypted_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_encrypted_string_on_saving_and_reading(

assert user_dict['_id'] == user.id
assert user_dict['name'] == user.name
assert type(user_dict['ssn']) == Binary
assert isinstance(user_dict['ssn'], Binary)

with ClientEncryption(
EncryptedStringField.kms_provider,
Expand Down

0 comments on commit 0f34f85

Please sign in to comment.