Skip to content

Commit 3386d4a

Browse files
committed
Merge branch 'development' into experimental
2 parents 49d9fc6 + 50c54c5 commit 3386d4a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+6347
-202
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
name: Format
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v1
16-
- uses: actions/setup-python@v2
17-
- uses: pre-commit/action@v2.0.0
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-python@v3
17+
- uses: pre-commit/action@v3.0.0
1818
with:
1919
extra_args: --hook-stage manual --all-files
2020

@@ -24,13 +24,13 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
27+
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2828
runs-on: [ubuntu-latest, macos-latest, windows-latest]
2929

3030
steps:
31-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v3
3232
- name: Set up Python ${{ matrix.python-version }}
33-
uses: actions/setup-python@v2
33+
uses: actions/setup-python@v3
3434
with:
3535
python-version: ${{ matrix.python-version }}
3636

@@ -55,24 +55,29 @@ jobs:
5555
run: |
5656
pip list
5757
58-
- name: Run some examples
58+
- name: Run simple examples
5959
run: |
6060
cd examples
6161
python document.py
6262
6363
cd test
6464
python test.py
6565
66-
## Test NeuroML example
66+
- name: Test NeuroML examples
67+
if: ${{ matrix.python-version != '3.7'}}
68+
run: |
6769
68-
cd ../neuroml2
70+
cd examples/neuroml2
6971
python neuroml2_spec.py
7072
71-
pip install pyneuroml
73+
# Note: NeuroML files will be validated with OMV below
74+
75+
- name: Test SBML examples
76+
if: ${{ matrix.python-version != '3.7'}}
77+
run: |
7278
73-
# Requires: pip install pyneuroml
74-
pynml -validate hello_world_neuroml.net.nml
75-
pynml -validate TestNeuroML.xml
79+
cd examples/sbml
80+
./regenerateAndTest.sh
7681
7782
- name: Run pytest
7883
run: |
@@ -86,7 +91,6 @@ jobs:
8691
cd examples
8792
python Example1.py
8893
89-
9094
- name: Install MDF
9195
run: |
9296
@@ -97,8 +101,9 @@ jobs:
97101
python arrays.py -run # test one example
98102
99103
- name: Build Documentation
104+
if: ${{ matrix.python-version != '3.7'}}
100105
run: |
101-
106+
# Note: contributors generation below fails on py 3.7 due to pandas version...
102107
pip install .[docs]
103108
cd docs
104109
python generate.py
@@ -107,6 +112,20 @@ jobs:
107112
make clean
108113
make html
109114
115+
- name: Install and test with OMV
116+
if: ${{ matrix.runs-on != 'windows-latest' }}
117+
run: |
118+
# Note: OMV not well tested on Windows...
119+
120+
pip install git+https://github.com/OpenSourceBrain/osb-model-validation
121+
pip install scipy sympy matplotlib cython pandas tables
122+
123+
# Run OMV tests on all engines
124+
cd examples
125+
omv all -V
126+
127+
omv list -V # list installed engines
128+
110129
- name: Final version info
111130
run: |
112131
pip list

.github/workflows/static.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Single deploy job since we're just deploying
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v4
37+
with:
38+
python-version: 3.9
39+
40+
- name: Install package
41+
run: |
42+
python -m pip install --upgrade pip
43+
pip install .[dev]
44+
45+
- name: List packages so far
46+
run: |
47+
pip list
48+
49+
- name: Build Documentation
50+
run: |
51+
52+
pip install .[docs]
53+
cd docs
54+
python generate.py
55+
python contributors.py
56+
cd sphinx
57+
make clean
58+
make html
59+
60+
- name: Setup Pages
61+
uses: actions/configure-pages@v3
62+
63+
- name: Upload artifact
64+
uses: actions/upload-pages-artifact@v2
65+
with:
66+
# Upload just docs
67+
path: 'docs/sphinx/build/html'
68+
69+
- name: Deploy to GitHub Pages
70+
id: deployment
71+
uses: actions/deploy-pages@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,4 @@ cython_debug/
163163
.idea/
164164
/examples/document.specification.bson
165165
/examples/neuroml2/hello_world.v.dat
166+
/examples/sbml/example_sbml_test.xml

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Modelspec
22

