Skip to content

Commit

Permalink
Merge branch 'master' into generalised-zhang-li
Browse files Browse the repository at this point in the history
  • Loading branch information
lang-m committed Jun 9, 2024
2 parents 833711d + a163e21 commit cb80068
Show file tree
Hide file tree
Showing 38 changed files with 1,656 additions and 546 deletions.
1 change: 0 additions & 1 deletion .github/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ channels:
- conda-forge

dependencies:
- python==3.8
- pip
- oommf
- pip:
Expand Down
37 changes: 0 additions & 37 deletions .github/workflows/conda.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python-version: ["3.8", "3.10"]
defaults:
run:
shell: bash -l {0}

steps:
- name: Initialisation
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
auto-update-conda: true
activate-environment: conda-environment
environment-file: .github/environment.yml
Expand Down
36 changes: 11 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
default_language_version:
python: python3.8
exclude: 'dev'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-merge-conflict # checks for files that contain merge conflict strings
- id: check-toml # checks toml files for parseable syntax
- id: debug-statements # checks for debugger imports and py37+ `breakpoint()` calls in python source
# - id: trailing-whitespace # needs more checks
# args: [--markdown-linebreak-ext=md]
# exclude: 'oommfc/tests/test_sample/.*'

- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.4
hooks:
- id: isort

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.3
hooks:
- id: nbqa-isort # isort inside Jupyter notebooks

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-rst-docstrings] #, flake8-docstrings]

- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black-jupyter
# Run the linter.
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix, --exit-non-zero-on-fix]
# Run the formatter.
- id: ruff-format
types_or: [python, pyi, jupyter]

