-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from cropsinsilico/topic/forms
Topic/forms
- Loading branch information
Showing
78 changed files
with
2,538 additions
and
1,665 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
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
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
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
chevron | ||
flask | ||
jsonschema>=3 | ||
jsonschema==3.2.0 | ||
matplotlib | ||
numpy>=1.13.0 | ||
pandas | ||
|
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
black | ||
git # [conda] | ||
PyGithub |
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
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
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
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,46 @@ | ||
import os | ||
import json | ||
import argparse | ||
from github import Github | ||
from yggdrasil import __version__ | ||
from yggdrasil.schema import get_model_form_schema | ||
|
||
|
||
def update_schema(token): | ||
r"""Update the model form schema via pull request to the | ||
cropsinsilico/model_submission_form repository. | ||
Args: | ||
token (str): Github authentication token that should be used. | ||
""" | ||
contents = json.dumps(get_model_form_schema(), indent=' ') | ||
ver = __version__ | ||
repo_name = "cropsinsilico/model_submission_form" | ||
msg = f"Update model form schema to version for yggdrasil {ver}" | ||
branch = f"schema-update-{ver}" | ||
schema = "static/model.json" | ||
gh = Github(token) | ||
repo = gh.get_repo(repo_name) | ||
main = repo.get_branch('main') | ||
schema_sha = repo.get_contents(schema).sha | ||
repo.create_git_ref(f"refs/heads/{branch}", main.commit.sha) | ||
repo.update_file(schema, msg, contents, schema_sha, branch=branch) | ||
repo.create_pull(title=f"Update schema to {ver}", | ||
body=msg, head=branch, base="main") | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser( | ||
"Update the model form schema via pull request to the" | ||
"cropsinsilico/model_submission_form repository.") | ||
parser.add_argument( | ||
'--token', | ||
help=("Github authentication token that should be used to open the " | ||
"pull request. The token must have write access to the " | ||
"cropsinsilico/model_submission_form repository.")) | ||
args = parser.parse_args() | ||
if args.token is None: | ||
args.token = os.environ.get('YGGDRASIL_UPDATE_TOKEN', None) | ||
assert(args.token) | ||
update_schema = update_schema(args.token) |
Oops, something went wrong.