Skip to content

Commit 4db7342

Browse files
authored
Merge pull request #3 from NREL/feature/jit-support
Feature/jit support
2 parents 7c6b9a9 + 9fd5f20 commit 4db7342

21 files changed

+125
-138
lines changed

.github/workflows/ci.yml

+17-25
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,14 @@ jobs:
4444
with:
4545
python-version: ${{ matrix.python-version }}
4646

47-
- name: Spell check
48-
run: |
49-
pip install codespell
50-
codespell --config .github/linters/.codespellrc
51-
47+
- name: Install nox
48+
run: pip install nox
49+
5250
- name: Code format
53-
run: |
54-
pip install flake8
55-
flake8 --config .github/linters/.flake8 src
56-
flake8 --config .github/linters/.flake8 tests
51+
run: nox -s linter
52+
53+
- name: Spell check
54+
run: nox -s codespell
5755

5856
test:
5957
name: (Test ${{ matrix.python-version }}, ${{ matrix.os }})
@@ -73,33 +71,27 @@ jobs:
7371
- name: Checkout repository
7472
uses: actions/checkout@v4
7573

76-
- name: Setup conda/python
77-
uses: conda-incubator/setup-miniconda@v3
74+
- name: Setup Python and SUNDIALS
75+
uses: mamba-org/setup-micromamba@v2
7876
with: # ci_environment.yml specifies sundials version to compile
79-
auto-update-conda: true
80-
miniconda-version: latest
8177
environment-file: environments/ci_environment.yml
82-
python-version: ${{ matrix.python-version }}
83-
activate-environment: sun
84-
channels: conda-forge
85-
conda-remove-defaults: "true"
78+
create-args: python=${{ matrix.python-version }}
8679

8780
- name: Verify environment
8881
run: |
89-
conda info
90-
conda list
82+
micromamba info
83+
micromamba list
9184
9285
- name: Install scikit-sundae
9386
run: |
9487
python -m pip install --upgrade pip
95-
pip install .
88+
python -m pip install --upgrade nox
89+
pip install .[tests]
9690
9791
- name: List info
9892
run: |
99-
conda info
100-
conda list
93+
micromamba info
94+
micromamba list
10195
10296
- name: Pytest
103-
run: |
104-
pip install pandas pytest
105-
pytest .
97+
run: nox -s tests -- no-reports

.github/workflows/release.yml

+13-23
Original file line numberDiff line numberDiff line change
@@ -87,24 +87,19 @@ jobs:
8787
- name: Checkout repository
8888
uses: actions/checkout@v4
8989

90-
- name: Setup conda/python
91-
uses: conda-incubator/setup-miniconda@v3
92-
with: # ci_environment.yml specifies sundials version to compile against
93-
auto-update-conda: true
94-
miniconda-version: latest
90+
- name: Setup Python and SUNDIALS
91+
uses: mamba-org/setup-micromamba@v2
92+
with: # ci_environment.yml specifies sundials version to compile
9593
environment-file: environments/ci_environment.yml
96-
python-version: ${{ matrix.python-version }}
97-
activate-environment: sun
98-
channels: conda-forge
99-
conda-remove-defaults: "true"
94+
create-args: python=${{ matrix.python-version }}
10095

10196
- name: Install build
10297
run: pip install build
10398

