From 7423023dfc46a8b31ab97e2d0b086c720ddfde15 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 14:46:34 -0700 Subject: [PATCH 1/9] Delete setup.py and version.py --- floris/version.py | 1 - setup.py | 89 ----------------------------------------------- 2 files changed, 90 deletions(-) delete mode 100644 floris/version.py delete mode 100644 setup.py diff --git a/floris/version.py b/floris/version.py deleted file mode 100644 index bf77d5496..000000000 --- a/floris/version.py +++ /dev/null @@ -1 +0,0 @@ -4.2 diff --git a/setup.py b/setup.py deleted file mode 100644 index 7e3a11be4..000000000 --- a/setup.py +++ /dev/null @@ -1,89 +0,0 @@ - -from pathlib import Path - -from setuptools import find_packages, setup - - -# Package meta-data. -NAME = "FLORIS" -DESCRIPTION = "A controls-oriented engineering wake model." -URL = "https://github.com/NREL/FLORIS" -EMAIL = "rafael.mudafort@nrel.gov" -AUTHOR = "NREL National Wind Technology Center" -REQUIRES_PYTHON = ">=3.8.0" - -# What packages are required for this module to be executed? -REQUIRED = [ - # simulation - "attrs", - "pyyaml~=6.0", - "numexpr~=2.0", - "numpy~=1.20", - "scipy~=1.1", - - # tools - "matplotlib~=3.0", - "pandas~=2.0", - "shapely~=2.0", - - # utilities - "coloredlogs~=15.0", - "pathos~=0.3", -] - -# What packages are optional? -# To use: -# pip install -e ".[docs,develop]" install both sets of extras in editable install -# pip install -e ".[develop]" installs only developer packages in editable install -# pip install "floris[develop]" installs developer packages in non-editable install -EXTRAS = { - "docs": { - "jupyter-book", - "sphinx-book-theme", - "sphinx-autodoc-typehints", - "sphinxcontrib-autoyaml", - "sphinxcontrib.mermaid", - }, - "develop": { - "pytest", - "pre-commit", - "ruff", - "isort", - }, -} - -ROOT = Path(__file__).parent -with open(ROOT / "floris" / "version.py") as version_file: - VERSION = version_file.read().strip() - -setup( - name=NAME, - version=VERSION, - description=DESCRIPTION, - long_description=DESCRIPTION, - long_description_content_type="text/markdown", - author=AUTHOR, - author_email=EMAIL, - python_requires=REQUIRES_PYTHON, - url=URL, - packages=find_packages(exclude=["tests", "*.tests", "*.tests.*", "tests.*"]), - package_data={ - 'floris': ['turbine_library/*.yaml', 'core/wake_velocity/turbopark_lookup_table.mat'] - }, - install_requires=REQUIRED, - extras_require=EXTRAS, - include_package_data=True, - license_files = ('LICENSE.txt',), - classifiers=[ - # Trove classifiers - # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers - "License :: OSI Approved :: BSD License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy" - ], -) From a48445265b5f15d1d4698ae4909ca4157ccc1f3f Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 14:47:28 -0700 Subject: [PATCH 2/9] Update version to reference metadata --- floris/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/floris/__init__.py b/floris/__init__.py index d97bb24eb..2b3bbcbbf 100644 --- a/floris/__init__.py +++ b/floris/__init__.py @@ -1,9 +1,9 @@ +from importlib.metadata import version from pathlib import Path -with open(Path(__file__).parent / "version.py") as _version_file: - __version__ = _version_file.read().strip() +__version__ = version("flasc") from .floris_model import FlorisModel From ad212c131131cf8a8b2f0672eabcf6da5c35d343 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 14:47:54 -0700 Subject: [PATCH 3/9] All metadata in pyproject.toml --- pyproject.toml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 330c5a2d8..e78e7a59f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,64 @@ requires = ["setuptools >= 40.6.0", "wheel"] build-backend = "setuptools.build_meta" +[project] +name = "floris" +version = "4.2" +description = "A controls-oriented engineering wake model." +readme = "README.md" +requires-python = ">=3.9" +authors = [ + { name = "Rafael Mudafort", email = "rafael.mudafort@nrel.gov" }, + { name = "Paul Fleming", email = "paul.fleming@nrel.gov" }, + { name = "Michael (Misha) Sinner", email = "Michael.Sinner@nrel.gov" }, + { name = "Eric Simley", email = "Eric.Simley@nrel.gov" }, +] +license = { file = "LICENSE.txt" } +keywords = ["floris"] +classifiers = [ + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy" +] +dependencies = [ + "attrs", + "pyyaml~=6.0", + "numexpr~=2.0", + "numpy~=1.20", + "scipy~=1.1", + "matplotlib~=3.0", + "pandas~=2.0", + "shapely~=2.0", + "coloredlogs~=15.0", + "pathos~=0.3", +] + +[project.optional-dependencies] +docs = [ + "jupyter-book", + "sphinx-book-theme", + "sphinx-autodoc-typehints", + "sphinxcontrib-autoyaml", + "sphinxcontrib.mermaid", +] +develop = [ + "pytest", + "pre-commit", + "ruff", + "isort" +] + +[tool.setuptools.packages.find] +include = ["floris*"] + +[project.urls] +Homepage = "https://github.com/NREL/floris" +Documentation = "https://nrel.github.io/floris/" [coverage.run] # Coverage.py configuration file From 389b7c159bcfcedc317f6fc94a5cc32e33013e69 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 14:48:08 -0700 Subject: [PATCH 4/9] Build without setup.py --- .github/workflows/python-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index ead77afce..9281f86c0 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -20,11 +20,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install setuptools wheel twine + pip install build twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + python -m build twine upload dist/* From 0c421349d2740e52fc71730258ec84cd1eca9a90 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 14:48:24 -0700 Subject: [PATCH 5/9] Update dev guide --- docs/dev_guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/dev_guide.md b/docs/dev_guide.md index 4a7c5dd76..a4a08e195 100644 --- a/docs/dev_guide.md +++ b/docs/dev_guide.md @@ -210,7 +210,7 @@ is located at `floris/.github/workflows/continuous-integration-workflow.yaml`. The online documentation is built with Jupyter Book which uses Sphinx as a framework. It is automatically built and hosted by GitHub, but it can also be compiled locally. Additional dependencies are required -for the documentation, and they are listed in the `EXTRAS` of `setup.py`. +for the documentation, and they are listed in the `project.optional-dependencies` of `pyproject.toml`. The commands to build the docs are given below. After successfully compiling, a file should be located at ``docs/_build/html/index.html``. This file can be opened in any browser. @@ -246,7 +246,7 @@ Be sure to complete each step in the sequence as described. with a commit message such as "Update version to vN.M". The version number must be updated in the following two files: - [floris/README.md](https://github.com/NREL/floris/blob/main/README.md) - - [floris/floris/version.py](https://github.com/NREL/floris/blob/main/floris/version.py) + - [pyproject.toml](https://github.com/NREL/floris/blob/main/pyproject.toml) Note that a `.0` version number is left off meaning that valid versions are `v3`, `v3.1`, `v3.1.1`, etc. From 7581a243405ba95e2f2b442e014bf7b1bc296bf5 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 14:56:21 -0700 Subject: [PATCH 6/9] fix ref to flasc --- floris/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/floris/__init__.py b/floris/__init__.py index 2b3bbcbbf..717ea3175 100644 --- a/floris/__init__.py +++ b/floris/__init__.py @@ -3,7 +3,7 @@ from pathlib import Path -__version__ = version("flasc") +__version__ = version("floris") from .floris_model import FlorisModel From 83d31b9ac13930c3e3f1355173680506664af783 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 15:00:50 -0700 Subject: [PATCH 7/9] Add chris --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index e78e7a59f..625a3ebb8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ authors = [ { name = "Paul Fleming", email = "paul.fleming@nrel.gov" }, { name = "Michael (Misha) Sinner", email = "Michael.Sinner@nrel.gov" }, { name = "Eric Simley", email = "Eric.Simley@nrel.gov" }, + { name = "Christopher Bay", email = "Christopher.Bay@nrel.gov" }, ] license = { file = "LICENSE.txt" } keywords = ["floris"] From f35136d23ed0658e457ec4667e5a1a5e2ef3f495 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 15:02:51 -0700 Subject: [PATCH 8/9] Re-add package data --- pyproject.toml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 625a3ebb8..1ae0f731e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,12 @@ develop = [ [tool.setuptools.packages.find] include = ["floris*"] +[tool.setuptools.package-data] +floris = [ + "turbine_library/*.yaml", + "core/wake_velocity/turbopark_lookup_table.mat" +] + [project.urls] Homepage = "https://github.com/NREL/floris" Documentation = "https://nrel.github.io/floris/" From f53b59c6b8612ffaeec8d838d4f52f6795a7a164 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 13 Nov 2024 15:54:24 -0700 Subject: [PATCH 9/9] Lower python req --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1ae0f731e..dea224866 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "floris" version = "4.2" description = "A controls-oriented engineering wake model." readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.8" authors = [ { name = "Rafael Mudafort", email = "rafael.mudafort@nrel.gov" }, { name = "Paul Fleming", email = "paul.fleming@nrel.gov" },