Add version pinning via juliapkg.pinned.json and freeze() - #94
Open
MilesCranmerBot wants to merge 4 commits into
Open
Add version pinning via juliapkg.pinned.json and freeze()#94MilesCranmerBot wants to merge 4 commits into
MilesCranmerBot wants to merge 4 commits into
Conversation
MilesCranmerBot
force-pushed
the
pinned-deps
branch
from
August 10, 2026 19:49
8651b28 to
dc27ee9
Compare
Contributor
|
Hey @cjdoris, what do you think? I've been dogfooding this a bit with PySR and it seems nice to have. Then I can test the exact dependencies one of my users will install so I don't need to worry about new breakages or supply chain attacks. |
Contributor
|
*Edit: I found a couple bugs, fixing those now... |
…s, validate pin entries, versioned manifests
Contributor
Author
|
Pushed a hardening commit after further review of the edge cases:
|
MilesCranmer
approved these changes
Aug 10, 2026
MilesCranmer
left a comment
Contributor
There was a problem hiding this comment.
Ok after some messing around, this looks good from my perspective now. Up to you @cjdoris!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the version pinning proposal from JuliaPy/PythonCall.jl#805 (see the design discussion there).
juliapkg.freeze(target)(alsopython -m juliapkg freeze --target=...) records the exact version of every resolved registry package into ajuliapkg.pinned.jsonfile next to the targetjuliapkg.json. On subsequent resolves, discovered pinned files seed the environment before the required packages are added, so Pkg's tiered preservation keeps every pin that is compatible with all requirements. Pinned packages that are not required are removed from the project afterwards, so stale pins get pruned rather than accumulating.Pins are preferences, not requirements: conflicting pins (between files, or with any package's compat) are relaxed with a warning listing exactly what changed. A new
pinsconfig option (PYTHON_JULIAPKG_PINS/-X juliapkg-pins) selectsprefer(default),strict(error instead of relaxing), orignore.update()ignores pins so they can be refreshed by running update, testing, and freezing again.The motivation is shipping Python packages with locked Julia dependencies: users get exactly the versions the author tested, and a newly published version of a deep dependency no longer reaches users automatically, which meaningfully narrows supply chain exposure (versions themselves are integrity-checked by Pkg against registry tree hashes, so pinning versions is sufficient). Because pins are soft, two Julia-backed Python packages with different pins still resolve together.
Notes:
{"packages": {name: {uuid, version}}}shape ofjuliapkg.json.