Skip to content

Add new filter: one_per#491

Open
kelbyers wants to merge 24 commits into
tfeldmann:mainfrom
kelbyers:oneper
Open

Add new filter: one_per#491
kelbyers wants to merge 24 commits into
tfeldmann:mainfrom
kelbyers:oneper

Conversation

@kelbyers

@kelbyers kelbyers commented Jul 12, 2026

Copy link
Copy Markdown

Change Summary

New Filter: one_per

This adds a new filter: one_per.

OnePer is a filter that groups files by time period and selectively emits files based on a detection method. For each time period, it identifies one "canonical" file (the earliest, newest, first-seen, etc.) and returns True only for the "extra" files in that period. The canonical file for each period is available via {one_per.the_one} but is not emitted. This enables deduplication workflows like removing redundant backups while keeping one representative file per period.

In simpler terms: It keeps one file per time period and marks all others as candidates for deletion/processing.

The periods used for grouping can be:

  • month
  • day
  • hour
  • minute
  • second

The method for choosing the one file can be:

  • lastmodified -- the modified timestamp
  • created -- the file creation timestamp
  • name
  • first_seen

The sort order can be reversed by prefixing "-"; e.g., "-lastmodified", "-name".

Updates to Workflow Actions

All workflow actions have been updated to the current versions.

  • actions/checkout@v7.0.0
  • docker/login-action@v4.4.0
  • docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 (v6.2.0)
  • docker/build-push-action@v7.3.0
  • actions/setup-python@v6.3.0
  • astral-sh/setup-uv@v8.3.2

Related issue number

There are no related issues, this is a new feature.

Checklist

  • Tests for the changes exist and pass on CI
  • Documentation reflects the changes where applicable
  • Change is documented in CHANGELOG.md (if applicable)
  • My PR is ready to review

kelbyers and others added 24 commits June 26, 2026 19:06
Implemented so far:
- ignores symlinks
- tracks seen files
- periods: month, day, hour, minute, second
- asserts on invalid period
- gets period from a file's timestamp
- lastmodified timestamp comparisons
- creation timestamp comparisions
- reverse ordering for timestamp comparisons
- add to `res.vars`
'path.stat().st_ctime' is only valid for the file creation timestamp on Windows. We can use 'read_created()' from the 'created' filter to ensure that we get the actual file creation time.

Changing to this requires changes to test cases that care about the file creation time.
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.

1 participant