-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: celmech (ipynb) | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest matplotlib scipy | ||
pip install wheel setuptools | ||
- name: Install Celmech | ||
run: | | ||
pip install -e . -v | ||
- name: Running jupyter notebooks | ||
run: | | ||
cd jupyter_examples | ||
python ipynb2py.py QuickstartExample.ipynb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: celmech (python) | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
name: Python tests on ${{ matrix.os }} (${{ matrix.python-version }}) | ||
timeout-minutes: 10 | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
os: [ubuntu-latest, macos-11] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest wheel setuptools numpy matplotlib | ||
pip install -e . -v | ||
- name: Output package contents | ||
run: pip show celmech -vf | ||
- name: Run unit tests | ||
run: python -m unittest discover -s celmech/test/ -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import json | ||
import sys | ||
exec("import matplotlib as mpl") | ||
exec("mpl.use(\"Agg\")") | ||
|
||
if len(sys.argv)!=2: | ||
print("Usage: ipynb2py.py FILENAME") | ||
exit(1) | ||
with open(sys.argv[1]) as data_file: | ||
ipynb = json.load(data_file) | ||
|
||
code = "" | ||
for c in ipynb["cells"]: | ||
if c["cell_type"] == "code": | ||
source = c["source"] | ||
for s in source: | ||
if s[0] != "%": | ||
code += s.rstrip('\n')+"\n" | ||
import socket | ||
try: | ||
exec(code) | ||
except socket.error: | ||
print("A socket error occured. This is most likely due to a timeout in the NASA Horizons connections. We catch this exception here and ignore is.") | ||
pass |