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 22b8431..454c25c 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,37 @@ 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', 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=REQUIRED, + extras_require=EXTRAS, + license="Apache-2.0", +) -setuptools.setup(**metadata) \ No newline at end of file +setuptools.setup(**metadata) 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