Avoid overwriting Project.toml / Manifest.toml
I'm a new user of juliacall / pyjuliapkg, so bear with me. My use case is building docs in a monorepo where Python will call Julia code. For CI and developer environment I have both pixi.lock and Manifest.toml checked in, and I want to use them.
Based on the docs I figured I could use PYTHON_JULIAPKG_PROJECT to use my existing Julia project. I was surprised when pyjuliapkg overwrote it with
[deps]
OpenSSL_jll = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
PythonCall = "6099a3de-0909-46bc-b1f4-468b9a2dfc0d"
[compat]
OpenSSL_jll = "3.0.0 - 3.5"
PythonCall = "=0.9.26"
It was clear that these are needed, so I discarded the changes and added them myself. This seemed to work, but I think I now understand that only worked because pyjuliapkg/meta.json was written. Since this file has absolute paths I didn't want to check this in because it wouldn't work on CI.
After reading the deps.py code a bit I figured I could use PYTHON_JULIAPKG_OFFLINE=yes to avoid overwriting the existing Julia project, though that doesn't seem like its intended use.
I looked for other issues and just found this quote: https://github.com/JuliaPy/pyjuliapkg/issues/39#issuecomment-2598302090
But then again I suppose if the Manifest.toml is already compatible with juliapkg’s requirements, then it shouldn’t be updated. So perhaps that extra logic should be added, to prevent unintended updates.
That sounds helpful. Perhaps it just needs to be documented that PYTHON_JULIAPKG_PROJECT is for pyjuliapkg to manage, and this package would need something similar to CondaPkg.jl's Null backend, where it is clear that it is up to the user to manage it.
I guess besides using PYTHON_JULIAPKG_OFFLINE I can check in pyjuliapkg/meta.json?
pyjuliapkg/meta.json
{
"meta_version": 5,
"dev": false,
"version": "1.11.6",
"executable": "C:\\ProgramData\\DevDrives\\.julia\\juliaup\\julia-1.11.6+0.x64.w64.mingw32\\bin\\julia.exe",
"deps_files": {
"c:\\programdata\\devdrives\\temp\\jlcall\\.pixi\\envs\\default\\lib\\site-packages\\juliacall\\juliapkg.json": {
"timestamp": 1752828690.8178058,
"hash_sha256": "6ede5552d6a82f280768eacc10a93299eaaa43b5b312d4adef07fae7c5da541f"
},
"c:\\programdata\\devdrives\\temp\\jlcall\\.pixi\\envs\\default\\lib\\site-packages\\juliapkg\\juliapkg.json": {
"timestamp": 1752828690.8373451,
"hash_sha256": "6d034037e5fd1c550b11b18a378aeb7d4569d720e6e594d910105aac17cd0fce"
}
},
"pkgs": [
{
"name": "PythonCall",
"uuid": "6099a3de-0909-46bc-b1f4-468b9a2dfc0d",
"dev": false,
"version": "=0.9.26"
},
{
"name": "OpenSSL_jll",
"uuid": "458c3c95-2e84-50aa-8efc-19380b2a3a95",
"dev": false,
"version": "3.0.0 - 3.5"
}
],
"offline": false,
"override_executable": null
}
The juliapkg.json only contains {"julia": "1"}
Perhaps I can make the meta.json paths relative and use forward slashes. But I'd rather avoid having to maintain another kind of lockfile.
Yep, we don't have anything like CondaPkg's various modes. Also CondaPkg has a notion of whether the environment it is installing into is shared or not (based on the mode and how the environment was specified) and will only add to a shared environment, not remove.
So yes right now you have to (ab-)use the offline option to do what you want.