From c1891109aae51c6e5573781eaf7e773c7805b25b Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Wed, 24 Jan 2024 17:36:54 +0100 Subject: [PATCH] Migrate dataclasses-json to mashumaro (#77) --- aioelectricitymaps/__init__.py | 11 +- aioelectricitymaps/electricitymaps.py | 16 ++- aioelectricitymaps/marshmallow.py | 23 ---- aioelectricitymaps/models.py | 61 ++++++---- poetry.lock | 168 ++++++++++++-------------- pyproject.toml | 15 ++- 6 files changed, 144 insertions(+), 150 deletions(-) delete mode 100644 aioelectricitymaps/marshmallow.py diff --git a/aioelectricitymaps/__init__.py b/aioelectricitymaps/__init__.py index 6965298..9e6f42f 100644 --- a/aioelectricitymaps/__init__.py +++ b/aioelectricitymaps/__init__.py @@ -1,4 +1,13 @@ """ElectricityMaps wrapper.""" from .electricitymaps import ElectricityMaps +from .exceptions import ElectricityMapsDecodeError, ElectricityMapsError, InvalidToken +from .models import CarbonIntensityResponse, Zone -__all__ = ["ElectricityMaps"] +__all__ = [ + "ElectricityMaps", + "ElectricityMapsDecodeError", + "ElectricityMapsError", + "InvalidToken", + "CarbonIntensityResponse", + "Zone", +] diff --git a/aioelectricitymaps/electricitymaps.py b/aioelectricitymaps/electricitymaps.py index fa4ac98..111c3df 100644 --- a/aioelectricitymaps/electricitymaps.py +++ b/aioelectricitymaps/electricitymaps.py @@ -16,8 +16,7 @@ InvalidToken, SwitchedToLegacyAPI, ) -from .marshmallow import ZoneList -from .models import CarbonIntensityResponse, Zone +from .models import CarbonIntensityResponse, Zone, ZonesResponse _LOGGER = logging.getLogger(__name__) @@ -32,14 +31,13 @@ class ElectricityMaps: _close_session: bool = False _is_legacy_token: bool = False - async def _get(self, url: str, params: dict[str, Any] | None = None) -> Any: + async def _get(self, url: str, params: dict[str, Any] | None = None) -> str: """Execute a GET request against the API.""" if self.session is None: self.session = ClientSession() self._close_session = True headers = {"auth-token": self.token} - parsed = {} _LOGGER.debug("Doing request: GET %s %s", url, str(params)) @@ -86,7 +84,7 @@ async def _get(self, url: str, params: dict[str, Any] | None = None) -> Any: raise InvalidToken - return parsed + return await response.text() @retry_legacy async def latest_carbon_intensity_by_coordinates( @@ -105,7 +103,7 @@ async def latest_carbon_intensity_by_coordinates( ApiEndpoints.CARBON_INTENSITY, {"lat": lat, "lon": lon}, ) - return CarbonIntensityResponse.from_dict(result) + return CarbonIntensityResponse.from_json(result) @retry_legacy async def latest_carbon_intensity_by_country_code( @@ -120,12 +118,12 @@ async def latest_carbon_intensity_by_country_code( ) else: result = await self._get(ApiEndpoints.CARBON_INTENSITY, {"zone": code}) - return CarbonIntensityResponse.from_dict(result) + return CarbonIntensityResponse.from_json(result) async def zones(self) -> dict[str, Zone]: - """Get list of zones where carbon intensity is available.""" + """Get a dict of zones where carbon intensity is available.""" result = await self._get(ApiEndpoints.ZONES) - return ZoneList.from_dict({"zones": result}).zones + return ZonesResponse.from_json(result).zones async def close(self) -> None: """Close open client session.""" diff --git a/aioelectricitymaps/marshmallow.py b/aioelectricitymaps/marshmallow.py deleted file mode 100644 index 3df8023..0000000 --- a/aioelectricitymaps/marshmallow.py +++ /dev/null @@ -1,23 +0,0 @@ -"""Module contains classes for de-/serialisation with marshmallow.""" -from __future__ import annotations - -from dataclasses import dataclass, field - -from dataclasses_json import DataClassJsonMixin, config -from marshmallow import fields - -from .models import Zone - - -@dataclass(slots=True, frozen=True) -class ZoneList(dict[str, Zone], DataClassJsonMixin): - """List of zones.""" - - zones: dict[str, Zone] = field( - metadata=config( - mm_field=fields.Dict( - keys=fields.String(), - values=fields.Nested(Zone.schema()), - ), - ), - ) diff --git a/aioelectricitymaps/models.py b/aioelectricitymaps/models.py index ad6b1e5..a8b39d8 100644 --- a/aioelectricitymaps/models.py +++ b/aioelectricitymaps/models.py @@ -2,41 +2,60 @@ from __future__ import annotations from dataclasses import dataclass, field +from typing import Any, Self -from dataclasses_json import DataClassJsonMixin, LetterCase, config +from mashumaro import field_options +from mashumaro.mixins.orjson import DataClassORJSONMixin -@dataclass(slots=True, frozen=True) -class CarbonIntensityData(DataClassJsonMixin): - """Data field.""" +@dataclass(slots=True, frozen=True, kw_only=True) +class CarbonIntensityResponse(DataClassORJSONMixin): + """API response.""" - carbon_intensity: float = field(metadata=config(letter_case=LetterCase.CAMEL)) - fossil_fuel_percentage: float = field(metadata=config(letter_case=LetterCase.CAMEL)) + status: str + country_code: str = field(metadata=field_options(alias="countryCode")) + data: CarbonIntensityData + units: CarbonIntensityUnit -@dataclass(slots=True, frozen=True) -class CarbonIntensityUnit(DataClassJsonMixin): - """Unit field.""" +@dataclass(slots=True, frozen=True, kw_only=True) +class ZonesResponse(DataClassORJSONMixin): + """Zones API response.""" - carbon_intensity: str = field(metadata=config(letter_case=LetterCase.CAMEL)) + zones: dict[str, Zone] + @classmethod + def __pre_deserialize__( + cls: type[Self], + d: dict[Any, Any], + ) -> dict[Any, Any]: + """Wrap data in a dict for deserialization.""" + return {"zones": d} -@dataclass(slots=True, frozen=True) -class CarbonIntensityResponse(DataClassJsonMixin): - """API response.""" - status: str = field(metadata=config(letter_case=LetterCase.CAMEL)) - country_code: str = field(metadata=config(letter_case=LetterCase.CAMEL)) - data: CarbonIntensityData - units: CarbonIntensityUnit +@dataclass(slots=True, frozen=True, kw_only=True) +class CarbonIntensityData: + """Data field.""" + + carbon_intensity: float = field(metadata=field_options(alias="carbonIntensity")) + fossil_fuel_percentage: float = field( + metadata=field_options(alias="fossilFuelPercentage"), + ) + + +@dataclass(slots=True, frozen=True, kw_only=True) +class CarbonIntensityUnit: + """Unit field.""" + + carbon_intensity: str = field(metadata=field_options(alias="carbonIntensity")) -@dataclass(slots=True, frozen=True) -class Zone(DataClassJsonMixin): +@dataclass(slots=True, frozen=True, kw_only=True) +class Zone: """Zone for carbon intensity API.""" - zone_name: str = field(metadata=config(letter_case=LetterCase.CAMEL)) + zone_name: str = field(metadata=field_options(alias="zoneName")) country_name: str | None = field( - metadata=config(letter_case=LetterCase.CAMEL), + metadata=field_options(alias="countryName"), default=None, ) diff --git a/poetry.lock b/poetry.lock index bcd2a79..c26b721 100644 --- a/poetry.lock +++ b/poetry.lock @@ -87,7 +87,6 @@ files = [ [package.dependencies] aiosignal = ">=1.1.2" -async-timeout = {version = ">=4.0,<5.0", markers = "python_version < \"3.11\""} attrs = ">=17.3.0" frozenlist = ">=1.1.1" multidict = ">=4.5,<7.0" @@ -139,20 +138,6 @@ files = [ {file = "astroid-3.0.2.tar.gz", hash = "sha256:4a61cf0a59097c7bb52689b0fd63717cd2a8a14dc9f1eee97b82d814881c8c91"}, ] -[package.dependencies] -typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.11\""} - -[[package]] -name = "async-timeout" -version = "4.0.3" -description = "Timeout context manager for asyncio programs" -optional = false -python-versions = ">=3.7" -files = [ - {file = "async-timeout-4.0.3.tar.gz", hash = "sha256:4640d96be84d82d02ed59ea2b7105a0f7b33abe8703703cd0ab0bf87c427522f"}, - {file = "async_timeout-4.0.3-py3-none-any.whl", hash = "sha256:7405140ff1230c310e51dc27b3145b9092d659ce68ff733fb0cefe3ee42be028"}, -] - [[package]] name = "attrs" version = "23.2.0" @@ -286,27 +271,9 @@ files = [ {file = "coverage-7.4.0.tar.gz", hash = "sha256:707c0f58cb1712b8809ece32b68996ee1e609f71bd14615bd8f87a1293cb610e"}, ] -[package.dependencies] -tomli = {version = "*", optional = true, markers = "python_full_version <= \"3.11.0a6\" and extra == \"toml\""} - [package.extras] toml = ["tomli"] -[[package]] -name = "dataclasses-json" -version = "0.6.3" -description = "Easily serialize dataclasses to and from JSON." -optional = false -python-versions = ">=3.7,<4.0" -files = [ - {file = "dataclasses_json-0.6.3-py3-none-any.whl", hash = "sha256:4aeb343357997396f6bca1acae64e486c3a723d8f5c76301888abeccf0c45176"}, - {file = "dataclasses_json-0.6.3.tar.gz", hash = "sha256:35cb40aae824736fdf959801356641836365219cfe14caeb115c39136f775d2a"}, -] - -[package.dependencies] -marshmallow = ">=3.18.0,<4.0.0" -typing-inspect = ">=0.4.0,<1" - [[package]] name = "dill" version = "0.3.7" @@ -332,20 +299,6 @@ files = [ {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, ] -[[package]] -name = "exceptiongroup" -version = "1.2.0" -description = "Backport of PEP 654 (exception groups)" -optional = false -python-versions = ">=3.7" -files = [ - {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, - {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, -] - -[package.extras] -test = ["pytest (>=6)"] - [[package]] name = "filelock" version = "3.13.1" @@ -499,24 +452,24 @@ files = [ colors = ["colorama (>=0.4.6)"] [[package]] -name = "marshmallow" -version = "3.20.2" -description = "A lightweight library for converting complex datatypes to and from native Python datatypes." +name = "mashumaro" +version = "3.11" +description = "Fast and well tested serialization library" optional = false python-versions = ">=3.8" files = [ - {file = "marshmallow-3.20.2-py3-none-any.whl", hash = "sha256:c21d4b98fee747c130e6bc8f45c4b3199ea66bc00c12ee1f639f0aeca034d5e9"}, - {file = "marshmallow-3.20.2.tar.gz", hash = "sha256:4c1daff273513dc5eb24b219a8035559dc573c8f322558ef85f5438ddd1236dd"}, + {file = "mashumaro-3.11-py3-none-any.whl", hash = "sha256:8f858bdb33790db6d9f3087dce793a26d109aeae38bed3ca9c2d7f16f19db412"}, + {file = "mashumaro-3.11.tar.gz", hash = "sha256:b0b2443be4bdad29bb209d91fe4a2a918fbd7b63cccfeb457c7eeb567db02f5e"}, ] [package.dependencies] -packaging = ">=17.0" +typing-extensions = ">=4.1.0" [package.extras] -dev = ["pre-commit (>=2.4,<4.0)", "pytest", "pytz", "simplejson", "tox"] -docs = ["alabaster (==0.7.15)", "autodocsumm (==0.2.12)", "sphinx (==7.2.6)", "sphinx-issues (==3.0.1)", "sphinx-version-warning (==1.1.2)"] -lint = ["pre-commit (>=2.4,<4.0)"] -tests = ["pytest", "pytz", "simplejson"] +msgpack = ["msgpack (>=0.5.6)"] +orjson = ["orjson"] +toml = ["tomli (>=1.1.0)", "tomli-w (>=1.0)"] +yaml = ["pyyaml (>=3.13)"] [[package]] name = "mccabe" @@ -650,7 +603,6 @@ files = [ [package.dependencies] mypy-extensions = ">=1.0.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} typing-extensions = ">=4.1.0" [package.extras] @@ -684,6 +636,65 @@ files = [ [package.dependencies] setuptools = "*" +[[package]] +name = "orjson" +version = "3.9.12" +description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy" +optional = false +python-versions = ">=3.8" +files = [ + {file = "orjson-3.9.12-cp310-cp310-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl", hash = "sha256:6b4e2bed7d00753c438e83b613923afdd067564ff7ed696bfe3a7b073a236e07"}, + {file = "orjson-3.9.12-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd1b8ec63f0bf54a50b498eedeccdca23bd7b658f81c524d18e410c203189365"}, + {file = "orjson-3.9.12-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ab8add018a53665042a5ae68200f1ad14c7953fa12110d12d41166f111724656"}, + {file = "orjson-3.9.12-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:12756a108875526b76e505afe6d6ba34960ac6b8c5ec2f35faf73ef161e97e07"}, + {file = "orjson-3.9.12-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:890e7519c0c70296253660455f77e3a194554a3c45e42aa193cdebc76a02d82b"}, + {file = "orjson-3.9.12-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d664880d7f016efbae97c725b243b33c2cbb4851ddc77f683fd1eec4a7894146"}, + {file = "orjson-3.9.12-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:cfdaede0fa5b500314ec7b1249c7e30e871504a57004acd116be6acdda3b8ab3"}, + {file = "orjson-3.9.12-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6492ff5953011e1ba9ed1bf086835fd574bd0a3cbe252db8e15ed72a30479081"}, + {file = "orjson-3.9.12-cp310-none-win32.whl", hash = "sha256:29bf08e2eadb2c480fdc2e2daae58f2f013dff5d3b506edd1e02963b9ce9f8a9"}, + {file = "orjson-3.9.12-cp310-none-win_amd64.whl", hash = "sha256:0fc156fba60d6b50743337ba09f052d8afc8b64595112996d22f5fce01ab57da"}, + {file = "orjson-3.9.12-cp311-cp311-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl", hash = "sha256:2849f88a0a12b8d94579b67486cbd8f3a49e36a4cb3d3f0ab352c596078c730c"}, + {file = "orjson-3.9.12-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3186b18754befa660b31c649a108a915493ea69b4fc33f624ed854ad3563ac65"}, + {file = "orjson-3.9.12-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cbbf313c9fb9d4f6cf9c22ced4b6682230457741daeb3d7060c5d06c2e73884a"}, + {file = "orjson-3.9.12-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:99e8cd005b3926c3db9b63d264bd05e1bf4451787cc79a048f27f5190a9a0311"}, + {file = "orjson-3.9.12-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:59feb148392d9155f3bfed0a2a3209268e000c2c3c834fb8fe1a6af9392efcbf"}, + {file = "orjson-3.9.12-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4ae815a172a1f073b05b9e04273e3b23e608a0858c4e76f606d2d75fcabde0c"}, + {file = "orjson-3.9.12-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:ed398f9a9d5a1bf55b6e362ffc80ac846af2122d14a8243a1e6510a4eabcb71e"}, + {file = "orjson-3.9.12-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d3cfb76600c5a1e6be91326b8f3b83035a370e727854a96d801c1ea08b708073"}, + {file = "orjson-3.9.12-cp311-none-win32.whl", hash = "sha256:a2b6f5252c92bcab3b742ddb3ac195c0fa74bed4319acd74f5d54d79ef4715dc"}, + {file = "orjson-3.9.12-cp311-none-win_amd64.whl", hash = "sha256:c95488e4aa1d078ff5776b58f66bd29d628fa59adcb2047f4efd3ecb2bd41a71"}, + {file = "orjson-3.9.12-cp312-cp312-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl", hash = "sha256:d6ce2062c4af43b92b0221ed4f445632c6bf4213f8a7da5396a122931377acd9"}, + {file = "orjson-3.9.12-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:950951799967558c214cd6cceb7ceceed6f81d2c3c4135ee4a2c9c69f58aa225"}, + {file = "orjson-3.9.12-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2dfaf71499d6fd4153f5c86eebb68e3ec1bf95851b030a4b55c7637a37bbdee4"}, + {file = "orjson-3.9.12-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:659a8d7279e46c97661839035a1a218b61957316bf0202674e944ac5cfe7ed83"}, + {file = "orjson-3.9.12-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:af17fa87bccad0b7f6fd8ac8f9cbc9ee656b4552783b10b97a071337616db3e4"}, + {file = "orjson-3.9.12-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cd52dec9eddf4c8c74392f3fd52fa137b5f2e2bed1d9ae958d879de5f7d7cded"}, + {file = "orjson-3.9.12-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:640e2b5d8e36b970202cfd0799d11a9a4ab46cf9212332cd642101ec952df7c8"}, + {file = "orjson-3.9.12-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:daa438bd8024e03bcea2c5a92cd719a663a58e223fba967296b6ab9992259dbf"}, + {file = "orjson-3.9.12-cp312-none-win_amd64.whl", hash = "sha256:1bb8f657c39ecdb924d02e809f992c9aafeb1ad70127d53fb573a6a6ab59d549"}, + {file = "orjson-3.9.12-cp38-cp38-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl", hash = "sha256:f4098c7674901402c86ba6045a551a2ee345f9f7ed54eeffc7d86d155c8427e5"}, + {file = "orjson-3.9.12-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5586a533998267458fad3a457d6f3cdbddbcce696c916599fa8e2a10a89b24d3"}, + {file = "orjson-3.9.12-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:54071b7398cd3f90e4bb61df46705ee96cb5e33e53fc0b2f47dbd9b000e238e1"}, + {file = "orjson-3.9.12-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:67426651faa671b40443ea6f03065f9c8e22272b62fa23238b3efdacd301df31"}, + {file = "orjson-3.9.12-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4a0cd56e8ee56b203abae7d482ac0d233dbfb436bb2e2d5cbcb539fe1200a312"}, + {file = "orjson-3.9.12-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a84a0c3d4841a42e2571b1c1ead20a83e2792644c5827a606c50fc8af7ca4bee"}, + {file = "orjson-3.9.12-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:09d60450cda3fa6c8ed17770c3a88473a16460cd0ff2ba74ef0df663b6fd3bb8"}, + {file = "orjson-3.9.12-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:bc82a4db9934a78ade211cf2e07161e4f068a461c1796465d10069cb50b32a80"}, + {file = "orjson-3.9.12-cp38-none-win32.whl", hash = "sha256:61563d5d3b0019804d782137a4f32c72dc44c84e7d078b89d2d2a1adbaa47b52"}, + {file = "orjson-3.9.12-cp38-none-win_amd64.whl", hash = "sha256:410f24309fbbaa2fab776e3212a81b96a1ec6037259359a32ea79fbccfcf76aa"}, + {file = "orjson-3.9.12-cp39-cp39-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl", hash = "sha256:e773f251258dd82795fd5daeac081d00b97bacf1548e44e71245543374874bcf"}, + {file = "orjson-3.9.12-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b159baecfda51c840a619948c25817d37733a4d9877fea96590ef8606468b362"}, + {file = "orjson-3.9.12-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:975e72e81a249174840d5a8df977d067b0183ef1560a32998be340f7e195c730"}, + {file = "orjson-3.9.12-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:06e42e899dde61eb1851a9fad7f1a21b8e4be063438399b63c07839b57668f6c"}, + {file = "orjson-3.9.12-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5c157e999e5694475a5515942aebeed6e43f7a1ed52267c1c93dcfde7d78d421"}, + {file = "orjson-3.9.12-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dde1bc7c035f2d03aa49dc8642d9c6c9b1a81f2470e02055e76ed8853cfae0c3"}, + {file = "orjson-3.9.12-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:b0e9d73cdbdad76a53a48f563447e0e1ce34bcecef4614eb4b146383e6e7d8c9"}, + {file = "orjson-3.9.12-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:96e44b21fe407b8ed48afbb3721f3c8c8ce17e345fbe232bd4651ace7317782d"}, + {file = "orjson-3.9.12-cp39-none-win32.whl", hash = "sha256:cbd0f3555205bf2a60f8812133f2452d498dbefa14423ba90fe89f32276f7abf"}, + {file = "orjson-3.9.12-cp39-none-win_amd64.whl", hash = "sha256:03ea7ee7e992532c2f4a06edd7ee1553f0644790553a118e003e3c405add41fa"}, + {file = "orjson-3.9.12.tar.gz", hash = "sha256:da908d23a3b3243632b523344403b128722a5f45e278a8343c2bb67538dff0e4"}, +] + [[package]] name = "packaging" version = "23.2" @@ -723,13 +734,13 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4)", "pytest-co [[package]] name = "pluggy" -version = "1.3.0" +version = "1.4.0" description = "plugin and hook calling mechanisms for python" optional = false python-versions = ">=3.8" files = [ - {file = "pluggy-1.3.0-py3-none-any.whl", hash = "sha256:d89c696a773f8bd377d18e5ecda92b7a3793cbe66c87060a6fb58c7b6e1061f7"}, - {file = "pluggy-1.3.0.tar.gz", hash = "sha256:cf61ae8f126ac6f7c451172cf30e3e43d3ca77615509771b3a984a0730651e12"}, + {file = "pluggy-1.4.0-py3-none-any.whl", hash = "sha256:7db9f7b503d67d1c5b95f59773ebb58a8c1c288129a88665838012cfb07b8981"}, + {file = "pluggy-1.4.0.tar.gz", hash = "sha256:8c85c2876142a764e5b7548e7d9a0e0ddb46f5185161049a79b7e974454223be"}, ] [package.extras] @@ -767,7 +778,6 @@ files = [ [package.dependencies] "ruamel.yaml" = ">=0.15" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} [[package]] name = "pylint" @@ -784,14 +794,12 @@ files = [ astroid = ">=3.0.1,<=3.1.0-dev0" colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} dill = [ - {version = ">=0.2", markers = "python_version < \"3.11\""}, {version = ">=0.3.6", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, {version = ">=0.3.7", markers = "python_version >= \"3.12\""}, ] isort = ">=4.2.5,<5.13.0 || >5.13.0,<6" mccabe = ">=0.6,<0.8" platformdirs = ">=2.2.0" -tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} tomlkit = ">=0.10.1" [package.extras] @@ -811,11 +819,9 @@ files = [ [package.dependencies] colorama = {version = "*", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] @@ -1049,17 +1055,6 @@ files = [ [package.dependencies] pytest = ">=7.0.0,<8.0.0" -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.7" -files = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] - [[package]] name = "tomlkit" version = "0.12.3" @@ -1082,21 +1077,6 @@ files = [ {file = "typing_extensions-4.9.0.tar.gz", hash = "sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783"}, ] -[[package]] -name = "typing-inspect" -version = "0.9.0" -description = "Runtime inspection utilities for typing module." -optional = false -python-versions = "*" -files = [ - {file = "typing_inspect-0.9.0-py3-none-any.whl", hash = "sha256:9ee6fc59062311ef8547596ab6b955e1b8aa46242d854bfc78f4f6b0eff35f9f"}, - {file = "typing_inspect-0.9.0.tar.gz", hash = "sha256:b23fc42ff6f6ef6954e4852c1fb512cdd18dbea03134f91f856a95ccc9461f78"}, -] - -[package.dependencies] -mypy-extensions = ">=0.3.0" -typing-extensions = ">=3.7.4" - [[package]] name = "virtualenv" version = "20.25.0" @@ -1240,5 +1220,5 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" -python-versions = ">=3.10,<4" -content-hash = "6e0ee31d59a3de13239132d9c97e7d9b62a72e5842c4925fb7b4901111bdb086" +python-versions = "^3.11" +content-hash = "a0d3689a472733da0213e1201c28c69ad4dac692606f5b65337621cdfddc124f" diff --git a/pyproject.toml b/pyproject.toml index 42beccc..edcf720 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,11 +9,22 @@ readme = "README.md" packages = [ { include = "aioelectricitymaps" } ] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Framework :: AsyncIO", + "Intended Audience :: Developers", + "Natural Language :: English", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3", + "Topic :: Software Development :: Libraries :: Python Modules", +] [tool.poetry.dependencies] -python = ">=3.10,<4" +python = "^3.11" aiohttp = ">=3.8.0" -dataclasses-json = ">=0.6.0" +mashumaro = ">=3.11" +orjson = ">=3.9.8" [tool.poetry.group.dev.dependencies] codespell = "2.2.6"