# - repo: https://github.com/codespell-project/codespell
# rev: v2.1.0
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2022, Marijan Beg and Hans Fangohr
Copyright 2023, Marijan Beg and Hans Fangohr

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
| Description | Badge |
| --- | --- |
| Tests | [![Build status](https://github.com/ubermag/oommfc/workflows/workflow/badge.svg)](https://github.com/ubermag/oommfc/actions?query=workflow%3Aworkflow) |
| | [![conda](https://github.com/ubermag/oommfc/workflows/conda/badge.svg)](https://github.com/ubermag/oommfc/actions?query=workflow%3Aconda) |
| Linting | [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/ubermag/oommfc/master.svg)](https://results.pre-commit.ci/latest/github/ubermag/oommfc/master) |
| | [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |
| Releases | [![PyPI version](https://badge.fury.io/py/oommfc.svg)](https://badge.fury.io/py/oommfc) |
Expand Down Expand Up @@ -79,7 +78,7 @@ Licensed under the BSD 3-Clause "New" or "Revised" License. For details, please

2. M. Beg, R. A. Pepper, and H. Fangohr. User interfaces for computational science: A domain specific language for OOMMF embedded in Python. [*AIP Advances* **7**, 56025](http://aip.scitation.org/doi/10.1063/1.4977225) (2017).

3. Marijan Beg, Martin Lang, Ryan A. Pepper, Thomas Kluyver, Samuel Holt, Swapneel Amit Pathak, and Hans Fangohr. oommfc: OOMMF calculator. DOI: [10.5281/zenodo.3539461](http://doi.org/10.5281/zenodo.3539461) (2022).
3. Marijan Beg, Martin Lang, Ryan A. Pepper, Thomas Kluyver, Samuel Holt, Swapneel Amit Pathak, and Hans Fangohr. oommfc: OOMMF calculator. DOI: [10.5281/zenodo.3539461](http://doi.org/10.5281/zenodo.3539461) (2023).

## Acknowledgements

Expand Down
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ channels:

dependencies:
- python==3.10
- oommfc
- ubermag
41 changes: 23 additions & 18 deletions docs/controlling-default-runner.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
{
"cell_type": "markdown",
"id": "84445477",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"# Controlling the default runner\n",
"In this tutorial we show how to globally controll the default runner. First we import `oommfc`."
Expand Down Expand Up @@ -86,7 +92,7 @@
{
"data": {
"text/plain": [
"ExeOOMMFRunner(/opt/miniconda3/envs/ubermagdev/bin/oommf)"
"ExeOOMMFRunner(/home/mlang/miniconda3/envs/ubermagdev310/bin/oommf)"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -117,7 +123,7 @@
{
"data": {
"text/plain": [
"OOMMF runner: ExeOOMMFRunner(/opt/miniconda3/envs/ubermagdev/bin/oommf)\n",
"OOMMF runner: ExeOOMMFRunner(/home/mlang/miniconda3/envs/ubermagdev310/bin/oommf)\n",
"runner is cached: True"
]
},
Expand Down Expand Up @@ -256,7 +262,7 @@
{
"data": {
"text/plain": [
"OOMMF runner: ExeOOMMFRunner(/opt/miniconda3/envs/ubermagdev/bin/oommf)\n",
"OOMMF runner: ExeOOMMFRunner(/home/mlang/miniconda3/envs/ubermagdev310/bin/oommf)\n",
"runner is cached: True"
]
},
Expand Down Expand Up @@ -299,14 +305,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Running OOMMF (TclOOMMFRunner) [2022/02/16 11:29]... (0.0 s)\n",
"OOMMF error:\n",
"\tcommand: tclsh /path/to/oommf_tcl boxsi +fg macrospin.mif -exitondone 1\n",
"\tstdout: \n",
"\tstderr: couldn't read file \"/path/to/oommf_tcl\": no such file or directory\n",
"\n",
"\n",
"\n",
"Running OOMMF (TclOOMMFRunner)[2023/10/18 12:33]... (0.0 s)\n",
"Cannot find OOMMF.\n"
]
},
Expand All @@ -317,8 +316,8 @@
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [10]\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0m oommfc\u001b[38;5;241m.\u001b[39mrunner\u001b[38;5;241m.\u001b[39mrunner \u001b[38;5;241m=\u001b[39m oommfc\u001b[38;5;241m.\u001b[39moommf\u001b[38;5;241m.\u001b[39mTclOOMMFRunner(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/path/to/oommf_tcl\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"File \u001b[0;32m~/PhD/repos/ubermag-devtools/repos/oommfc/oommfc/oommf/oommf.py:432\u001b[0m, in \u001b[0;36mRunner.runner\u001b[0;34m(self, runner)\u001b[0m\n\u001b[1;32m 429\u001b[0m \u001b[38;5;129m@runner\u001b[39m\u001b[38;5;241m.\u001b[39msetter\n\u001b[1;32m 430\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrunner\u001b[39m(\u001b[38;5;28mself\u001b[39m, runner):\n\u001b[1;32m 431\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m runner\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 432\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mrunner\u001b[38;5;132;01m=}\u001b[39;00m\u001b[38;5;124m cannot be used.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 433\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_runner \u001b[38;5;241m=\u001b[39m runner\n",
"Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43moommfc\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrunner\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrunner\u001b[49m \u001b[38;5;241m=\u001b[39m oommfc\u001b[38;5;241m.\u001b[39moommf\u001b[38;5;241m.\u001b[39mTclOOMMFRunner(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m/path/to/oommf_tcl\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
"File \u001b[0;32m~/repos/ubermag-devtools/repos/oommfc/oommfc/oommf/oommf.py:441\u001b[0m, in \u001b[0;36mRunner.runner\u001b[0;34m(self, runner)\u001b[0m\n\u001b[1;32m 438\u001b[0m \u001b[38;5;129m@runner\u001b[39m\u001b[38;5;241m.\u001b[39msetter\n\u001b[1;32m 439\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrunner\u001b[39m(\u001b[38;5;28mself\u001b[39m, runner):\n\u001b[1;32m 440\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m runner\u001b[38;5;241m.\u001b[39mstatus \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m--> 441\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mrunner\u001b[38;5;132;01m=}\u001b[39;00m\u001b[38;5;124m cannot be used.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 442\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_runner \u001b[38;5;241m=\u001b[39m runner\n",
"\u001b[0;31mValueError\u001b[0m: runner=TclOOMMFRunner(/path/to/oommf_tcl) cannot be used."
]
}
Expand All @@ -344,7 +343,7 @@
{
"data": {
"text/plain": [
"OOMMF runner: ExeOOMMFRunner(/opt/miniconda3/envs/ubermagdev/bin/oommf)\n",
"OOMMF runner: ExeOOMMFRunner(/home/mlang/miniconda3/envs/ubermagdev310/bin/oommf)\n",
"runner is cached: True"
]
},
Expand Down Expand Up @@ -388,12 +387,18 @@
"cell_type": "code",
"execution_count": 13,
"id": "8c577eb3",
"metadata": {},
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"OOMMF runner: ExeOOMMFRunner(/opt/miniconda3/envs/ubermagdev/bin/oommf)\n",
"OOMMF runner: ExeOOMMFRunner(/home/mlang/miniconda3/envs/ubermagdev310/bin/oommf)\n",
"runner is cached: True"
]
},
Expand Down Expand Up @@ -423,7 +428,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.12"
"version": "3.10.12"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
Loading

0 comments on commit cb80068

Please sign in to comment.