Skip to content

Add WARC datatype (warc, warc.gz)#23033

Draft
jnussbaum wants to merge 1 commit into
galaxyproject:devfrom
jnussbaum:warc-datatype
Draft

Add WARC datatype (warc, warc.gz)#23033
jnussbaum wants to merge 1 commit into
galaxyproject:devfrom
jnussbaum:warc-datatype

Conversation

@jnussbaum

@jnussbaum jnussbaum commented Jun 27, 2026

Copy link
Copy Markdown

What did you do?

During the GCC Cofest at Clermont-Ferrand, @eamonnbell-dur and me started writing a wrapper for the warcio tool (see galaxyproject/tools-iuc#8143). It failed because of a missing datatype for WARC files. @wm75 helped us to identify the problem and suggested that we open this PR to add the missing datatype.

Add datatypes for the WARC (Web ARChive) format:

  • warc — uncompressed WARC (galaxy.datatypes.warc:Warc)
  • warc.gz — gzip-compressed WARC (galaxy.datatypes.warc:WarcGz)

Both register sniffers (the format signature is the WARC/ record prefix), with test fixtures, doctests, and unit tests.

Why is this needed?

WARC files store archived web content together with capture metadata, and are most commonly distributed gzip-compressed (often with each record as a separate gzip member).

The gzipped form must be kept compressed on upload. If Galaxy decompresses it and then applies POSIX line-ending normalization (because the decompressed content sniffs as text), the per-record byte offsets shift and the exact Content-Length byte counts no longer match — which breaks WARC parsers such as warcio. WarcGz therefore sets compressed = True (modeled on the existing AthenaProject gzip datatype) so the upload pipeline preserves the bytes verbatim.

This unblocks a Galaxy tool wrapper for warcio index (intended for tools-iuc), which needs the .warc.gz delivered untouched to report record offsets.

How was it tested?

  • pytest --doctest-modules lib/galaxy/datatypes/warc.py — sniffers pass
  • pytest test/unit/data/datatypes/test_warc.py — positive/negative sniff tests pass
  • ruff check, ruff format --check, isort --check — clean
  • Verified end-to-end with planemo test --galaxy_root against the warcio index wrapper: the .warc.gz is delivered byte-identical and the tool test passes.

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

WARC (Web ARChive) files store archived web content together with the
metadata describing how it was captured, and are commonly distributed
gzip-compressed (each record as a separate gzip member).

The gzipped form must be kept compressed on upload: decompressing it and
applying line-ending normalization corrupts the per-record byte offsets and
the exact Content-Length values that WARC tooling relies on. WarcGz therefore
sets compressed=True so the upload pipeline preserves the file verbatim.

Adds:
- Warc (uncompressed) and WarcGz (gzip, kept compressed) datatypes with sniffers
- registration in datatypes_conf.xml.sample
- test fixtures (example.warc, example.warc.gz) and doctests/unit tests

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant