Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github.com/scop/wrun #904

Closed
wants to merge 1 commit into from
Closed

Add github.com/scop/wrun #904

wants to merge 1 commit into from

Conversation

scop
Copy link
Contributor

@scop scop commented Nov 26, 2023

my new repository:

  • is added to the bottom or with existing repos from the same account
  • contains a license
  • is not language: system, language: script, language: docker, or language: docker_image
  • does not contain "pre-commit" in the name

@@ -206,6 +206,7 @@
- https://github.com/adamchainz/django-upgrade
- https://github.com/scop/pre-commit-shfmt
- https://github.com/scop/pre-commit-perlcritic
- https://github.com/scop/wrun
Copy link
Member

Choose a reason for hiding this comment

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

this downloads tools at runtime rather than at build time so it's not a good fit for the framework -- perhaps you can chime in on pre-commit/pre-commit#1453 and pre-commit/pre-commit#3020 which are trying to solve this more generically (and correctly)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wrun works for its intended purposes and I think it's correct enough for what it's meant for. Of course there's room for some improvement always though. Anyway, it also works with pre-commit as it stands, the only thing I'm aware of where it does not work is pre-commit.ci. BTW pre-commit.ci's runtime network prohibition also runs at odds with other tools, such as dprint, as well as whatever would need to access the network for other reasons besides installing something (hypothetical, haven't come across anything, but easily imaginable).

Good to hear that a pre-commit solution to this problem is in the works, but I'm not really that interested in one that solves it only within pre-commit. Will drop a note about wrun to the mentioned issues in case the authors of those implementations wish to borrow some from there.

Copy link
Member

Choose a reason for hiding this comment

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

the problem is more that there's no write protection to the pre-commit cache at runtime (intentionally) and so writes in general break the cache integrity and at worst concurrent writes permanently poison the cache and so writing at runtime is unsupported

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A workaround for that could be if pre-commit.ci provided a way to cache additional paths, not just the pre-commit cache. Whatever happens in them would be the responsibility of something else besides pre-commit. Can imagine that this would likely make sharing such additional caches pretty much a no go, as well as their retention suboptimal.

Copy link
Member

Choose a reason for hiding this comment

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

it's not a pre-commit.ci issue -- it's a pre-commit issue. writes to pre-commit's cache at runtime are unsafe

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With regards to wrun, the cache dir is naturally configurable. As it sounds unlikely that pre-commit.ci would become supported for this tool, I'll likely remove the helper option to (ab)use a subdir in pre-commit's cache. Other CI systems that I'm aware of have the ability to cache pretty much arbitrary paths, should be no problem to configure the wrun cache if one is using it.

Copy link
Contributor Author

@scop scop Nov 24, 2024

Choose a reason for hiding this comment

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

I'll likely remove the helper option to (ab)use a subdir in pre-commit's cache.

FTR, this option has been removed since, wrun no longer helps or recommends the user in any way to touch pre-commit's cache.

So in that sense I suppose that side of the blocker against adding this in pre-commit's supported hooks list is now gone, and the addition could be reconsidered. The build time vs runtime distinction still exists though, but that's not something wrun can affect alone. I suppose pre-commit could, if it provided more flexibility to configure what happens in each of those phases. wrun's --dry-run mode could be then used in a hypothetical "build" stage to do the downloads

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants