Skip to content

Add exclude newer flag - #111

Closed
efficks wants to merge 2 commits into
EpicWink:masterfrom
efficks:master
Closed

Add exclude newer flag#111
efficks wants to merge 2 commits into
EpicWink:masterfrom
efficks:master

Conversation

@efficks

@efficks efficks commented Aug 13, 2026

Copy link
Copy Markdown

Adds a PROXPI_EXCLUDE_NEWER setting (seconds) that holds back recently-uploaded files from being served. Basically a quarantine window, for anyone who wants a buffer against brand-new releases before trusting them. PROXPI_EXCLUDE_NEWER_UNKNOWN controls what happens to files with no known upload time, defaults to excluding them. That matters more for the HTML API though, since it never reports upload times at all, so everything served through it counts as "unknown" right now.

Also stopped passing through upstream's versions list as-is once files for a project get filtered out. You could end up with a version listed that had zero files left after exclusion, and that'd throw off resolvers that use the field as a shortcut.

Added tests for the exclusion logic, unit plus a couple through the mock index. README's got the new env vars documented too.

Issue: #110

@EpicWink EpicWink left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your implementation drops the excluded packages on read from the source index, instead of filtering them from the response to clients. This means the cache will provide stale responses

Comment thread src/proxpi/_cache.py Outdated
Comment thread src/proxpi/_cache.py Outdated
Comment thread src/proxpi/_cache.py Outdated
@efficks

efficks commented Aug 14, 2026

Copy link
Copy Markdown
Author

Pushed a fix: moved the exclusion filtering out of _list_files (baked into the cache at fetch time) into Cache.list_files, which runs fresh on every request.

The per-index cache now always stores the full, unfiltered file list, and the exclusion window gets evaluated against the current time on each call, so a file becomes visible again the moment it ages out of the window instead of waiting for the next cache refresh.

@efficks
efficks requested a review from EpicWink August 14, 2026 12:51
Comment thread src/proxpi/_cache.py
@efficks

efficks commented Aug 14, 2026

Copy link
Copy Markdown
Author

@EpicWink May I propose you to use pydantic_settings to load your config from environment variable? I'm using them in my projects. I can do an other PR with the implementation if you like. a new class for all config with validation of use input through pydantic-setting.

@EpicWink

Copy link
Copy Markdown
Owner

May I propose you to use pydantic_settings to load your config from environment variable?

I'm considering dropping FastAPI (and therefore pydantic) in favour of Starlette (see #115)

@efficks efficks closed this Aug 26, 2026
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.

2 participants