Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork910
Julia: copy src files#3497
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
asottile commentedAug 9, 2025
so I feel like there might be something really wrong with the way julia is currently approached in pre-commit -- and honestly I don't have any experience in julia and mostly have been leaning on contributors to have that knowledge Isuspect that we're approaching installation in a way that doesn't really represent how a julia package would get normally installed. for instance in python when you do you have experience in julia that you could lend some advice? this seems odd either way |
gdalle commentedAug 15, 2025
Just starting to look into pre-commit for Julia myself, so take this with a grain of salt, but perhaps the hook packages should be installed with Julia's package manager |
ericphanson commentedAug 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This does feel a bit weird, I agree. The case here is when the precommit hook lives in a package, likeJuliaTesting/ExplicitImports.jl#128. The existing hook support copies the Project/Manifest from the directory the hook lives in and tries to install the dependencies. But if the Project corresponds to a package, it (a) refuses to use Pkg to install that package as a dep (since the project name/uuid matches) and (b) fails as it lacks the src code. An alternative way to use hooks that does work is to create a separate repo for the hook (outside the package) and use a Project.toml there to specify the package so it can be installed. This is done for example here:https://github.com/fredrikekre/runic-pre-commit. However I think it’s pretty inconvenient to maintain a second repo just for precommit support. Precommit is not a main way people use ExplicitImports for example, and it’s easy enough to add a hook file, but it’s a bit more to need to update/maintain a Project in a secondary repo. The reason copying src feels ok in the scenario to me is that with the current setup is that we copy the Project.toml and when that is for a package, it needs the src code to run. So it is an expansion of the existing Project support. Either way, we definitely do not need PythonCall. We already install deps. The question is just how to do it when the hook lives in the package itself. |
jonas-schulze commentedOct 30, 2025
Why not copy everything? Disclaimer: I'm also just starting to look into pre-commit for Julia myself. |
Declare hook to be a Julia project, so that users don't have to install ExplicitImports manually.Inspired by runic-pre-commit.Edit: just foundpre-commit/pre-commit#3497 sothis won't work.
Copies src files in addition to Project/Manifest. This allows pre-commit hooks to live inside a package (likehttps://github.com/JuliaTesting/ExplicitImports.jl/blob/main/.pre-commit-hooks.yaml) instead of being in a separate repo (likehttps://github.com/fredrikekre/runic-pre-commit).
Split out from#3494