From a27e9818a03b32ad73e3707d824b4b208f8c8783 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Sat, 29 Aug 2026 17:39:40 +0100 Subject: [PATCH 1/4] Fix the "metadata" templates. We update the dynamic templates that produce the files in `src/metadata` (the description of the ontology for the OBO Foundry and the PURL configuration file). Mostly, we try to use the ODK configuration to fill those files as much as possible, especially regarding the available release artefacts and export formats. When we do _not_ have the information we need from the ODK configuration, we let some explicit placeholder for the ontology owner to replace. We also avoid generating GitHub-specific URLs if the ontology does not appear to be intended to be hosted on GitHub (no `github_org`). For the PURL config file, we redirect to attached release artefacts rather than to files from the repository itself, _except_ for imports, components, and pattern files -- those files are expected to be imported from the -edit file, so most users would expect that their PURLs should point to the tip of the main branch rather than to the last release. In most cases this should not matter because the XML Catalog is there to redirect IRIs of import modules and components to local files so that we won't even hit the network, but this may be useful if one needs to process the -edit file with a tool written in a niche language that does not have support for XML Catalogs (e.g., Python; see https://github.com/obophenotype/cell-ontology/issues/3119). closes INCATools/ontology-development-kit#1236 --- src/incatools/odk/model.py | 2 +- .../odk/templates/_dynamic_files.jinja2 | 126 ++++++++++++++---- 2 files changed, 99 insertions(+), 29 deletions(-) diff --git a/src/incatools/odk/model.py b/src/incatools/odk/model.py index f209c3a..8a8f83b 100644 --- a/src/incatools/odk/model.py +++ b/src/incatools/odk/model.py @@ -967,7 +967,7 @@ class OntologyProject(JsonSchemaMixin): annotation in the seeded ontology. """ - description: str = "None" + description: Optional[str] = None """A short description of the ontology.""" use_dosdps: bool = False diff --git a/src/incatools/odk/templates/_dynamic_files.jinja2 b/src/incatools/odk/templates/_dynamic_files.jinja2 index 1fc451f..03daed8 100644 --- a/src/incatools/odk/templates/_dynamic_files.jinja2 +++ b/src/incatools/odk/templates/_dynamic_files.jinja2 @@ -317,41 +317,71 @@ For more background see: layout: ontology_detail id: {{ project.id }} title: {{ project.title }} -jobs: - - id: https://travis-ci.org/{{ project.github_org }}/{{ project.repo }} - type: travis-ci build: +{%- if project.github_org %} checkout: git clone https://github.com/{{ project.github_org }}/{{ project.repo }}.git +{%- elif project.repo_url %} +{#- The repo_url is primarily intended to point to a browsable version of + of the repo, but most Git hosting services also serve a repository + compatible with the use of `git clone` at the main repo URL. #} + checkout: git clone {{ project.repo_url }} +{%- else %} + checkout: git clone +{%- endif %} system: git path: "." contact: - email: {{ project.contact.email }} - label: {{ project.contact.name }} - github: {{ project.contact.github }} -description: {{ project.title }} is an ontology... -domain: stuff + email: + label: +{%- if project.github_org %} + github: +{%- endif %} +{%- if project.description %} +description: {{ project.description }} +{%- else %} +description: +{%- endif %} +domain: +{%- if project.github_org %} homepage: https://github.com/{{ project.github_org }}/{{ project.repo }} +{%- elif project.repo_url %} +homepage: {{ project.repo_url }} +{%- endif %} products: - id: {{ project.id }}.owl - name: "{{ project.title }} main release in OWL format" - - id: {{ project.id }}.obo - name: "{{ project.title }} additional release in OBO format" - - id: {{ project.id }}.json - name: "{{ project.title }} additional release in OBOJSon format" - - id: {{ project.id }}/{{ project.id }}-base.owl - name: "{{ project.title }} main release in OWL format" - - id: {{ project.id }}/{{ project.id }}-base.obo - name: "{{ project.title }} additional release in OBO format" - - id: {{ project.id }}/{{ project.id }}-base.json - name: "{{ project.title }} additional release in OBOJSon format" + name: {{ project.title }} main release in OWL format +{%- for format in project.export_formats %} +{%- if format != "owl" %} + - id: {{ project.id }}.{{ format }} + name: {{ project.title }} main release in {{ format|upper }} format +{%- endif %} +{%- endfor %} +{%- for artefact in project.release_artefacts %} +{%- if artefact != project.primary_release %} + - id: {{ project.id }}/{{ project.id }}-{{ artefact }}.owl + name: {{ project.title }} {{ artefact|upper }} release in OWL format +{%- for format in project.export_formats %} +{%- if format != "owl" %} + - id: {{ project.id }}/{{ project.id }}-{{ artefact }}.{{ format }} + name: {{ project.title }} {{ artefact|upper }} release in {{ format|upper}} format +{%- endif %} +{%- endfor %} +{%- endif %} +{%- endfor %} +{%- if project.import_group is not none %} dependencies: -{% for imp in project.import_group.products -%} +{%- for imp in project.import_group.products %} - id: {{ imp.id }} -{% endfor -%} +{%- endfor %} +{%- endif %} +{%- if project.github_org %} tracker: https://github.com/{{ project.github_org }}/{{ project.repo }}/issues +{%- else %} +tracker: +{%- endif %} license: - url: http://creativecommons.org/licenses/by/3.0/ - label: CC-BY + url: {{ project.license }} + label: activity_status: active --- @@ -365,8 +395,16 @@ idspace: {{ project.id|upper }} base_url: /obo/{{ project.id }} products: -- {{ project.id }}.owl: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/{{ project.git_main_branch }}/{{ project.id }}.owl -- {{ project.id }}.obo: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/{{ project.git_main_branch }}/{{ project.id }}.obo +{%- if project.github_org %} +- {{ project.id }}.owl: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/latest/download/{{ project.id }}.owl +{%- for format in project.export_formats %} +{%- if format != "owl" %} +- {{ project.id }}.{{ format }}: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/latest/download/{{ project.id }}.{{ format }} +{%- endif %} +{%- endfor %} +{%- else %} +- {{ project.id }}.owl: +{%- endif %} term_browser: ontobee example_terms: @@ -375,17 +413,49 @@ example_terms: entries: - prefix: /releases/ - replacement: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/v +{%- if project.github_org %} + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/download/v +{%- else %} + replacement: +{%- endif %} - prefix: /tracker/ +{%- if project.github_org %} replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/issues +{%- else %} + replacement: +{%- endif %} - prefix: /about/ replacement: http://www.ontobee.org/ontology/{{ project.id|upper }}?iri=http://purl.obolibrary.org/obo/ -## generic fall-through, serve direct from github by default +{% if project.github_org -%} +{% if project.import_group is not none or project.components is not none or project.use_dosdps -%} +# For files that are imported from the -edit file, we cannot point to +# the latest release download folder as we do below in the "generic" +# fall-through, because those files are _not_ release artefacts and are +# absent from that folder. Instead, we point to the current {{ project.git_main_branch }} branch. +{% if project.import_group is not none -%} +- prefix: /imports/ + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/imports/ + +{% endif -%} +{% if project.components is not none -%} +- prefix: /components/ + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/components/ + +{% endif -%} +{% if project.use_dosdps -%} +- prefix: /patterns/ + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/patterns/ + +{% endif -%} +{% endif -%} + +# Generic fall-through, serve from the latest release artefacts - prefix: / - replacement: https://raw.githubusercontent.com/{{ project.github_org }}/{{ project.repo }}/{{ project.git_main_branch }}/ + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/latest/download/ +{% endif -%} {% endif %}{# ! project.create_obo_metadata -#} {% if project.use_templates -%} ^^^ src/templates/README.md From 6f03b8560ae6c87df42caed209158fa782ee82a1 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Sun, 30 Aug 2026 10:25:09 +0100 Subject: [PATCH 2/4] Add quotes where potentially needed. Both the project.title and project.description are free text, and could contain YAML-breaking stuff. --- src/incatools/odk/templates/_dynamic_files.jinja2 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/incatools/odk/templates/_dynamic_files.jinja2 b/src/incatools/odk/templates/_dynamic_files.jinja2 index 03daed8..dc89fe9 100644 --- a/src/incatools/odk/templates/_dynamic_files.jinja2 +++ b/src/incatools/odk/templates/_dynamic_files.jinja2 @@ -316,7 +316,7 @@ For more background see: --- layout: ontology_detail id: {{ project.id }} -title: {{ project.title }} +title: "{{ project.title }}" build: {%- if project.github_org %} checkout: git clone https://github.com/{{ project.github_org }}/{{ project.repo }}.git @@ -337,7 +337,7 @@ contact: github: {%- endif %} {%- if project.description %} -description: {{ project.description }} +description: "{{ project.description }}" {%- else %} description: {%- endif %} @@ -349,21 +349,21 @@ homepage: {{ project.repo_url }} {%- endif %} products: - id: {{ project.id }}.owl - name: {{ project.title }} main release in OWL format + name: "{{ project.title }} main release in OWL format" {%- for format in project.export_formats %} {%- if format != "owl" %} - id: {{ project.id }}.{{ format }} - name: {{ project.title }} main release in {{ format|upper }} format + name: "{{ project.title }} main release in {{ format|upper }} format" {%- endif %} {%- endfor %} {%- for artefact in project.release_artefacts %} {%- if artefact != project.primary_release %} - id: {{ project.id }}/{{ project.id }}-{{ artefact }}.owl - name: {{ project.title }} {{ artefact|upper }} release in OWL format + name: "{{ project.title }} {{ artefact|upper }} release in OWL format" {%- for format in project.export_formats %} {%- if format != "owl" %} - id: {{ project.id }}/{{ project.id }}-{{ artefact }}.{{ format }} - name: {{ project.title }} {{ artefact|upper }} release in {{ format|upper}} format + name: "{{ project.title }} {{ artefact|upper }} release in {{ format|upper}} format" {%- endif %} {%- endfor %} {%- endif %} From 1a26438edeffc87479104f02ce2b4f279e2765ef Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Sun, 30 Aug 2026 10:44:44 +0100 Subject: [PATCH 3/4] Fix the rediction to the patterns directory. --- src/incatools/odk/templates/_dynamic_files.jinja2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/incatools/odk/templates/_dynamic_files.jinja2 b/src/incatools/odk/templates/_dynamic_files.jinja2 index dc89fe9..ba8ed09 100644 --- a/src/incatools/odk/templates/_dynamic_files.jinja2 +++ b/src/incatools/odk/templates/_dynamic_files.jinja2 @@ -447,7 +447,7 @@ entries: {% endif -%} {% if project.use_dosdps -%} - prefix: /patterns/ - replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/patterns/ + replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/patterns/ {% endif -%} {% endif -%} From 52064cdb25180f73253e6c87f412b4c13b139efd Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Sun, 30 Aug 2026 10:58:31 +0100 Subject: [PATCH 4/4] Add missing placeholders. When not using GitHub, we cannot predict what the URLs to redirect to for all the various parts of the ontology will be, so we just write out placeholders for the ontology owner to fill. --- .../odk/templates/_dynamic_files.jinja2 | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/incatools/odk/templates/_dynamic_files.jinja2 b/src/incatools/odk/templates/_dynamic_files.jinja2 index ba8ed09..19d4e87 100644 --- a/src/incatools/odk/templates/_dynamic_files.jinja2 +++ b/src/incatools/odk/templates/_dynamic_files.jinja2 @@ -429,33 +429,51 @@ entries: - prefix: /about/ replacement: http://www.ontobee.org/ontology/{{ project.id|upper }}?iri=http://purl.obolibrary.org/obo/ -{% if project.github_org -%} -{% if project.import_group is not none or project.components is not none or project.use_dosdps -%} +{%- if project.import_group is not none or project.components is not none or project.use_dosdps %} + # For files that are imported from the -edit file, we cannot point to # the latest release download folder as we do below in the "generic" # fall-through, because those files are _not_ release artefacts and are # absent from that folder. Instead, we point to the current {{ project.git_main_branch }} branch. -{% if project.import_group is not none -%} +{%- if project.import_group is not none %} + - prefix: /imports/ +{%- if project.github_org %} replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/imports/ +{%- else %} + replacement: +{%- endif %} + +{%- endif %} +{%- if project.components is not none %} -{% endif -%} -{% if project.components is not none -%} - prefix: /components/ +{%- if project.github_org %} replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/ontology/components/ +{%- else %} + replacement: +{%- endif %} + +{%- endif %} +{%- if project.use_dosdps %} -{% endif -%} -{% if project.use_dosdps -%} - prefix: /patterns/ +{%- if project.github_org %} replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/raw/refs/heads/{{ project.git_main_branch }}/src/patterns/ +{%- else %} + replacement: +{%- endif %} -{% endif -%} -{% endif -%} +{%- endif %} +{%- endif %} # Generic fall-through, serve from the latest release artefacts - prefix: / +{%- if project.github_org %} replacement: https://github.com/{{ project.github_org }}/{{ project.repo }}/releases/latest/download/ -{% endif -%} +{%- else %} + replacement: +{%- endif %} {% endif %}{# ! project.create_obo_metadata -#} {% if project.use_templates -%} ^^^ src/templates/README.md