From bc4906d7a8019451825cc1713d3f9de569133b39 Mon Sep 17 00:00:00 2001 From: Rafael M Mudafort Date: Sun, 3 Sep 2023 15:29:30 -0600 Subject: [PATCH 1/2] Prevent installing test directory --- setup.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 22b8431..722ba95 100644 --- a/setup.py +++ b/setup.py @@ -6,10 +6,11 @@ version="1.0", description="Frameworks defining the inputs and outputs for systems engineering MDAO of wind turbine and plants.", author="IEA Wind Task 37", - packages=setuptools.find_packages(exclude=["test", "examples"]), + packages=setuptools.find_packages(exclude=["docs*", "examples*", "test*"]), python_requires=">=3.7", zip_safe=True, - install_requires=['jsonschema', 'numpy', 'pyyaml', 'pytest', 'xarray'] - ) + install_requires=['jsonschema', 'numpy', 'pyyaml', 'pytest', 'xarray'], + license="Apache-2.0", +) -setuptools.setup(**metadata) \ No newline at end of file +setuptools.setup(**metadata) From 49344f5ed5b8e86ebe1ba2cbac12d3b953fe2da6 Mon Sep 17 00:00:00 2001 From: Rafael M Mudafort Date: Sun, 3 Sep 2023 15:51:33 -0600 Subject: [PATCH 2/2] Move utils package into windIO --- examples/plant/validation.py | 4 ++-- setup.py | 23 ++++++++++++++++++++++- test/plant/test_resources_pywake.py | 2 +- test/plant/test_system_pywake.py | 8 ++++---- test/plant/test_turbine.py | 4 ++-- utils/__init__.py | 7 ------- windIO/utils/__init__.py | 7 +++++++ {utils => windIO/utils}/pywake_utils.py | 2 +- {utils => windIO/utils}/topfarm_utils.py | 4 ++-- {utils => windIO/utils}/yml_utils.py | 0 10 files changed, 41 insertions(+), 20 deletions(-) delete mode 100644 utils/__init__.py create mode 100644 windIO/utils/__init__.py rename {utils => windIO/utils}/pywake_utils.py (98%) rename {utils => windIO/utils}/topfarm_utils.py (92%) rename {utils => windIO/utils}/yml_utils.py (100%) diff --git a/examples/plant/validation.py b/examples/plant/validation.py index b11b36a..66fa0cf 100644 --- a/examples/plant/validation.py +++ b/examples/plant/validation.py @@ -1,7 +1,7 @@ import yaml import os -from utils import plant_schemas_path, plant_examples_data_path -from utils.yml_utils import validate_yaml, XrResourceLoader +from windIO.utils import plant_schemas_path, plant_examples_data_path +from windIO.utils.yml_utils import validate_yaml, XrResourceLoader if __name__ == '__main__': diff --git a/setup.py b/setup.py index 722ba95..454c25c 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,25 @@ import setuptools +# Required packages to use the library +REQUIRED = [ + 'jsonschema', + 'numpy', + 'pyyaml', + 'xarray', +] + +# Optional packages +# To use: +# pip install -e ".[test]" installs testing packages in editable install +# pip install "windIO[test]" installs testing packages in non-editable install +EXTRAS = { + "test": { + 'pytest', + 'py_wake', + 'topfarm', + }, +} + metadata = dict( name="windIO", url='https://github.com/IEAWindTask37/windIO', @@ -9,7 +29,8 @@ packages=setuptools.find_packages(exclude=["docs*", "examples*", "test*"]), python_requires=">=3.7", zip_safe=True, - install_requires=['jsonschema', 'numpy', 'pyyaml', 'pytest', 'xarray'], + install_requires=REQUIRED, + extras_require=EXTRAS, license="Apache-2.0", ) diff --git a/test/plant/test_resources_pywake.py b/test/plant/test_resources_pywake.py index f0a3bc5..a69a7a3 100644 --- a/test/plant/test_resources_pywake.py +++ b/test/plant/test_resources_pywake.py @@ -1,5 +1,5 @@ -from utils.pywake_utils import yml2Site, xr2Site +from windIO.utils.pywake_utils import yml2Site, xr2Site import numpy.testing as npt import numpy as np import pytest diff --git a/test/plant/test_system_pywake.py b/test/plant/test_system_pywake.py index b7c589c..3db484b 100644 --- a/test/plant/test_system_pywake.py +++ b/test/plant/test_system_pywake.py @@ -1,6 +1,6 @@ -from utils import plant_examples_data_path -from utils.yml_utils import load_yaml -from utils.pywake_utils import ymlSystem2PyWake +from windIO.utils import plant_examples_data_path +from windIO.utils.yml_utils import load_yaml +from windIO.utils.pywake_utils import ymlSystem2PyWake from py_wake.deficit_models.gaussian import IEA37SimpleBastankhahGaussian import numpy as np import numpy.testing as npt @@ -13,7 +13,7 @@ from topfarm.cost_models.py_wake_wrapper import PyWakeAEPCostModelComponent from topfarm.constraint_components.boundary import CircleBoundaryConstraint from topfarm.plotting import XYPlotComp - from utils.topfarm_utils import ymlSystem2TopFarm + from windIO.utils.topfarm_utils import ymlSystem2TopFarm from test.plant import examples_data_path except ModuleNotFoundError: topfarm = None diff --git a/test/plant/test_turbine.py b/test/plant/test_turbine.py index d961114..c3ed412 100644 --- a/test/plant/test_turbine.py +++ b/test/plant/test_turbine.py @@ -1,5 +1,5 @@ -from utils.pywake_utils import yml2WindTurbines -from utils import plant_examples_data_path +from windIO.utils.pywake_utils import yml2WindTurbines +from windIO.utils import plant_examples_data_path from py_wake.examples.data.iea37._iea37 import IEA37_WindTurbines import numpy.testing as npt import numpy as np diff --git a/utils/__init__.py b/utils/__init__.py deleted file mode 100644 index efd5dfc..0000000 --- a/utils/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -import os - -plant_examples_data_path = os.path.dirname(__file__) + "/../examples/plant/" -plant_schemas_path = os.path.dirname(__file__) + "/../windIO/plant/" - -turbine_examples_data_path = os.path.dirname(__file__) + "/../examples/turbine/" -turbine_schemas_path = os.path.dirname(__file__) + "/../windIO/turbine/" diff --git a/windIO/utils/__init__.py b/windIO/utils/__init__.py new file mode 100644 index 0000000..4c6ae88 --- /dev/null +++ b/windIO/utils/__init__.py @@ -0,0 +1,7 @@ +import os + +plant_examples_data_path = os.path.dirname(__file__) + "/../../examples/plant/" +plant_schemas_path = os.path.dirname(__file__) + "/../../windIO/plant/" + +turbine_examples_data_path = os.path.dirname(__file__) + "/../../examples/turbine/" +turbine_schemas_path = os.path.dirname(__file__) + "/../../windIO/turbine/" diff --git a/utils/pywake_utils.py b/windIO/utils/pywake_utils.py similarity index 98% rename from utils/pywake_utils.py rename to windIO/utils/pywake_utils.py index 5f818c4..4ce5884 100644 --- a/utils/pywake_utils.py +++ b/windIO/utils/pywake_utils.py @@ -1,6 +1,6 @@ import numpy as np import xarray as xr -from utils.yml_utils import load_yaml, XrResourceLoader +from windIO.utils.yml_utils import load_yaml, XrResourceLoader from py_wake.wind_turbines import WindTurbine from py_wake.wind_turbines.power_ct_functions import CubePowerSimpleCt, PowerCtFunctions from py_wake.site.xrsite import XRSite diff --git a/utils/topfarm_utils.py b/windIO/utils/topfarm_utils.py similarity index 92% rename from utils/topfarm_utils.py rename to windIO/utils/topfarm_utils.py index efbbbf8..43ac879 100644 --- a/utils/topfarm_utils.py +++ b/windIO/utils/topfarm_utils.py @@ -1,5 +1,5 @@ -from utils.pywake_utils import ymlSystem2PyWake -from utils.yml_utils import load_yaml +from windIO.utils.pywake_utils import ymlSystem2PyWake +from windIO.utils.yml_utils import load_yaml from py_wake.deficit_models.gaussian import IEA37SimpleBastankhahGaussian from topfarm._topfarm import TopFarmProblem from topfarm.constraint_components.boundary import CircleBoundaryConstraint diff --git a/utils/yml_utils.py b/windIO/utils/yml_utils.py similarity index 100% rename from utils/yml_utils.py rename to windIO/utils/yml_utils.py