Skip to content

feat: save downloaded packages to cache#270

Merged
sdn4z merged 1 commit into
elementsinteractive:mainfrom
sdn4z:cachee
Aug 22, 2025
Merged

feat: save downloaded packages to cache#270
sdn4z merged 1 commit into
elementsinteractive:mainfrom
sdn4z:cachee

Conversation

@sdn4z
Copy link
Copy Markdown
Collaborator

@sdn4z sdn4z commented Aug 21, 2025

This PR adds the possibility to save the downloaded trusted packages to a local cache file, to speed up runs.

This will mostly benefit local use of twyn and not so much the use in CI. That's why we assume the timezone will remain the same.

To disable cache usage one can run twyn --no-cache. Otherwise the cache will be used.

The capability of disabling/enabling cache via the config file will come in a future PR, as well as the possiblity of completely erasing it.

Refs #143

@sdn4z sdn4z requested a review from scastlara as a code owner August 21, 2025 13:30
@sdn4z sdn4z marked this pull request as draft August 21, 2025 13:30
@sdn4z sdn4z force-pushed the cachee branch 6 times, most recently from 7e5c6a4 to 5f47100 Compare August 22, 2025 09:03
@github-actions github-actions Bot added feature and removed feature labels Aug 22, 2025
@github-actions github-actions Bot added feature and removed feature labels Aug 22, 2025
@sdn4z sdn4z force-pushed the cachee branch 2 times, most recently from fc9057f to a78d96d Compare August 22, 2025 09:58
@sdn4z sdn4z marked this pull request as ready for review August 22, 2025 09:59
Copy link
Copy Markdown
Collaborator

@scastlara scastlara left a comment

Choose a reason for hiding this comment

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

Looks great!

Comment thread src/twyn/trusted_packages/references.py Outdated
},
}
file_handler.file_path.parent.mkdir(parents=True, exist_ok=True)
file_handler.write(json.dumps(trusted_data, indent=2))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We might as well save it without any indent and maybe single line? for disk size? idk

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've removed the indents!

@sdn4z sdn4z enabled auto-merge (squash) August 22, 2025 10:20
@sdn4z sdn4z merged commit 583c262 into elementsinteractive:main Aug 22, 2025
11 checks passed
@sdn4z sdn4z deleted the cachee branch September 10, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants