ADR Suggestion Freezing Dependency Versions on Library Release
#32
Replies: 2 comments 3 replies
-
|
I don't have much to add except that I'm in favor of Option 3, the Hard Freeze. |
Beta Was this translation helpful? Give feedback.
-
|
I am for option 3 - we really want to make sure the environment is correctly set to minimize potential issues post-release.
Or, as discussed earlier - immediately delete pinning in
This is a non-issue for the apps, obviously, but for the libs it might cause ocassional hiccups on user systems. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Context and Problem Statement
Currently, when we release a new version of Python library, we do not specify any version limits for our dependencies in the
pyproject.tomlfile. As a result, when a user installs one of our packages from PyPI, the latest available versions of all dependencies are installed - whether they were available at the time of our release or published later.This has several risks:
By freezing dependency versions (to varying degrees), we can mitigate these risks, improve reproducibility, and offer a more stable experience to users.
Current Approach
pyproject.toml.Example of
pyproject.toml(Current Approach):Considered Options
1. Minimal Version Constraints with Open Upper Bound (Flexible Updates)
Approach:
Specify minimum versions for all dependencies, without restricting the upper versions.
This guarantees the library works with at least a specific version, but allows future versions to be installed.
Pros:
Cons:
Example of
pyproject.toml:2. Frozen Dependencies in Documentation (Soft Freezing with Recommendations)
Approach:
Continue using minimal version constraints (as in Option 1), but provide a frozen list of tested versions in the documentation (e.g.,
README.mdor adocs/installation.mdfile). Users can choose to follow these recommendations or use newer versions.Pros:
pyproject.toml.Cons:
Example of
pyproject.toml:Same as Option 1.
Example of documented recommended versions:
3. Strict Version Pinning at Release Time (Hard Freeze)
Approach:
Specify exact versions for all dependencies directly in
pyproject.toml.Users will automatically install the exact versions tested at the time of release when they run:
Pros:
Cons:
Example of
pyproject.toml:4. Hybrid Approach (Minimal Constraints + Optional Hard Freeze via Lock Files)
Approach:
pyproject.toml.pip-tools) to freeze versions for users who need strict reproducibility.Pros:
pyproject.tomlstays clean, and lock files are updated at release.Cons:
requirements-strict.txtmanually or clone the repository to access it. This is far from ideal UX, especially compared to a simplepip installcommand.Example of
pyproject.toml:Same as Option 1.
Example lock file (not part of
pyproject.toml):Comparison Between Options 3 and 4
While Option 4 appears to offer the best of both worlds (flexibility for advanced users and reproducibility for others), it complicates the user experience:
Less experienced users, who we expect to run a simple:
Would instead be required to manually obtain and install from
requirements-strict.txt, which requires extra steps and understanding.This breaks our goal of keeping the installation process as simple and intuitive as possible for users who are not Python experts.
By contrast, Option 3 guarantees a simple UX:
pip install easydiffractioncommand just works, providing the tested, stable, and reproducible environment we verified during release.For these reasons, we propose to adopt Option 3 and not pursue Option 4 further at this time.
Decision Proposal
For the reasons mentioned above, I propose adopting Option 3 (Strict Version Pinning at Release Time), ensuring maximum stability and reproducibility for our users.
pyproject.toml, we will specify exact versions of dependencies for each release.pip install easydiffractionor similar.Open Questions
Currently, we use GitHub Dependabot, which automatically creates pull requests when dependencies are updated (configuration is typically done via
dependabot.yml, although security updates can work without it). Dependabot notifies us and offers automated version bumps.With hard freeze (Option 3), Dependabot seems to remain valuable (this needs to be confirmed):
This process helps us decide when to unfreeze and update the pinned versions for the next release.
Beta Was this translation helpful? Give feedback.
All reactions