Pkg & activation

OK… Here is what I have done for testing things:

  1. I have created a new directory, C:\Users\Bernt\Slett\. [“Slett” means “Delete”…]

  2. In this directory, I have created a test.jl file and a test.ipynb file using VSCode, both with the following code:

using Pkg
Pkg.status()
  1. I also put a Project.toml file and a Manifest.toml file which a student created for me a while ago.

Now, the directory has the following content:

  1. When running the code, both test.jl and test.ipynb [Julia release channel] respond with:
Status `C:\Users\Bernt\.julia\environments\v1.10\Project.toml`
  [336ed68f] CSV v0.10.14
  [a93c6f00] DataFrames v1.6.1
  [82cc6244] DataInterpolations v5.0.0
  [7073ff75] IJulia v1.24.2
  [b964fa9f] LaTeXStrings v1.3.1
  [23fbe1c1] Latexify v0.16.3
  [91a5bcdd] Plots v1.40.4

So far, so good: both codes ignore the local *.toml files.

  1. I then clone the files as test_1.jl and test_1.ipynb, and in both of the new files, I add the commands:
Pkg.activate(".")
Pkg.status()
  1. When I run the test_1.jl file, the response after these new lines is:
Status `C:\Users\Bernt\Project.toml` (empty project)

NB: OBSERVE that the files are in directory C:\Users\Bernt\Slett\. Probably because the VSCode was in directory C:\Users\Bernt by default… It is empty because there were no *.toml files in that directory.

  1. When I run the test_1.ipynb file, the response after these new lines is:
Project JuliaProjectEnvironment v0.1.0
Status `C:\Users\Bernt\Slett\Project.toml`
→  [0c46a032] DifferentialEquations v7.13.0
   [b964fa9f] LaTeXStrings v1.3.1
→⌃ [961ee093] ModelingToolkit v8.75.0
   [91a5bcdd] Plots v1.40.4
   [37e2e46d] LinearAlgebra
Info Packages marked with → are not downloaded, use `instantiate` to download
Info Packages marked with ⌃ have new versions available and may be upgradable.
  Activating project at `c:\Users\Bernt\Slett`

This shows that:
a. The path of the Jupyter notebook is the same as the path where the notebook was located.
b. The notebook has found the content of the *.toml files created by the student.

  1. I then go back to the files test.jl and test_1.ipynb. These do not contain the Pkg.activate() command.

Running the test.jl code, the response is:

Status `C:\Users\Bernt\.julia\environments\v1.10\Project.toml`
  [336ed68f] CSV v0.10.14
  [a93c6f00] DataFrames v1.6.1
  [82cc6244] DataInterpolations v5.0.0
  [7073ff75] IJulia v1.24.2
  [b964fa9f] LaTeXStrings v1.3.1
  [23fbe1c1] Latexify v0.16.3
  [91a5bcdd] Plots v1.40.4

No effect of the activation taking place in test_1.jl because it created empty *.toml files.

  1. Finally, I re-run test.ipynb file (without an activation statement). Response:
Status `C:\Users\Bernt\.julia\environments\v1.10\Project.toml`
  [336ed68f] CSV v0.10.14
  [a93c6f00] DataFrames v1.6.1
  [82cc6244] DataInterpolations v5.0.0
  [7073ff75] IJulia v1.24.2
  [b964fa9f] LaTeXStrings v1.3.1
  [23fbe1c1] Latexify v0.16.3
  [91a5bcdd] Plots v1.40.4

Again, this is what I hoped would be the result: because I have not used the Pkg.activate(".") command, the global environment is used.

  1. HOWEVER, in another Jupyter notebook, the notebook uses the local *.toml files even though I have not issued the Pkg.activate(".") command