10499
- name: List info
105100
run: |
106-
conda info
107-
conda list
101+
micromamba info
102+
micromamba list
108103
109104
- name: Set up environment variables for MacOS
110105
if: runner.os == 'macOS'
@@ -153,9 +148,9 @@ jobs:
153148
env: # Remove known SUNDIALS header and lib paths
154149
DYLD_LIBRARY_PATH:
155150
run: |
156-
conda uninstall sundials
157-
conda create -n test python=${{ matrix.python-version }}
158-
conda activate test
151+
micromamba remove sundials
152+
micromamba create -n test python=${{ matrix.python-version }}
153+
micromamba activate test
159154
160155
python -m pip install --upgrade pip
161156
pip install wheels/*.whl -v
@@ -188,16 +183,11 @@ jobs:
188183
- name: Checkout repository
189184
uses: actions/checkout@v4
190185

191-
- name: Setup conda/python
192-
uses: conda-incubator/setup-miniconda@v3
193-
with: # ci_environment.yml specifies sundials version to compile against
194-
auto-update-conda: true
195-
miniconda-version: latest
186+
- name: Setup Python and SUNDIALS
187+
uses: mamba-org/setup-micromamba@v2
188+
with: # ci_environment.yml specifies sundials version to compile
196189
environment-file: environments/ci_environment.yml
197-
python-version: ${{ matrix.python-version }}
198-
activate-environment: sun
199-
channels: conda-forge
200-
conda-remove-defaults: "true"
190+
create-args: python=${{ matrix.python-version }}
201191

202192
- name: Install build
203193
run: pip install build

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
## [Unreleased](https://github.com/NREL/scikit-sundae/)
44

55
### New Features
6+
- Changed signature inspections to support decorated `jit` functions ([PR #3](https://github.com/NREL/scikit-sundae/pull/3))
67

78
### Optimizations
9+
- Use `micromamba` instead of `miniconda` in CI ([PR #3](https://github.com/NREL/scikit-sundae/pull/3))
810

911
### Bug Fixes
1012

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ For convenience, we also provide the following for your BibTex:
100100
```
101101

102102
## Acknowledgements
103-
scikit-SUNDAE was originally inspired by [scikits.odes](https://scikits-odes.readthedocs.io/) which also offers Python bindings to SUNDIALS. The API for scikit-SUNDAE was mostly adopted from scikits.odes; however, all of our source code is original. If you are comparing the two:
103+
scikit-SUNDAE was originally inspired by [scikits-odes](https://scikits-odes.readthedocs.io/) which also offers Python bindings to SUNDIALS. The API for scikit-SUNDAE was mostly adopted from scikits-odes; however, all of our source code is original. If you are comparing the two:
104104

105-
1. **scikits.odes:** includes iterative solvers and some optional solvers (e.g., LAPACK). The package only provides source distributions, so users must configure and compile SUNDAILS on their own.
105+
1. **scikits-odes:** includes iterative solvers and some optional solvers (e.g., LAPACK). The package only provides source distributions, so users must configure and compile SUNDAILS on their own.
106106
2. **scikit-SUNDAE:** includes more flexible events function capabilities (e.g., direction detection and terminal flags), scipy-like output, and provides both binary and source distributions. Iterative and optional solvers are not available.
107107

108108
Our binary distributions include pre-compiled dynamic SUNDIALS libraries. These are self-contained and will not affect other, existing installations you may already have. To be in compliance with SUNDIALS distribution requirements, all scikit-SUNDAE distributions include a copy of the [SUNDIALS license](https://github.com/LLNL/sundials/blob/main/LICENSE).
Loading
Loading
Loading
Loading
Loading
Loading

docs/jupyter_execute/examples/robertson.ipynb

+5-5
Large diffs are not rendered by default.

docs/jupyter_execute/examples/van_der_pol.ipynb

+4-4
Large diffs are not rendered by default.

docs/source/api/sksundae/index.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ sksundae
2121

2222
Documentation is accessible via Python's ``help()`` function which prints
2323
docstrings from a package, module, function, class, etc. You can also access
24-
the documentation by visiting the website, hosted through GitHub pages. The
25-
website includes search functionality and more detailed examples.
24+
the documentation by visiting the website, hosted on Read the Docs. The website
25+
includes search functionality and more detailed examples.
2626

2727
.. rubric:: Acknowledgements
2828

@@ -34,10 +34,10 @@ sksundae
3434
many packages, DAE solvers are not as prevalent.
3535

3636
scikit-SUNDAE started out as a lighter-weight and easy-to-install alternative
37-
to `scikits.odes`_, which similarly provides SUNDIALS bindings, but requires
37+
to `scikits-odes`_, which similarly provides SUNDIALS bindings, but requires
3838
building from source. The goal was to offer a simpler installation process,
3939
with binary distributions that are consistent across major platforms (PyPI and
40-
conda). While scikit-SUNDAE's API was mostly modeled after scikits.odes, we
40+
conda). While scikit-SUNDAE's API was mostly modeled after scikits-odes, we
4141
want to point out that our codebase was written from scratch and that this is
4242
a separate, independent package. During development we prioritized:
4343

@@ -52,7 +52,7 @@ sksundae
5252
Lawrence Livermore National Security and Southern Methodist University. All
5353
rights reserved.
5454

55-
.. _scikits.odes: https://scikits-odes.readthedocs.io
55+
.. _scikits-odes: https://scikits-odes.readthedocs.io
5656
.. _conda-forge: https://anaconda.org/conda-forge/sundials
5757
.. _scipy.integrate: https://docs.scipy.org/doc/scipy/reference/integrate.html
5858
.. _SUNDIALS license: https://github.com/LLNL/sundials/blob/main/LICENSE

docs/source/development/project_overview.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Project Origins
4747
---------------
4848
scikit-SUNDAE was written by researchers at the **National Renewable Energy Laboratory (NREL)** primarily to solve physics-based battery models. Modeling in Python typically allows for rapid development and makes codebases more shareable. However, there was an identified gap in Python's numerical computing ecosystem: the lack of accessible DAE solvers. While ODE solvers are widely available in many packages, DAE solvers are not as prevalent.
4949

50-
scikit-SUNDAE started out as a replacement for `scikits.odes <https://scikits-odes.readthedocs.io>`_, which also provides SUNDIALS bindings, but requires building from source. The goal was to offer a simpler installation process, with binary distributions that are consistent across major platforms (PyPI and conda).
50+
scikit-SUNDAE started out as a replacement for `scikits-odes <https://scikits-odes.readthedocs.io>`_, which also provides SUNDIALS bindings, but requires building from source. The goal was to offer a simpler installation process, with binary distributions that are consistent across major platforms (PyPI and conda).
5151

5252
Roadmap and Future Directions
5353
-----------------------------

docs/source/user_guide/installation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Installing scikit-SUNDAE from source is recommended only in the following cases:
9797

9898
.. note::
9999

100-
Please be aware that we do not provide installation support for users compiling or against custom SUNDIALS builds. Our package is built and tested against releases available on conda-forge, and we cannot guarantee compatibility with custom builds. We simply include this in the installation instructions for those interested. However, you are on your own if the package does not compile against your custom-configured SUNDIALS. In you experience issues, we recommend compiling against SUNDIALS releases from conda-forge instead, which we do provide support for.
100+
Please be aware that we do not provide installation support for users compiling against custom SUNDIALS builds. Our package is built and tested against releases available on conda-forge, and we cannot guarantee compatibility with custom builds. We simply include this in the installation instructions for those interested. However, you are on your own if the package does not compile against your custom configuration. In you experience issues, we recommend compiling against SUNDIALS releases from conda-forge instead, which we provide support for.
101101

102102
Instructions
103103
^^^^^^^^^^^^

docs/source/user_guide/what_is_sksundae.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ Acknowledgements
3434
================
3535
We extend our appreciation to the developers and maintainers of the SUNDIALS project for their exceptional work in creating a robust, reliable, and open-source suite of solvers. Full details on the SUNDIALS license and copyright information can be found `here <https://github.com/LLNL/sundials/blob/main/LICENSE>`_.
3636

37-
We also acknowledge the `scikits.odes <https://scikits-odes.readthedocs.io/>`_ package, which similarly provides Python bindings to SUNDIALS. While scikit-SUNDAE's API was largely modeled after scikits.odes to maintain a familiar structure, it is important to note that scikit-SUNDAE is an independently developed package, sharing no source code with scikits.odes.
37+
We also acknowledge the `scikits-odes <https://scikits-odes.readthedocs.io/>`_ package, which similarly provides Python bindings to SUNDIALS. While scikit-SUNDAE's API was largely modeled after scikits-odes to maintain a familiar structure, it is important to note that scikit-SUNDAE is an independently developed package, sharing no source code with scikits-odes.
3838

39-
If you are comparing scikits.odes to scikit-SUNDAE, you should consider the following differences:
39+
If you are comparing scikits-odes to scikit-SUNDAE, you should consider the following differences:
4040

41-
* **scikits.odes** includes iterative solvers and some optional solvers (e.g., LAPACK). The package only provides source distributions, so users must configure and compile SUNDAILS on their own.
41+
* **scikits-odes** includes iterative solvers and some optional solvers (e.g., LAPACK). The package only provides source distributions, so users must configure and compile SUNDAILS on their own.
4242
* **scikit-SUNDAE** provides more flexible events function capabilities (e.g., direction detection and terminal flags), scipy-like output, and provides both binary and source distributions. Users not already familiar with SUNDIALS will likely prefer scikit-SUNDAE due to the streamlined installation process.
4343

4444
scikit-SUNDAE was authored by the National Renewable Energy Laboratory (NREL), operated by Alliance for Sustainable Energy, LLC, for the U.S. Department of Energy (DOE). The views expressed in the project and documentation do not necessarily represent the views of the DOE or the U.S. Government.

noxfile.py

+31-18
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55

66
import nox
77

8+
nox.options.sessions = []
9+
810

911
@nox.session(name='cleanup', python=False)
10-
def run_cleanup(_):
12+
def run_cleanup(_) -> None:
1113
"""Use os/shutil to remove some files/directories"""
1214

1315
if os.path.exists('.coverage'):
@@ -20,14 +22,16 @@ def run_cleanup(_):
2022

2123

2224
@nox.session(name='linter', python=False)
23-
def run_flake8(session):
25+
def run_flake8(session: nox.Session) -> None:
2426
"""
2527
Run flake8 with the github config file
2628
2729
Use the optional 'format' argument to run autopep8 prior to the linter.
2830
2931
"""
3032

33+
session.run('pip', 'install', '--upgrade', '--quiet', 'flake8')
34+
3135
if 'format' in session.posargs:
3236
session.run('autopep8', '.', '--in-place', '--recursive',
3337
'--global-config=.github/linters/.flake8')
@@ -36,7 +40,7 @@ def run_flake8(session):
3640

3741

3842
@nox.session(name='codespell', python=False)
39-
def run_codespell(session):
43+
def run_codespell(session: nox.Session) -> None:
4044
"""
4145
Run codespell with the github config file
4246
@@ -45,16 +49,17 @@ def run_codespell(session):
4549
4650
"""
4751

48-
command = ['codespell', '--config=.github/linters/.codespellrc']
52+
session.run('pip', 'install', '--upgrade', '--quiet', 'codespell')
4953

54+
command = ['codespell', '--config=.github/linters/.codespellrc']
5055
if 'write' in session.posargs:
5156
command.insert(1, '-w')
5257

5358
session.run(*command)
5459

5560

5661
@nox.session(name='spellcheck', python=False)
57-
def run_spellcheck(session):
62+
def run_spellcheck(session: nox.Session) -> None:
5863
"""
5964
Run codespell with docs files included
6065
@@ -74,7 +79,7 @@ def run_spellcheck(session):
7479

7580

7681
@nox.session(name='tests', python=False)
77-
def run_pytest(session):
82+
def run_pytest(session: nox.Session) -> None:
7883
"""
7984
Run pytest and generate test/coverage reports
8085
@@ -84,14 +89,21 @@ def run_pytest(session):
8489
8590
"""
8691

87-
command = [
88-
'pytest',
89-
'--cov=src/sksundae',
90-
'--cov-report=html:reports/htmlcov',
91-
'--cov-report=xml:reports/coverage.xml',
92-
'--junitxml=reports/junit.xml',
93-
'tests/',
94-
]
92+
if 'no-reports' in session.posargs:
93+
command = [
94+
'pytest',
95+
'--cov=src/sksundae',
96+
'tests/',
97+
]
98+
else:
99+
command = [
100+
'pytest',
101+
'--cov=src/sksundae',
102+
'--cov-report=html:reports/htmlcov',
103+
'--cov-report=xml:reports/coverage.xml',
104+
'--junitxml=reports/junit.xml',
105+
'tests/',
106+
]
95107

96108
for arg in session.posargs:
97109
if arg.startswith('parallel='):
@@ -105,7 +117,7 @@ def run_pytest(session):
105117

106118

107119
@nox.session(name='badges', python=False)
108-
def run_genbadge(session):
120+
def run_genbadge(session: nox.Session) -> None:
109121
"""Run genbadge to make test/coverage badges"""
110122

111123
session.run(
@@ -122,7 +134,7 @@ def run_genbadge(session):
122134

123135

124136
@nox.session(name='docs', python=False)
125-
def run_sphinx(session):
137+
def run_sphinx(session: nox.Session) -> None:
126138
"""
127139
Run spellcheck and then use sphinx to build docs
128140
@@ -148,7 +160,7 @@ def run_sphinx(session):
148160

149161

150162
@nox.session(name='pre-commit', python=False)
151-
def run_pre_commit(session):
163+
def run_pre_commit(session: nox.Session) -> None:
152164
"""
153165
Run all linters/tests and make new badges
154166
@@ -165,7 +177,7 @@ def run_pre_commit(session):
165177

166178

167179
@nox.session(name='rebuild', python=False)
168-
def run_build_ext(session):
180+
def run_build_ext(session: nox.Session) -> None:
169181
"""
170182
Rebuilds the Cython extensions in place
171183
@@ -177,4 +189,5 @@ def run_build_ext(session):
177189
178190
"""
179191

192+
session.run('pip', 'install', '--upgrade', '--quiet', 'cython')
180193
session.run('python', 'setup.py', 'build_ext', '--inplace')

0 commit comments

Comments
 (0)