Skip to content

Allow per-format compression - #26

Open
gouttegd wants to merge 4 commits into
mainfrom
compress-artefacts
Open

Allow per-format compression#26
gouttegd wants to merge 4 commits into
mainfrom
compress-artefacts

Conversation

@gouttegd

@gouttegd gouttegd commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

This PR replaces the gzip_main boolean option and the export_formats list of export formats by a new form of export_formats in which the list values can indicate, for any given format, the compressions to use.

That is, it allows to do something like this:

export_formats:
  - format: owl
    compressions: [none, gz]
  - format: db
    compressions: [gz]

to indicate that (i) release artefacts should be exported in OWL and SemSQL, (ii) the OWL files should be published both in uncompressed (none) and GZip-compressed (gz) forms, (iii) the SemSQL files should be published only in GZip-compressed form.

When compressions is not specified for a given export format, the default is (for now) none for most formats except for SemSQL where the default is gz. That is, this:

export_formats:
  - format: owl
  - format: db

is equivalent to

export_formats:
  - format: owl
    compressions: [none]
  - format: db
    compressions: [gz]

The point of this feature is to give users a finer control (compared to gzip_main) over how the release artefacts should be compressed, as envisioned in this issue and in particular in this comment.

Only no-compression (none) and Gzip compressions (gz) are supported for now, but the new system would make reasonably trivial to add other compression formats (e.g. BZip2, XZ, etc.) in the future.

Backwards compatibility with existing configuration files is preserved (and here, in front of his computer, @matentzn is breathing again ;) ). An “old-style” export_formats declaration like this:

export_formats:
  - owl
  - obo

is automatically converted into

export_formats:
  - format: owl
  - format: obo

or, if gzip_main was also used, into

export_formats:
  - format: owl
    compressions: [none, gz]
  - format: obo
    compressions: [none, gz]

closes INCATools/ontology-development-kit#1298

Replace the existing `project.export_formats` configuration key, which
currently accepts a simple list of formats, by a more complex key that
accepts a list of "ExportSpecification" object, where each such object
indicates both (1) the export format to use and (2) the compressions to
use.

For example:

```yaml
export_formats:
  - format: owl
    compressions: [none, gz]
  - format: db
    compressions: [gz]
```

The above means that the release artefacts should be exported in

* uncompressed OWL,
* GZip-compressed OWL,
* GZip-compressed SemSQL.

When `compressions` is not explicitly specified, the default is `[none]`
(i.e., uncompressed) for all formats, except for SemSQL where the
default is `[gz]`.
For backwards compatibility, an "old-style" (up to ODK 1.6 included)
`export_formats` declaration like this:

```yaml
export_formats:
  - owl
  - obo
  - json
```

is automatically transformed into:

```yaml
export_formats:
  - format: owl
  - format: obo
  - format: json
```

If the `gzip_main` option was used, this is transformed into

```yaml
export_formats:
  - format: owl
    compressions: [none, gz]
  - format: obo
    compressions: [none, gz]
  - format: json
    compressions: [none, gz]
```

Of note, the conversion of `gzip_main` only applies if the
`export_formats` key was not already in the "new style". If it was in
the "new style", then it is assumed that the user already specified
whatever compressions they wanted there, and `gzip_main` is simply
ignored.
We update the templates to reflect the changes in the model regarding
the list of export formats and the support for per-format compression.

This means mostly that:

(A) Whenever we need to get the formats, we need to do either

  {% for spec in project.export_formats %}
    The format is {{ spec.format }}.
    Compressions: {% for comp in spec.compressions %}{{ comp }} {%endfor %}
  {% endfor %}

or, if we don't need the compressions, we can use the convenience
auto-generated field `project.export_format_names`:

  {% for name in project.export_format_names %}
    The format is {{ name }}.
  {% endfor %}

(B) The definition of `MAIN_FILES` in the Makefile template is changed
to include each release artefact in each format with all its available
compression formats (including no-compression).
@gouttegd gouttegd self-assigned this Sep 6, 2026
@gouttegd
gouttegd requested a review from matentzn September 6, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider compressing all release artefacts

1 participant