3-
43
[![Continuous builds](https://github.com/ModECI/modelspec/actions/workflows/ci.yml/badge.svg)](https://github.com/ModECI/modelspec/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/modelspec)](https://pypi.org/project/modelspec/)
54

6-
7-
Functionality for specifying the structure of models & enabling automatic serialization to them (e.g. in JSON and YAML format).
5+
Functionality for specifying the allowed structure of models, facilitating the creation of APIs in Python for handling the models & enabling automatic serialization of instances of them (e.g. in JSON and YAML format).
86

97
This package is being used by [NeuroMLlite](https://github.com/NeuroML/NeuroMLlite) & [MDF](https://github.com/ModECI/MDF).
108

docs/contributors.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,50 +17,57 @@
1717
len_per_info = len(per_info)
1818

1919
empty_list = []
20+
max_tries = 100
21+
2022
for i in range(len_per_info):
2123
url = per_info[i]
2224
print(url)
2325
data = requests.get(url=url)
2426
requests_status = "unknown"
25-
while (requests_status == "unknown") or (requests_status == "unsuccessful"):
27+
while max_tries > 0 and (
28+
(requests_status == "unknown") or (requests_status == "unsuccessful")
29+
):
2630
if data.status_code == 200:
2731
requests_status = "successful"
32+
print(" Received: %s" % data.json())
2833
empty_list.append(data.json())
2934
else:
3035
# handle failure on requests to the url for mac os
3136
requests_status = "unsuccessful"
3237
print(f"Failed to get data from: {url}")
3338
# make request again to get data from the url
3439
data = requests.get(url=url)
40+
max_tries -= 1
3541

36-
df1 = pd.DataFrame(empty_list)
37-
df1["name"] = df1["name"].fillna("")
38-
name = df1["name"]
39-
login = df1["login"]
40-
url_html = df1["html_url"]
41-
url_id = df1["id"]
42+
if len(empty_list) > 0:
43+
df1 = pd.DataFrame(empty_list)
44+
df1["name"] = df1["name"].fillna(df1["login"])
45+
name = df1["name"]
46+
login = df1["login"]
47+
url_html = df1["html_url"]
48+
url_id = df1["id"]
4249

43-
login_html = list(zip(name, login, url_html))
44-
zip_dict = dict(zip(url_id, login_html))
50+
login_html = list(zip(name, login, url_html))
51+
zip_dict = dict(zip(url_id, login_html))
4552

46-
file = "sphinx/source/api/Contributors.md"
47-
with open(file, "w") as f:
48-
print(
49-
textwrap.dedent(
50-
"""\
51-
(Modelspec:contributors)=
53+
file = "sphinx/source/api/Contributors.md"
54+
with open(file, "w") as f:
55+
print(
56+
textwrap.dedent(
57+
"""\
58+
(Modelspec:contributors)=
5259
53-
# Modelspec contributors
60+
# Modelspec contributors
5461
55-
This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
56-
This page is generated periodically, most recently on {}.""".format(
57-
date.today()
58-
)
59-
),
60-
file=f,
61-
)
62+
This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
63+
This page is generated periodically, most recently on {}.""".format(
64+
date.today()
65+
)
66+
),
67+
file=f,
68+
)
6269

63-
print("", file=f)
70+
print("", file=f)
6471

65-
for key, val in zip_dict.items():
66-
print("- {} ([@{}]({}))".format(val[0], val[1], val[2]), file=f)
72+
for key, val in zip_dict.items():
73+
print("- {} ([@{}]({}))".format(val[0], val[1], val[2]), file=f)

docs/sphinx/source/api/Contributors.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# Modelspec contributors
44

55
This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
6-
This page is generated periodically, most recently on 2023-07-05.
6+
This page is generated periodically, most recently on 2023-12-13.
77

88
- Padraig Gleeson ([@pgleeson](https://github.com/pgleeson))
9+
- Manifest Chakalov ([@mqnifestkelvin](https://github.com/mqnifestkelvin))
910
- David Turner ([@davidt0x](https://github.com/davidt0x))
11+
- Peace Ododo ([@Onoyiza](https://github.com/Onoyiza))
1012
- Parikshit Singh Rathore ([@parikshit14](https://github.com/parikshit14))
11-
- Katherine Mantel ([@kmantel](https://github.com/kmantel))
13+
- Ankur Sinha ([@sanjayankur31](https://github.com/sanjayankur31))
14+
- kmantel ([@kmantel](https://github.com/kmantel))

docs/sphinx/source/api/Introduction.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# Modelspec
22

3-
43
[![Continuous builds](https://github.com/ModECI/modelspec/actions/workflows/ci.yml/badge.svg)](https://github.com/ModECI/modelspec/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/modelspec)](https://pypi.org/project/modelspec/)
54

6-
7-
Functionality for specifying the structure of models & enabling automatic serialization to them (e.g. in JSON and YAML format).
5+
Functionality for specifying the allowed structure of models, facilitating the creation of APIs in Python for handling the models & enabling automatic serialization of instances of them (e.g. in JSON and YAML format).
86

97
This package is being used by [NeuroMLlite](https://github.com/NeuroML/NeuroMLlite) & [MDF](https://github.com/ModECI/MDF).
108

docs/sphinx/source/api/Quickstart.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ More details, and importantly, how to set up a [virtual environment](https://vir
1515

1616
### Simple example
1717

18-
A basic example which illustrates how to create the specification for a document(model) and create serialized instances can be found [here](examples/README).
18+
A basic example which illustrates how to create the specification for a document (i.e. the model definition for a document) and create serialized instances can be found [here](examples/README).
1919

2020
### Serialization formats
2121

22-
Python scripts can be used to generate the specification of a type of model(e.g. [this](https://github.com/ModECI/modelspec/blob/main/examples/document.py)), but the models are saved in standardized format in either text based [JSON](https://github.com/ModECI/modelspec/blob/main/examples/document.json) or [YAML](https://github.com/ModECI/modelspec/blob/main/examples/document.yaml) formats or in binary [BSON](https://github.com/ModECI/modelspec/blob/main/examples/document.bson) format. Support for XML serialization is under development.
22+
Python scripts can be used to generate the specification of a type of model (e.g. [this](https://github.com/ModECI/modelspec/blob/main/examples/document.py)), but the models are saved in standardized format in either text based ([JSON](https://github.com/ModECI/modelspec/blob/main/examples/document.json) or [YAML](https://github.com/ModECI/modelspec/blob/main/examples/document.yaml)) formats or in binary ([BSON](https://github.com/ModECI/modelspec/blob/main/examples/document.bson)) format. Support for [XML](https://github.com/ModECI/modelspec/blob/main/examples/document.xml) serialization has recently been added.
2323

2424
### Current formats using modelspec
2525

26-
#### MDF
26+
#### MDF (Model Description Format)
2727

28-
MDF uses modelspec to create the structure of its models and convert the models into serialized formats such as JSON, YAML, and BSON.
28+
[ModECI's MDF](https://modeci.org/quickstart) uses modelspec to create the structure of its models and convert the models into serialized formats such as JSON, YAML, and BSON.
2929

3030
#### NeuroML
3131

32-
NeuroMLlite uses modelspec to create the structure of its models and convert the models into serialize formats such as JSON, YAML, and BSON.
32+
[NeuroMLlite](https://github.com/NeuroML/NeuroMLlite) uses modelspec to create the structure of its models and convert the models into serialize formats such as JSON, YAML, and BSON.
33+
The XML serialisation of modelspec will be useful for integrating NeuroML 2 files into the framework, see [here](https://github.com/ModECI/modelspec/tree/main/examples/neuroml2).
10 Bytes
Binary file not shown.

docs/sphinx/source/api/examples/document.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"MyBook": {
33
"title": "My life in Python",
4+
"ISBN": 123,
45
"sections": {
56
"Abstract": {
67
"paragraphs": [

0 commit comments

Comments
 (0)