-
Notifications
You must be signed in to change notification settings - Fork 93
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
make the @quickactivate macro into its own package with no dependencies #402
Comments
Hello, Happy to make quick activate a package with no dependencies, but will this solve the issue? Do you mind giving it a try (or I will when I get the chance) by just copying the |
|
Thanks for the comments. I have been meaning to try what you suggested (make some I just glanced at the re:
You are right. What I meant by the canonical method is to directly use |
I dont understand how this would be possible. |
Here is an implementation: https://github.com/jesseylin/QuickActivate.jl/blob/1928b448f34e858f8c4582c0b25375382b067459/src/QuickActivate.jl#L33C1-L52C4 This solved the precompilation cache invalidation issues I was having (i.e., at the REPL I do not get annoying restarts of precompilation). It is currently not a full solution for me because I use Pluto a lot and they actually hardcode a check for the DrWatson package when it computes the evaluation topology of the notebook. I would prefer that a similar solution could be upstreamed into DrWatson. The new recommended workflow would be to install DrWatson per-project and not globally, but install the other small package which only contains |
I don't understand. What is the similar solution that should be upstreamed? |
I wrote the code in the repo to show that one can implement the |
How ca this work without Pkg being a dependency? In any case I don't think this hack is the way to go. You are in essence having a dependency without having it in the Project.toml by Have you tried it with having |
Because the code is evaluated in the scope of the caller, i.e., the user code, and this will already have
There is no usage of
But I think both of these are rather unrealistic.
No unfortunately, I just whipped this up in the middle of the workday to fix the problem 😅. But if you add As an aside, in general I think it's a good idea to use Julia's default package environment tools as much as possible and resolving this problem would let one remove Let me know what you think. The precompilation thing is very annoying to my workflow and I am happy to help pursue a fix in whatever way moving forward. |
Yes, that is correct. However, notice that this code snippet would work for any package. While it is true that Pkg is stdlib since Julia 1.0, since Julia 1.9 stdlibs must now be listed as formal dependencies of a package for it to be registered. So my problem is that even if the code works, we won't be able to register it anyways... However. I am really thinking that
Right, yes, you are correct, I was wrong and was exaggerating. But still, I would count the current code as a "hack" bcause it is "hacking" in a dependency without listing it as a formal dependency. Doesn't matter if the package loaded is stdlib or not, it is still a dependency.
I think this is worth trying out nevertheless though. I have been talking to the developers of Pkg about this. They would like to help, but they need a reproducible MWE. The problem I am raising to them is: cache invalidation occurs even if the two environments have exactly the same package versions. In our case, one environment is the global/default one. If we can show the invalidation happening in a reproducible way with a shareable manifest and the code that loads it, it could be that this problem gets fixed directly in
Sure, I agree and I am totally happy to make, test, and register a Quickactivate.jl package, provided that we have confirmation that this works, and also provided that the package can actually be registered (which would mean that
I completely feel you. I am suffering from the same problem. All of my science projects have Make+DifferentialEquations as dependencies; the packages that take notoriously the most to precompile. It is an absolute killer to my productivity that these packages get precompiled several times per day. The most productive way forwards I think is to get the Pkg developers involved somehow, by providing them something "tangible", which is why I am asking you to test the quickactivate with Pkg dependency, and then we share this as a MWE that reproduces the problem. |
Thanks, I did not know this: it is a very important point.
I also suspect this happens but I have no real evidence.
I am glad to hear that you have been talking to the Pkg guys. I like this course of action, I will try the test you suggest later in the week when I have more time. |
Perhaps related discussion: https://discourse.julialang.org/t/case-study-method-invalidations-caused-by-pkg-jl-with-julia-1-11/109038 |
As of Julia 1.9, there is now a package precompilation cache. The trade-off is that cache misses result in compilation times even slower than pre-1.9.
The suggested workflow with DrWatson to have DrWatson installed in a global shared environment and then invoking
but this frequently triggers such a cache miss if sometimes packages are installed into a project environment the usual way by
As far as I can tell the
@quickactivate
macro doesn't depend on any other code and could be extracted into its own package. If this package has no dependencies, then it can be safely installed in the global environment and will never cause such a cache miss as the dependency graph would be identical whether the project is activated the canonical way viaPkg
or via@quickactivate
There are probably much nicer solutions to this problem but this is by far the easiest one I can think of.
The text was updated successfully, but these errors were encountered: