Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .github/linters/formatting.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
micromamba install --yes -n test-env -c conda-forge paraview
python -m pip install --upgrade pip
pip install -e .
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints
pip install .[docs]

- name: Build documentation
run: |
Expand Down
47 changes: 26 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,27 @@
- uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
- name: Install dependencies
run: |
pip install black
pip install isort
pip install codespell
cache: 'pip'

- name: Cache Nox
uses: actions/cache@v4
with:
path: .nox
key: ${{ runner.os }}-lint-nox-${{ hashFiles('noxfile.py') }}

- name: Install nox
run: pip install nox

- name: Formatting and sorting import
run: |
source .github/linters/formatting.sh
format . true
run: nox -s linter

Test-BiRD:
name: Test-BiRD (${{ matrix.python-version }}, ${{ matrix.os }})
Unit-Test-BiRD:
name: Unit-Test-BiRD (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.13']
python-version: ['3.10', '3.14']
os: ['ubuntu-latest', 'macos-latest']
defaults:
run:
Expand Down Expand Up @@ -81,14 +85,15 @@
run: |
micromamba install --yes -n test-env -c conda-forge paraview
pip install --upgrade pip
pip install .
pip install pytest
pip install --upgrade nox
pip install .[tests]

- name: Test
run: pytest .
run: nox -s tests -- no-reports


Test-pypi-Bird:
name: Test-pypi-BiRD (${{ matrix.python-version }}, ${{ matrix.os }})
Unit-Test-pypi-Bird:
name: Unit-Test-pypi-BiRD (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -120,105 +125,105 @@
run: |
micromamba install --yes -n test-env -c conda-forge paraview
pip install --upgrade pip
pip install nlr-bird
pip install pytest
pip install --upgrade nox
pip install nlr-bird[tests]

- name: Test
run: pytest .
run: nox -s tests -- no-reports

Test-OF:
name: Test-OF (${{ matrix.python-version }}, ${{ matrix.os }})
Regression-Test-OF:
name: Regression-Test-OF (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
os: ['ubuntu-22.04']
defaults:
run:
shell: bash -l {0}
working-directory: ${{github.workspace}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
- uses: gerlero/setup-openfoam@v1
with:
openfoam-version: 9

- name: Set up micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: test-env
create-args: >-
python=${{ matrix.python-version }}
channels: conda-forge
channel-priority: strict
cache-downloads: true
cache-env: true

- name: Install dependencies
run: |
micromamba install --yes -n test-env -c conda-forge paraview
pip install --upgrade pip
pip install .

- name: Compile solver
run: |
cd OFsolvers/birdmultiphaseEulerFoam
export WM_COMPILE_OPTION=Debug
./Allwmake
cd ../../
- name: Run deckwer17 PBE
run: |
cd experimental_cases/deckwer17
bash run.sh
cd ../../
- name: Run deckwer17 constantD
run: |
cd experimental_cases/deckwer17
cp constant/phaseProperties_constantd constant/phaseProperties
bash run.sh
cd ../../
- name: Run deckwer19 PBE
run: |
cd experimental_cases/deckwer19
bash run.sh
cd ../../
- name: Run side sparger tutorial
run: |
cd tutorial_cases/side_sparger
bash run.sh
cd ../../
- name: Run bubble column tutorial
run: |
cd tutorial_cases/bubble_column_20L
bash run.sh
cd ../../
- name: Run stirred-tank tutorial
run: |
cd tutorial_cases/stirred_tank
bash run.sh
cd ../../
- name: Run reactive loop reactor tutorial
run: |
cd tutorial_cases/loop_reactor_reacting
bash run.sh
cd ../../
- name: Run mixing loop reactor tutorial
run: |
cd tutorial_cases/loop_reactor_mixing
bash run.sh
cd ../../
- name: Run airlift reactor tutorial
run: |
cd tutorial_cases/airlift_40m
bash run.sh
cd ../../
- name: Run flat panel reactor tutorial
run: |
cd tutorial_cases/FlatPanel_250L_ASU
bash run.sh
cd ../../

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

10 changes: 5 additions & 5 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
python-version: '3.14'
cache: 'pip'

- name: Set up micromamba
Expand All @@ -42,13 +42,13 @@ jobs:
run: |
micromamba install --yes -n test-env -c conda-forge paraview
pip install --upgrade pip
pip install pytest
pip install pytest-cov
pip install -e .
pip install --upgrade nox
pip install .[tests]

- name: Generate coverage report
run: |
pytest --cov=./ --cov-report=xml:coverage.xml
pytest --cov=./ --cov-report=xml:coverage.xml

- name: Upload coverage to Codecov

uses: codecov/codecov-action@v5
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ jobs:
run: |
micromamba install --yes -n test-env -c conda-forge paraview
pip install --upgrade pip
pip install -e .
pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints
pip install -e .[docs]

- name: Build documentation
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <ins>Bi</ins>o <ins>R</ins>eactor <ins>D</ins>esign (BiRD) [![bird-CI](https://github.com/NatLabRockies/BioReactorDesign/actions/workflows/ci.yml/badge.svg)](https://github.com/NatLabRockies/BioReactorDesign/actions/workflows/ci.yml) [![bird-pyversion](https://img.shields.io/pypi/pyversions/NLR-bird.svg)](https://pypi.org/project/NLR-bird/) [![coverage](https://codecov.io/gh/NREL/BioReactorDesign/graph/badge.svg)](https://app.codecov.io/gh/nrel/bioreactordesign) [![bird-pypi](https://badge.fury.io/py/nlr-bird.svg)](https://badge.fury.io/py/nlr-bird)
# <ins>Bi</ins>o <ins>R</ins>eactor <ins>D</ins>esign (BiRD) [![bird-CI](https://github.com/NatLabRockies/BioReactorDesign/actions/workflows/ci.yml/badge.svg)](https://github.com/NatLabRockies/BioReactorDesign/actions/workflows/ci.yml) [![bird-pyversion](https://img.shields.io/pypi/pyversions/NLR-bird.svg)](https://pypi.org/project/NLR-bird/) [![coverage](https://codecov.io/gh/NatlabRockies/BioReactorDesign/graph/badge.svg)](https://app.codecov.io/gh/nrel/bioreactordesign) [![bird-pypi](https://badge.fury.io/py/nlr-bird.svg)](https://badge.fury.io/py/nlr-bird)

## Quick start
1. Follow the steps to install the python package (see `Installation of python package for developers` or `Installation of python package for users` below)
Expand Down
8 changes: 0 additions & 8 deletions bird/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion bird/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Bio reactor design version"""

__version__ = "0.0.52"
__version__ = "0.0.53"
2 changes: 0 additions & 2 deletions dist.sh

This file was deleted.

4 changes: 2 additions & 2 deletions docs/source/contribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ You can automatically enforce the formatting guidelines with

.. code-block:: console

pip install black isort codespell
bash fixFormat.sh
pip install nox
nox -s lint -- write


Tests
Expand Down
4 changes: 0 additions & 4 deletions fixFormat.sh

This file was deleted.

181 changes: 181 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# noxfile.py

import importlib
import os
import shutil

import nox

nox.options.sessions = []


@nox.session(name="cleanup", python=False)
def run_cleanup(session: nox.Session) -> None:
"""Use os/shutil to remove some files/directories"""

if os.path.exists(".coverage"):
os.remove(".coverage")

if os.path.exists("reports"):
shutil.rmtree("reports")

folders = [".pytest_cache"]
for f in folders:
if os.path.exists(f):
shutil.rmtree(f)

# Recursively delete all __pycache__ folders and .pyc files
session.run(
"find",
".",
"-type",
"d",
"-name",
"__pycache__",
"-exec",
"rm",
"-r",
"{}",
"+",
external=True,
)
session.run(
"find", ".", "-type", "f", "-name", "*.pyc", "-delete", external=True
)


@nox.session(name="lint", python=False)
@nox.session(name="linter", python=False)
def run_lint(session: nox.Session) -> None:
"""
Run black and isort with the github config file

"""

session.run("pip", "install", "--upgrade", "--quiet", "black")
session.run("pip", "install", "--upgrade", "--quiet", "isort")

black_command = [
"black",
"--line-length",
"79",
"--target-version",
"py310",
".",
]
isort_command = [
"isort",
"--profile",
"black",
"--multi-line",
"3",
"--trailing-comma",
"--force-grid-wrap",
"0",
"--line-length",
"79",
"--use-parentheses",
".",
]

if not "write" in session.posargs:
black_command.insert(1, "--check")
isort_command.insert(1, "--check-only")
isort_command.insert(2, "--diff")

session.run(*black_command)
session.run(*isort_command)


@nox.session(name="spell", python=False)
@nox.session(name="codespell", python=False)
def run_codespell(session: nox.Session) -> None:
"""
Run codespell with the github config file

Use the optional 'write' argument to write the corrections directly into
the files. Otherwise, you will only see a summary of the found errors.

"""

session.run("pip", "install", "--upgrade", "--quiet", "codespell")
command = ["codespell", "--config", ".github/linters/.codespellrc"]

if "write" in session.posargs:
command.append("-w")

session.run(*command)


@nox.session(name="pypi", python=False)
@nox.session(name="deploy", python=False)
def run_deploy(session: nox.Session) -> None:
"""
Deploy to pypi
"""
session.run("pip", "install", "build")
session.run("pip", "install", "twine")
session.run("python", "-m", "build")
session.run(
"python",
"-m",
"twine",
"upload",
"--verbose",
"--repository",
"pypi",
"dist/*",
)


@nox.session(name="tests", python=False)
@nox.session(name="test", python=False)
def run_pytest(session: nox.Session) -> None:
"""
Run pytest and generate test/coverage reports

Use the optional 'parallel' argument to run the tests in parallel. As just
a flag, the number of workers will be determined automatically. Otherwise,
you can specify the number of workers using an int, e.g., parallel=4.

"""

package = importlib.util.find_spec("bird")

if "no-reports" in session.posargs:
command = [
"pytest",
f"--cov=.", # for editable or site-packages
"tests/",
]
else:
command = [
"pytest",
"--cov=bird",
"--cov-report=html:reports/htmlcov",
"--cov-report=xml:reports/coverage.xml",
"--junitxml=reports/junit.xml",
"tests/",
]

for arg in session.posargs:
if arg.startswith("parallel="):
command[1:1] = ["-n", arg.split("=")[-1]]
elif arg.startswith("parallel"):
command[1:1] = ["-n", "auto"]
session.run(*command)
run_cleanup(session)


def run_pre_commit(session: nox.Session) -> None:
"""
Run all linters/tests and make new badges

Order of sessions: flake8, codespell, pytest, genbade. Using 'format' for
linter, 'write' for codespell, and/or 'parallel' for pytest is permitted.

"""

run_lint(session)
run_codespell(session)
run_pytest(session)
Loading
Loading