Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate docs and schema with github actions #115

Merged
merged 12 commits into from
Jun 15, 2021
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
51 changes: 51 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Test and Deploy bioimageio.spec

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox

deploy:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: |
pip install .
- run: mkdir ./dist && cp ./bioimageio_rdf_spec.md ./dist # TODO: remove this when we generate the RDF docs
- name: Generate Docs
run: python scripts/generate_docs.py
# - name: Generate JSON Schema # TODO: fix this
# run: python scripts/generate_json_specs.py
- name: Deploy Docs and Schema 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist
27 changes: 0 additions & 27 deletions .github/workflows/test.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ __pycache__/
.vscode
tmp
*.egg-info/
dist
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
hooks:
- id: generate docs
name: generate docs
entry: python scripts/gen_spec_doc.py
entry: python scripts/generate_docs.py
language: system
always_run: true
pass_filenames: false
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ As a general guideline, please follow the model RDF spec to describe AI models a

A BioImage.IO-compatible Resource Description File (RDF) is a YAML file with a set of specifically defined fields. You can find detaialed field definition and examples here in the [generic RDF spec](./bioimageio_rdf_spec.md).

## [Model Resource Description File Specification](./generated/bioimageio_model_spec.md)
## [Model Resource Description File Specification](https://github.com/bioimage-io/spec-bioimage-io/blob/gh-pages/bioimageio_model_spec.md)

Besides the generic RDF spec, the [`Model Resource Description File Specification`](./generated/bioimageio_model_spec.md)(`model RDF`) defines a file format for representing pretrained AI models in [YAML format](https://en.wikipedia.org/wiki/YAML). This format is used to describe models hosted on the [BioImage.IO](https://bioimage.io) model repository site.
Besides the generic RDF spec, the [`Model Resource Description File Specification`](https://github.com/bioimage-io/spec-bioimage-io/blob/gh-pages/bioimageio_model_spec.md)(`model RDF`) defines a file format for representing pretrained AI models in [YAML format](https://en.wikipedia.org/wiki/YAML). This format is used to describe models hosted on the [BioImage.IO](https://bioimage.io) model repository site.

Here is a list of model RDF Examples:
- [UNet 2D Nuclei Broad](https://github.com/bioimage-io/pytorch-bioimage-io/blob/master/specs/models/unet2d_nuclei_broad/UNet2DNucleiBroad.model.yaml).


## Recommendations

* For AI models, consider using the model-specific spec (i.e. [model RDF](./generated/bioimageio_model_spec.md)) instead of the generic RDF. Only fallback to the generic RDF if writing model specific RDF is not possible for some reason.
* For AI models, consider using the model-specific spec (i.e. [model RDF](https://github.com/bioimage-io/spec-bioimage-io/blob/gh-pages/bioimageio_model_spec.md)) instead of the generic RDF. Only fallback to the generic RDF if writing model specific RDF is not possible for some reason.
* The RDF or package file name should not contain spaces or special characters, it should be concise, descriptive, in kebab case or camel case.
* Due to the limitations of storage services such as Zenodo, which does not support subfolders, it is recommended to place other files in the same directory level of the RDF file and try to avoid using subdirectories.
* Use the [bioimage.io spec validator](#bioimageio-spec-validator) to verify your YAML file
Expand All @@ -46,7 +46,7 @@ TODO from pip/conda
pip install git+https://github.com/bioimage-io/spec-bioimage-io
```

To use the spec validator, you can verify a model configuration in the [bioimage.io model format](./generated/bioimageio_model_spec.md) using the following command:
To use the spec validator, you can verify a model configuration in the [bioimage.io model format](https://github.com/bioimage-io/spec-bioimage-io/blob/gh-pages/bioimageio_model_spec.md) using the following command:
```
python -m bioimageio.spec verify-spec <MY-MODEL>.model.yaml
```
Expand Down
2 changes: 1 addition & 1 deletion bioimageio_rdf_spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The common fields for all the resource description files are:

## Describing AI models

In general, it is discouraged to use the generic RDF to describe AI models and we recommend to follow the [model RDF spec](generated/bioimageio_model_spec.md) instead. However, in some cases, it is not possible to provide detailed fields defined in the [model RDF spec](generated/bioimageio_model_spec.md), the generic RDF can be used for discribing AI models.
In general, it is discouraged to use the generic RDF to describe AI models and we recommend to follow the [model RDF spec](https://github.com/bioimage-io/spec-bioimage-io/blob/gh-pages/bioimageio_model_spec.md) instead. However, in some cases, it is not possible to provide detailed fields defined in the [model RDF spec](https://github.com/bioimage-io/spec-bioimage-io/blob/gh-pages/bioimageio_model_spec.md), the generic RDF can be used for discribing AI models.

To do that, you need to first set the `type` filed to `model`.

Expand Down
Loading