Skip to content

Feature Request: compress baseline file #4014

Description

@dougthor42

Background

The baseline file can be quite large and is extremely compressible:

$ gzip -c .pyrefly_baseline.json > .pyrefly_baseline.json.gz
$ ll .pyrefly_baseline.json*
-rw-r----- 1 dthor primarygroup 9.3M Jul  1 17:08 .pyrefly_baseline.json
-rw-r----- 1 dthor primarygroup 510K Jul  2 04:05 .pyrefly_baseline.json.gz

9.3M to 510K.

FR Summary:

Add an optional automatic gzip & gunzip (or other compression) action to the baseline file.

Implementation Options

1. Intelligent based on file name and/or file type

If --baseline ends in .gz, then make the baseline and then gzip it. When consuming, automatically gunzip it. If --baseline ends in bz2, apply that (un)compression method instead. Etc.

Consuming should probably also check the file type because it's possible that people pass a gzipped-file-without-gz-extension.

$ file .pyrefly_baseline.json_wrong_ext 
.pyrefly_baseline.json_wrong_ext: gzip compressed data, was ".pyrefly_baseline.json", last modified: Wed Jul  1 17:08:24 2026, from Unix, original size modulo 2^32 9741179

2. CLI arg

Add a --compress-baseline CLI arg. Maybe even optionally take a compression method, but I don't really see much use for such.

If the baseline file cannot be uncompressed using the method (eg someone passed a bz2 file to --baseline but --compress-baseline=gz), throw an error.

3. Umm...

I don't have any other ideas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions