From 9c77accd87c274920efdfa1bce958c73f17daf45 Mon Sep 17 00:00:00 2001 From: Malik Date: Fri, 3 Jan 2025 12:53:33 -0700 Subject: [PATCH] use pyproject.toml --- .github/workflows/build_docs.yml | 2 +- .github/workflows/ci.yml | 10 ++-- .github/workflows/deploy_docs.yml | 2 +- README.md | 8 ++- docs/source/quickstart.rst | 2 +- pyproject.toml | 84 +++++++++++++++++++++++++++++++ setup.py | 52 ------------------- 7 files changed, 99 insertions(+), 61 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 7208ae2..a0d80d1 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -25,7 +25,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install sphinx sphinx_rtd_theme + pip install .[docs] --no-deps - name: Build documentation run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d3cfac4..6a56da8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,9 +36,9 @@ jobs: python-version: ${{matrix.python-version}} - name: Install dependencies run: | - pip install black - pip install isort - pip install codespell + pip install --upgrade pip + pip install .[format] --no-deps + - name: Formatting and sorting import run: | source .github/linters/formatting.sh @@ -63,8 +63,8 @@ jobs: - name: Install dependencies run: | pip install --upgrade pip - pip install . - pip install pytest + pip install .[test,post] + - name: Test preprocess run: | pytest tests/preprocess diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index 2f8f8ee..753fd19 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install sphinx sphinx_rtd_theme + pip install .[docs] --no-deps - name: Build documentation run: | diff --git a/README.md b/README.md index f931da9..768a93c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ conda create --name bird python=3.10 conda activate bird git clone https://github.com/NREL/BioReactorDesign.git cd BioReactorDesign -pip install -e . +pip install -e .[all] ``` ## Installation of python package for users @@ -25,6 +25,12 @@ pip install -e . ```bash conda create --name bird python=3.10 conda activate bird +pip install nrel-bird[post] +``` + +If you do not need the post processing tools, please replace the last line with + +```bash pip install nrel-bird ``` diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 11a9e8f..31d78ec 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -14,7 +14,7 @@ Installation of python package for developers conda activate bird git clone https://github.com/NREL/BioReactorDesign.git cd BioReactorDesign - pip install -e . + pip install -e .[all] .. _installation_users: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f3314ac --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,84 @@ +[build-system] +requires = ["setuptools >= 64", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "nrel-bird" +version = "0.0.15" +description = "Bio Reactor Design (BiRD): a toolbox to simulate and analyze different designs of bioreactors in OpenFOAM" +readme = {file = "README.md", content-type = "text/markdown"} +authors = [ + {name = "Malik Hassanaly", email = "malik.hassanaly@nrel.gov"}, + {name = "Federico Municchi", email = "federico.municchi@nrel.gov"}, + {name = "Hariswaran Sitaraman", email = "hariswaran.sitaraman@nrel.gov"}, + {name = "Mohammad Rahimi", email = "mohammad.rahimi@nrel.gov"}, +] +license = {text = "BSD-3-Clause"} +requires-python = ">= 3.9" +classifiers=[ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Natural Language :: English", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +dependencies = [ + "numpy", + "prettyPlot", + "ruamel_yaml", + "numpy-stl==2.17.0", + "scipy", +] + + +[project.optional-dependencies] +post = [ + "corner", + "jax", + "numpyro>=0.16.1" +] +format = [ + "black", + "isort", + "codespell" +] +docs = [ + "sphinx", + "sphinx_rtd_theme" +] +test = [ + "pytest" +] +all = [ + "corner", + "jax", + "numpyro>=0.16.1", + "black", + "isort", + "codespell", + "sphinx", + "sphinx_rtd_theme", + "pytest", +] + + +[project.urls] +homepage = "https://github.com/NREL/BioReactorDesign" +documentation = "https://nrel.github.io/BioReactorDesign/" +repository = "https://github.com/NREL/BioReactorDesign" + +[tool.setuptools] +package-dir = {bird = "bird"} +packages = ["bird"] +include-package-data = true + +[tool.setuptools.package-data] +"bird" = [ + "*.json", + "*.yaml", + "*.csv", + "data_conditional_mean", +] + diff --git a/setup.py b/setup.py deleted file mode 100644 index 54b1b67..0000000 --- a/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -import os - -from setuptools import setup - -here = os.path.abspath(os.path.dirname(__file__)) - -with open(os.path.join(here, "bird", "requirements.txt")) as f: - install_requires = f.readlines() - -with open(os.path.join(here, "README.md"), encoding="utf-8") as f: - readme = f.read() - -with open(os.path.join(here, "bird", "version.py"), encoding="utf-8") as f: - version = f.read() -version = version.split("=")[-1].strip().strip('"').strip("'") - -setup( - name="nrel-bird", - version=version, - description="Bio Reactor Design (BiRD): a toolbox to simulate and analyze different designs of bioreactors in OpenFOAM", - long_description=readme, - long_description_content_type="text/markdown", - url="https://github.com/NREL/BioReactorDesign", - author="Malik Hassanaly", - license="BSD 3-Clause", - package_dir={"bird": "bird"}, - classifiers=[ - "Intended Audience :: Science/Research", - "License :: OSI Approved :: BSD License", - "Natural Language :: English", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - ], - package_data={ - "": [ - "*requirements.txt", - "*.json", - "*.yaml", - "*.csv", - "data_conditional_mean", - ] - }, - project_urls={ - "Documentation": "https://nrel.github.io/BioReactorDesign/", - "Repository": "https://github.com/NREL/BioReactorDesign", - }, - include_package_data=True, - python_requires=">=3.9", - install_requires=install_requires, -)