diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c298020..1412335 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: tests: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] os: [ubuntu] fail-fast: true runs-on: ${{ matrix.os }}-latest diff --git a/config/_config.py b/config/_config.py index ecc0200..872a00f 100644 --- a/config/_config.py +++ b/config/_config.py @@ -51,7 +51,7 @@ def merge_list(config: dict) -> None: config.pop(f"{key}[{i}]") -def _merge(config: dict): +def _merge(config: dict) -> None: merge_list(config) for k, v in config.items(): merge_list(config[k]) diff --git a/config/auth.py b/config/auth.py index 9cb5642..55de652 100644 --- a/config/auth.py +++ b/config/auth.py @@ -1,3 +1,5 @@ +from typing import Dict + from attrs import field, mutable, validators from requests.auth import HTTPBasicAuth from requests.exceptions import HTTPError, MissingSchema @@ -28,7 +30,7 @@ def token(self, value) -> None: logger.debug(f"set: [access_token='{self._token}']") @property - def authorization_header(self) -> dict: + def authorization_header(self) -> Dict[str, str]: return {"Authorization": f"Bearer {self.token}"} def request_token(self, client_auth: HTTPBasicAuth, data: dict, **kwargs) -> None: diff --git a/config/spring.py b/config/spring.py index ea721d6..904a4fd 100644 --- a/config/spring.py +++ b/config/spring.py @@ -1,11 +1,10 @@ """Module for retrieve application's config from Spring Cloud Config.""" import asyncio import os -from distutils.util import strtobool from functools import partial, wraps from typing import Any, Callable, Dict, KeysView, Optional, Tuple -from attrs import field, fields_dict, mutable, validators +from attrs import converters, field, fields_dict, mutable, validators from glom import glom from . import http @@ -36,10 +35,10 @@ class ConfigClient: default=os.getenv("PROFILE", "development"), validator=validators.instance_of(str), ) - fail_fast: bool = field( - default=bool(strtobool(str(os.getenv("CONFIG_FAIL_FAST", True)))), + fail_fast: bool = field( # type: ignore + default=os.getenv("CONFIG_FAIL_FAST", True), validator=validators.instance_of(bool), - converter=bool, + converter=converters.to_bool, ) oauth2: Optional[OAuth2] = field( default=None, @@ -188,7 +187,7 @@ def decrypt( return response.text @property - def config(self) -> Dict: + def config(self) -> dict: """Getter from configurations retrieved from ConfigClient.""" return self._config diff --git a/setup.cfg b/setup.cfg index dca35f5..eb9da0c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,6 +30,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy Topic :: Software Development :: Libraries @@ -84,7 +85,7 @@ warn_unused_ignores = True warn_unreachable = True [tox:tox] -envlist = py{37,38,39,310,311},pypy{3.6,3.7,3.8,3.9,3.10} +envlist = py{37,38,39,310,311,312},pypy{3.8,3.9,3.10} [testenv] deps = -rrequirements-dev.txt