Do you need to recompile a package when you modify non-src files

I have problems with packages getting recompiled all the time, and I am trying to debug some of the cases (this has also happened just be restarting Julia, so there are difinitely cases where it does re-precompile when it shouldn’t)

I have a package MyPackage. It’s main folder contain a folder “src” with all the actual code files. It also contains a folder “other_files” with e.g. .sh scripts related to coordinating the running of pacakge files on e.g. compute clusters and hpc.

  • Assume I start Julia, and do using MyPackage, now it precompiles MyPackage.
  • Next I restart Julia and do using MyPackage, in which case it shouldn’t recompile MyPackage.
  • If I then stop Julia, modify some file under “src”, start Julia, run using MyPackage, now it should recompile MyPackage.
  • Finally, and this is the question, I stop Julia, modify some non-Julia file in “other_files”, start Julia, run using MyPackage. Should it it should it not to re-precompile MyPackage?

No it should not re-precompile, unless you include or include_dependency any of these files in your package code.

3 Likes

You can also try to set the JULIA_DEBUG=loading environment variable: it should print messages explaining what gets loaded and precompiled and why

3 Likes

Unstable environments can also trigger recompiling upon simple restarts. For example, if you’re editing an environment but had already loaded some now-obsolete dependencies, your packages would get stuck recompiling for the obsolete dependencies; there should be a warning to restart Julia, though.

The precompile cache also holds up to 10 instances of a package (its state given the versions of it and everything else in the environment) by default, so if you go through more environments regularly, the cache may be unable to keep up.