Skip to content

Conversation

@SpecLad
Copy link
Contributor

@SpecLad SpecLad commented Jul 13, 2025

This somewhat belatedly resolves #708.

This is not a complete patch; the functionality is implemented, but there are no tests or documentation. Before I add those, I'd like to get some initial feedback on the API (and, of course, on whether you'd want to accept something like this at all).

To summarize, the API works as follows. You parse a RECORD file like this:

record_set = parse_record_csv(contents)

for record in record_set:
    print(record.path)
    if record.hash is not None:
        print(record.hash.algoritm, record.hash.digest)
    if record.size is not None:
        print(record.size)

And you render one like this:

builder = RecordSetBuilder()

builder.add(Record('a/b/c.py', hash=RecordHash("sha256", b'\x01\x02...'), size=123))
...

record_set = builder.build()
contents = record_set.to_csv()

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.

Add functionality for working with RECORD files

1 participant