Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" ]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
runs-on: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- runs-on: macos-latest
python-version: "3.8"
- runs-on: macos-latest
python-version: "3.9"

steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -108,7 +103,6 @@ jobs:

- name: Build Documentation
run: |
# Note: contributors generation below fails on py 3.7 due to pandas version...
pip install .[docs]
cd docs
python generate.py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: 3.9
python-version: 3.11

- name: Install package
run: |
Expand Down
18 changes: 8 additions & 10 deletions docs/contributors.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import requests
import pandas as pd
import textwrap
from datetime import date

import pandas as pd
import requests

url = "https://api.github.com/repos/modeci/modelspec/contributors"

Expand All @@ -28,7 +28,7 @@
):
if data.status_code == 200:
requests_status = "successful"
print(" Received: %s" % data.json())
print(f" Received: {data.json()}")
empty_list.append(data.json())
else:
# handle failure on requests to the url for mac os
Expand All @@ -53,20 +53,18 @@
with open(file, "w") as f:
print(
textwrap.dedent(
"""\
f"""\
(Modelspec:contributors)=

# Modelspec contributors

This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
This page is generated periodically, most recently on {}.""".format(
date.today()
)
This page is generated periodically, most recently on {date.today()}."""
),
file=f,
)

print("", file=f)
print(file=f)

for key, val in zip_dict.items():
print("- {} ([@{}]({}))".format(val[0], val[1], val[2]), file=f)
for val in zip_dict.values():
print(f"- {val[0]} ([@{val[1]}]({val[2]}))", file=f)
4 changes: 2 additions & 2 deletions docs/generate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import shutil
import os
import shutil

shutil.copy("../README.md", "sphinx/source/api/Introduction.md")

for file_ in os.listdir("../examples"):
if ("document" in file_) or ("README" in file_):
shutil.copy(
"../examples/%s" % file_, os.path.join("sphinx/source/api/examples", file_)
f"../examples/{file_}", os.path.join("sphinx/source/api/examples", file_)
)
2 changes: 1 addition & 1 deletion docs/sphinx/source/api/Contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Modelspec contributors

This page list names and Github profiles of contributors to Modelspec, listed in no particular order.
This page is generated periodically, most recently on 2026-06-24.
This page is generated periodically, most recently on 2026-10-28.

- Padraig Gleeson ([@pgleeson](https://github.com/pgleeson))
- Manifest Chakalov ([@mqnifestkelvin](https://github.com/mqnifestkelvin))
Expand Down
21 changes: 10 additions & 11 deletions docs/sphinx/source/api/examples/document.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json

import bson
import yaml

import modelspec
from modelspec import field, instance_of, optional
from modelspec.base_types import Base
from typing import List
import sys
import json
import yaml
import bson

# Example showing how to create a model of a document and use it to create/serialize instances

Expand Down Expand Up @@ -34,7 +34,7 @@ class Section(Base):
"""

id: str = field(validator=instance_of(str))
paragraphs: List[Paragraph] = field(factory=list)
paragraphs: list[Paragraph] = field(factory=list)


@modelspec.define
Expand All @@ -52,7 +52,7 @@ class Document(Base):
id: str = field(validator=instance_of(str))
title: str = field(default=None, validator=optional(instance_of(str)))
ISBN: int = field(default=None, validator=optional(instance_of(int)))
sections: List[Section] = field(factory=list)
sections: list[Section] = field(factory=list)


doc = Document(id="MyBook", ISBN=123)
Expand All @@ -78,10 +78,9 @@ class Document(Base):

doc.to_bson_file("document.bson")

if sys.version_info >= (3, 8):
doc.to_xml_file("document.xml")
print(" >> Full document details in XML format:\n")
print(doc.to_xml())
doc.to_xml_file("document.xml")
print(" >> Full document details in XML format:\n")
print(doc.to_xml())


doc_md = doc.generate_documentation(format="markdown")
Expand Down
21 changes: 10 additions & 11 deletions examples/document.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json

import bson
import yaml

import modelspec
from modelspec import field, instance_of, optional
from modelspec.base_types import Base
from typing import List
import sys
import json
import yaml
import bson

# Example showing how to create a model of a document and use it to create/serialize instances

Expand Down Expand Up @@ -34,7 +34,7 @@ class Section(Base):
"""

id: str = field(validator=instance_of(str))
paragraphs: List[Paragraph] = field(factory=list)
paragraphs: list[Paragraph] = field(factory=list)


@modelspec.define
Expand All @@ -52,7 +52,7 @@ class Document(Base):
id: str = field(validator=instance_of(str))
title: str = field(default=None, validator=optional(instance_of(str)))
ISBN: int = field(default=None, validator=optional(instance_of(int)))
sections: List[Section] = field(factory=list)
sections: list[Section] = field(factory=list)


doc = Document(id="MyBook", ISBN=123)
Expand All @@ -78,10 +78,9 @@ class Document(Base):

doc.to_bson_file("document.bson")

if sys.version_info >= (3, 8):
doc.to_xml_file("document.xml")
print(" >> Full document details in XML format:\n")
print(doc.to_xml())
doc.to_xml_file("document.xml")
print(" >> Full document details in XML format:\n")
print(doc.to_xml())


doc_md = doc.generate_documentation(format="markdown")
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ docs =
pandas
requests
Sphinx
setuptools==80.0.0
recommonmark>=0.5.0
nbsphinx
sphinx_copybutton
Expand Down
2 changes: 1 addition & 1 deletion src/modelspec/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.4.0"
__version__ = "0.4.1"

from .base_types import Base, define, has, field, fields, optional, instance_of, in_

Expand Down
Loading