diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..879457cb1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,61 @@ +# Copyright 2025 Zeppelin Bend Pty Ltd +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +[build-system] + requires = [ + "setuptools", + "wheel", + "build>=1.2.0" + ] + build-backend = "setuptools.build_meta" + +[project] + name = "zepben.ewb" + version = "1.0.0b6" + description = "Python SDK for interacting with the Energy Workbench platform" + readme = {file = "README.md", content-type = "test/markdown"} + license = "MPL-2.0" + requires-python = '>=3.9,<3.13' + authors = [ + {name = "Kurt Greaves", email = "kurt.greaves@zepben.com"}, + {name = "Max Chesterfield", email = "max.chesterfield@zepben.com"} + ] + dependencies = [ + "zepben.protobuf==1.0.0b1", + "typing_extensions==4.12.2", + "requests>=2.26.0, <3.0.0", + "urllib3>=1.26.6, <1.27.0", + "PyJWT>=2.1.0, <2.2.0", + "dataclassy==0.6.2", + ] + classifiers = [ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: OS Independent" + ] + +[project.urls] + Repository = "https://github.com/zepben/evolve-sdk-python" + Homepage = "https://zepben.com" + +[project.optional-dependencies] + test = [ + "pytest>=7.4.4, <9", + "pytest-cov==6.1.1", + "pytest-asyncio==0.26.0", + "pytest-timeout==2.4.0", + "pytest-subtests", + "hypothesis==6.119.4", # 6.120.0 has issues with one of our large tests + "grpcio-testing==1.61.3", + "pylint==2.14.5", + "six==1.16.0", + "tox" + ] + +[tool.setuptools.packages.find] + where = ["src/"] diff --git a/setup.py b/setup.py index 2c181076f..6d4969e92 100644 --- a/setup.py +++ b/setup.py @@ -1,57 +1,7 @@ -# Copyright 2024 Zeppelin Bend Pty Ltd +# Copyright 2025 Zeppelin Bend Pty Ltd # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://mozilla.org/MPL/2.0/. -from setuptools import setup, find_namespace_packages +import setuptools -with open("README.md", "r") as fh: - long_description = fh.read() - -deps = [ - "zepben-protobuf==1.0.0b1", - "typing_extensions==4.12.2", - "requests>=2.26.0, <3.0.0", - "urllib3>=1.26.6, <1.27.0", - "PyJWT>=2.1.0, <2.2.0", - "dataclassy==0.6.2", -] - -test_deps = [ - "pytest==7.1.2", - "pytest-cov==2.10.1", - "pytest-asyncio==0.19.0", - "pytest-timeout==1.4.2", - 'pytest-subtests', - "hypothesis==6.56.3", - "grpcio-testing==1.61.3", - "pylint==2.14.5", - "six==1.16.0", - "tox" -] - -setup( - name="zepben.ewb", - version="1.0.0b6", - description="Python SDK for interacting with the Energy Workbench platform", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/zepben/evolve-sdk-python", - author="Kurt Greaves", - author_email="kurt.greaves@zepben.com", - license="MPL 2.0", - classifiers=[ - "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Operating System :: OS Independent" - ], - package_dir={"": "src"}, - packages=find_namespace_packages(where="src"), - python_requires='>=3.9,<3.13', - install_requires=deps, - extras_require={ - "test": test_deps, - } -) +setuptools.setup() diff --git a/test/services/network/translator/test_network_translator.py b/test/services/network/translator/test_network_translator.py index acb35913f..70db5bab2 100644 --- a/test/services/network/translator/test_network_translator.py +++ b/test/services/network/translator/test_network_translator.py @@ -235,6 +235,10 @@ def test_network_service_translations(**kwargs): # If this test still appears to lock up, it is likely you have missed validating a class or forgot to exclude the table. Either figure out which # case you have, or wait for the test to finish, and it will tell you. # + # NOTE: updating hypothesis can break this test on python 3.9 to 1.200.0 and beyond, if you do that, and it breaks, this command + # will run only this test: + # tox -e py39 -- test/services/network/translator/test_network_translator.py::test_network_service_translations --no-cov + # validate_service_translations( NetworkService, NetworkServiceComparator(), diff --git a/tox.ini b/tox.ini index ce3fd73d4..dc276a095 100644 --- a/tox.ini +++ b/tox.ini @@ -1,19 +1,22 @@ [tox] -envlist = py311 - py310 - py39 +envlist = + py{312, 311, 310, 39} + build [testenv] -allowlist_externals = /bin/bash - /usr/bin/bash +# run our tests, and setup the dependecy tree passenv = GITHUB_* pip_pre = true -deps = - .[test] -commands = - pytest --cov=zepben.ewb --cov-report=xml --cov-branch {posargs} - python setup.py bdist_wheel +extras = test +depends = + # build the package after testing + build: py{312, 311, 310, 39} +commands = pytest --cov=zepben.ewb --cov-report=xml --cov-branch {posargs} +[testenv:build] +# build the wheel +commands = python -m pip install build + python -m build [pytest] pythonpath = ./src ./test @@ -22,4 +25,5 @@ log_file = pytest.log log_file_date_format = %Y-%m-%d %H:%M:%S log_file_format = %(asctime)s %(levelname)s %(message)s asyncio_mode = auto +asyncio_default_fixture_loop_scope = function timeout = 15