From aeca28ded04c4d6b1dd73d211c51bb7bc051774b Mon Sep 17 00:00:00 2001 From: gabino Date: Mon, 30 Dec 2024 18:56:15 -0600 Subject: [PATCH] Update Python version to 3.13, adjust dependencies --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 6 +++--- Makefile | 4 ++-- cuenca/exc.py | 9 ++++----- cuenca/resources/transfers.py | 2 +- examples/batch_transfers.py | 3 +-- requirements-test.txt | 5 ++--- requirements.txt | 1 - setup.py | 14 +++++++++----- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d232cd7..f7111646 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,10 +7,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2.4.0 - - name: Set up Python 3.8 + - name: Set up Python 3.13 uses: actions/setup-python@v2.3.1 with: - python-version: 3.8 + python-version: 3.13 - name: Install dependencies run: pip install -qU setuptools wheel twine - name: Generating distribution archives diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 121089b3..dacda387 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5.1.0 with: - python-version: 3.8 + python-version: 3.13 - name: Install dependencies run: make install-test - name: Lint @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -39,7 +39,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v5.1.0 with: - python-version: 3.8 + python-version: 3.13 - name: Install dependencies run: make install-test - name: Generate coverage report diff --git a/Makefile b/Makefile index f62d6cf1..2bc05db5 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ SHELL := bash PATH := ./venv/bin:${PATH} -PYTHON = python3.8 +PYTHON = python3.13 PROJECT = cuenca isort = isort $(PROJECT) tests setup.py examples -black = black -S -l 79 --target-version py38 $(PROJECT) tests setup.py examples +black = black -S -l 79 --target-version py313 $(PROJECT) tests setup.py examples all: test diff --git a/cuenca/exc.py b/cuenca/exc.py index e73a93c8..9c2d5c7d 100644 --- a/cuenca/exc.py +++ b/cuenca/exc.py @@ -1,5 +1,3 @@ -from dataclasses import dataclass - from cuenca_validations.typing import DictStrAny @@ -19,10 +17,11 @@ class MultipleResultsFound(CuencaException): """One result was expected but multiple were returned""" -@dataclass class CuencaResponseException(CuencaException): - json: DictStrAny - status_code: int + def __init__(self, json: DictStrAny, status_code: int) -> None: + self.json = json + self.status_code = status_code + super().__init__() def __str__(self) -> str: return repr(self) diff --git a/cuenca/resources/transfers.py b/cuenca/resources/transfers.py index 2ec50188..01a2e40b 100644 --- a/cuenca/resources/transfers.py +++ b/cuenca/resources/transfers.py @@ -91,4 +91,4 @@ def _gen_idempotency_key(account_number: str, amount: int) -> str: idempotency_key, but this provides some level of protection against submitting duplicate transfers """ - return f'{dt.datetime.utcnow().date()}:{account_number}:{amount}' + return f'{dt.datetime.utcnow().date()}: {account_number}: {amount}' diff --git a/examples/batch_transfers.py b/examples/batch_transfers.py index b2a33c5c..8730f015 100644 --- a/examples/batch_transfers.py +++ b/examples/batch_transfers.py @@ -1,7 +1,6 @@ import argparse import csv import logging -from dataclasses import fields from cuenca.resources.transfers import Transfer, TransferRequest @@ -25,7 +24,7 @@ def main(): transfer_requests = [TransferRequest(**line) for line in reader] transfers = Transfer.create_many(transfer_requests) with open(args.output, 'w') as f: - fieldnames = [field.name for field in fields(Transfer)] + fieldnames = list(transfers['submitted'][0].to_dict().keys()) writer = csv.DictWriter(f, fieldnames) writer.writeheader() for tr in transfers['submitted']: diff --git a/requirements-test.txt b/requirements-test.txt index 9d96fdb3..1953f3c0 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,4 +1,4 @@ -black==22.8.0 +black==24.10.0 flake8==5.0.4 freezegun==1.5.1 isort==5.11.5 @@ -9,5 +9,4 @@ pytest-vcr==1.0.* requests-mock==1.9.* types-freezegun==1.1.7 types-requests -#vcrpy==6.0.2 -git+https://github.com/kevin1024/vcrpy.git@master +vcrpy==7.0.0 diff --git a/requirements.txt b/requirements.txt index f329c548..0670b41a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ requests==2.32.3 cuenca-validations==2.0.0.dev8 -dataclasses>=0.7;python_version<"3.7" pydantic-extra-types==2.10.* \ No newline at end of file diff --git a/setup.py b/setup.py index 36c728e9..657b1cc9 100644 --- a/setup.py +++ b/setup.py @@ -21,14 +21,18 @@ packages=find_packages(), include_package_data=True, package_data=dict(cuenca=['py.typed']), - python_requires='>=3.8', + python_requires='>=3.9', install_requires=[ - 'requests>=2.24,<28', - 'dataclasses>=0.7;python_version<"3.8"', - 'cuenca-validations>= 0.11.3,<0.12.0', + 'requests>=2.32.3', + 'cuenca-validations>=2.0.0', + 'pydantic-extra-types>=2.10.1', ], 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', ],