Skip to content

Commit

Permalink
Merge pull request #209 from snek5000/requirements
Browse files Browse the repository at this point in the history
Using fluidsim-core 0.7.0rc0
  • Loading branch information
paugier committed Nov 23, 2022
2 parents fa55afe + 6f48b12 commit 9906a08
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
max-parallel: 5
matrix:
python-version: [3.8, 3.9, "3.10"]
python-version: ["3.8", "3.9", "3.10"]

steps:
- name: Checkout
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.8"
cache: "pip"
cache-dependency-path: "requirements/docs.txt"

Expand Down
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ tutorial](https://snek5000.readthedocs.io/en/latest/packaging.html)).

With a Snek5000-Fluidsim solver, it becomes very easy to

- launch/restart simulations with Python scripts
- launch/restart simulations with Python scripts and terminal commands,
- load simulations, read the associated parameters/data and produce nice
figures/movies
figures/movies.

Snek5000 can be seen as a workflow manager for Nek5000 or a thin Python wrapper
Snek5000 can be seen as a workflow manager for Nek5000 or a Python wrapper
around Nek5000. It uses Nek5000 on the background and is thus NOT a rewrite of
Nek5000!

Snek5000 is powered by nice Python packages such as [Snakemake], [Fluidsim],
Matplotlib, Jinja, Pytest, Xarray, etc.
[Pymech], Matplotlib, Jinja, Pytest, Xarray, etc.

## Quick start

Expand Down Expand Up @@ -86,14 +86,10 @@ A simulation directory is created automatically (with this example, something
like
`~/Sim_data/examples_snek_phill/phill_readme_12x10x8_V1.x1.x1._2022-10-27_15-21-58`).
Then, the simulation object can be recreated from this directory. An easy way
would be to go into this directory, start IPython with `ipython --matplotlib`
and run:
would be to go into this directory, start IPython with the `snek-ipy-load`
command, and run:

```python
from snek5000 import load

sim = load()

# get/print the simulation parameters from the object
sim.params

Expand Down Expand Up @@ -206,6 +202,7 @@ and submitting patches. See [contributing guidelines](CONTRIBUTING.md).
[fluidsim]: https://fluidsim.readthedocs.io
[nek5000]: https://nek5000.mcs.anl.gov/
[parameter container object]: https://fluiddyn.readthedocs.io/en/latest/generated/fluiddyn.util.paramcontainer.html
[pymech]: https://github.com/eX-Mech/pymech
[snakemake]: https://snakemake.readthedocs.io
[snek5000-cbox]: https://github.com/snek5000/snek5000-cbox
[snek5000-phill]: https://github.com/snek5000/snek5000-phill
Expand Down
3 changes: 1 addition & 2 deletions requirements/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ CI servers and developers.
Run:

```sh
pip install invoke
invoke --help
make list-sessions
```
3 changes: 1 addition & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ fluiddyn==0.5.1
# fluidsim-core
# snek5000
# snek5000 (setup.cfg)
fluidsim-core @ hg+https://foss.heptapod.net/fluiddyn/fluidsim#subdirectory=lib
fluidsim-core==0.7.0rc0
# via
# -r requirements/vcs_packages.in
# snek5000
# snek5000 (setup.cfg)
fonttools==4.38.0
Expand Down
3 changes: 1 addition & 2 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ fluiddyn==0.5.1
# fluidsim-core
# snek5000
# snek5000 (setup.cfg)
fluidsim-core @ hg+https://foss.heptapod.net/fluiddyn/fluidsim#subdirectory=lib
fluidsim-core==0.7.0rc0
# via
# -r requirements/vcs_packages.in
# snek5000
# snek5000 (setup.cfg)
fonttools==4.38.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/main.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fluiddyn==0.5.1
# via
# fluidsim-core
# snek5000 (setup.cfg)
fluidsim-core==0.6.1
fluidsim-core==0.7.0rc0
# via snek5000 (setup.cfg)
fonttools==4.38.0
# via matplotlib
Expand Down
3 changes: 1 addition & 2 deletions requirements/tests-editable.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ fluiddyn==0.5.1
# fluidsim-core
# snek5000
# snek5000 (setup.cfg)
fluidsim-core @ hg+https://foss.heptapod.net/fluiddyn/fluidsim#subdirectory=lib
fluidsim-core==0.7.0rc0
# via
# -r requirements/vcs_packages.in
# snek5000
# snek5000 (setup.cfg)
fonttools==4.38.0
Expand Down
3 changes: 1 addition & 2 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ fluiddyn==0.5.1
# fluidsim-core
# snek5000
# snek5000 (setup.cfg)
fluidsim-core @ hg+https://foss.heptapod.net/fluiddyn/fluidsim#subdirectory=lib
fluidsim-core==0.7.0rc0
# via
# -r requirements/vcs_packages.in
# snek5000
# snek5000 (setup.cfg)
fonttools==4.38.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/vcs_packages.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
snek5000-phill @ git+https://github.com/snek5000/snek5000-phill.git@fix/package-name
snek5000-cbox @ git+https://github.com/snek5000/snek5000-cbox.git@stable
# TODO: comment out when fluidsim-core and pymech are released
fluidsim-core @ hg+https://foss.heptapod.net/fluiddyn/fluidsim#subdirectory=lib
# fluidsim-core @ hg+https://foss.heptapod.net/fluiddyn/fluidsim#subdirectory=lib
pymech @ git+https://github.com/eX-Mech/pymech.git
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ packages=find:
install_requires =
snakemake >= 7.15.2
fluiddyn >= 0.4.0
fluidsim-core >= 0.6.1
fluidsim-core >= 0.7.0rc0
pymech >= 1.4.1
pandas
jinja2
inflection
importlib_resources; python_version < "3.7"
pyyaml
filelock

Expand Down
2 changes: 1 addition & 1 deletion src/snek5000/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def snek_make():
parser.add_argument(
"--clean-after-fail",
action="store_true",
help="Keep incomplete output files of failed jobs.",
help="Clean incomplete output files of failed jobs.",
)

args = parser.parse_args()
Expand Down
24 changes: 6 additions & 18 deletions tests/test_make.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import os
import sys
from concurrent.futures import ProcessPoolExecutor as Pool
from concurrent.futures import as_completed
from contextlib import contextmanager
from pathlib import Path
from unittest.mock import patch

Expand Down Expand Up @@ -42,24 +40,14 @@ def test_snek_make_help():
snek_make()


@contextmanager
def current_dir_changed_to(path):
cwd = Path.cwd()
os.chdir(path)
try:
yield
finally:
os.chdir(cwd)


def test_snek_make_no_rule(sim_data):
def test_snek_make_no_rule(sim_data, monkeypatch):
monkeypatch.chdir(sim_data)
with patch.object(sys, "argv", ["snek-make"]):
with pytest.raises(SystemExit):
with current_dir_changed_to(sim_data):
snek_make()
snek_make()


def test_snek_make_clean(sim_data):
def test_snek_make_clean(sim_data, monkeypatch):
monkeypatch.chdir(sim_data)
with patch.object(sys, "argv", ["snek-make", "clean"]):
with current_dir_changed_to(sim_data):
snek_make()
snek_make()

0 comments on commit 9906a08

Please sign in to comment.