Migrate to new constraints location#345
Merged
chennes merged 1 commit intoFreeCAD:devfrom Feb 10, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Addon Manager’s pip constraints handling to match a new constraints file layout/location.
Changes:
- Update pip constraints filename/path construction to use
{major}.{minor}/constraints.txt. - Update default
pip_constraints_pathto a new GitHub raw URL underFreeCAD/Addons/.../Data/Python/.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
addonmanager_utilities.py |
Adjusts how the constraints file path is derived for pip installs. |
addonmanager_preferences_defaults.json |
Points the default constraints base URL to the new repository/path. |
Comments suppressed due to low confidence (2)
addonmanager_utilities.py:644
- For the local-path case,
os.path.join(constraints, expected_filename)is joining a base path with a string that already contains a forward slash. This can produce mixed separators (e.g.C:\base\3.11/constraints.txt) and is harder to reason about across platforms. Consider building the relative path withos.path.join(f"{major}.{minor}", "constraints.txt")(and separately use a POSIX join for the URL case) so each join uses the correct separator semantics.
expected_filename = f"{major}.{minor}/constraints.txt"
if parsed_url.scheme == "https":
# The only supported remote scheme is https, and this is the default setup
if not constraints.endswith("/"):
constraints += "/"
constraints += expected_filename
else:
# If it wasn't https, treat it like it's a local path
constraints = os.path.join(constraints, expected_filename)
args.extend(["--constraint", constraints])
addonmanager_utilities.py:645
- This change alters the constraints URL/path constructed by
create_pip_call, but there’s currently no unit test coverage for this function inAddonManagerTest/app/test_utilities.py(which already tests other functions fromaddonmanager_utilities). Adding tests that mockfci.Preferences().get("pip_constraints_path")andsys.version_infoto assert the resulting--constraintargument (both for https URLs and local paths) would help prevent regressions in dependency installation.
if "install" in args:
constraints = fci.Preferences().get("pip_constraints_path")
if not constraints:
fci.Console.PrintWarning(
"pip constraints explicitly disabled by unsetting 'pip_constraints_path'\n"
)
else:
parsed_url = urlparse(constraints)
major = sys.version_info.major
minor = sys.version_info.minor
expected_filename = f"{major}.{minor}/constraints.txt"
if parsed_url.scheme == "https":
# The only supported remote scheme is https, and this is the default setup
if not constraints.endswith("/"):
constraints += "/"
constraints += expected_filename
else:
# If it wasn't https, treat it like it's a local path
constraints = os.path.join(constraints, expected_filename)
args.extend(["--constraint", constraints])
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
633
to
636
| major = sys.version_info.major | ||
| minor = sys.version_info.minor | ||
| expected_filename = f"constraints-py{major}{minor}.txt" | ||
| expected_filename = f"{major}.{minor}/constraints.txt" | ||
| if parsed_url.scheme == "https": |
There was a problem hiding this comment.
expected_filename now contains a path segment (e.g. 3.11/constraints.txt), not just a filename. Consider renaming it (e.g. constraints_rel_path) to avoid confusion and make it clearer that a directory component is included.
5dedb02 to
ab12d44
Compare
|
Successfully created backport PR for |
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.
No description provided.