Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for constraints, install in topological order #177

Closed
wants to merge 17 commits into from

Conversation

bollwyvl
Copy link
Contributor

@bollwyvl bollwyvl commented Jan 23, 2025

references

changes

  • add micropip.set_constraints
  • add constraints to the signatures of install and Transaction
    • per upstream, filter constraints that don't provide enough detail (e.g. Just A Wheel URL)
    • merge specifiers to any requirement if found in the constraints (by canonical name)
  • rework install to handle constrained indirect dependencies of packages found in pyodide-lock.json
    • add requested_by to the signatures of many Transaction methods
    • capture the full as-requested Transaction.dependency_graph
    • install packages in topological order based on graph

breaking changes

  • hopefully none, as it's opt-in, and only adds keyword-only arguments to the already very finicky install, etc.
    • previously, all packages from pyodide-lock.json were unconditionally installed before any resolved wheels
    • now, all installations are handled the same way, waiting for any dependencies to be installed first
    • further, transactions containing cycles of dependencies will fail

@hoodmane
Copy link
Member

Looks nice so far I suppose the next step would be to actually use them.

@bollwyvl bollwyvl changed the title Strawman API/docs changes for constraints Add support for constraints Jan 24, 2025
@bollwyvl bollwyvl marked this pull request as ready for review January 24, 2025 17:06
Copy link
Member

@ryanking13 ryanking13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I left some comment

docs/project/usage.md Outdated Show resolved Hide resolved
tests/test_install.py Outdated Show resolved Hide resolved
micropip/transaction.py Outdated Show resolved Hide resolved
@bollwyvl bollwyvl changed the title Add support for constraints Add support for constraints, install in topological order Jan 26, 2025
@bollwyvl
Copy link
Contributor Author

Had a thought which might skip all the bookkeeping: still do gather on dependencies of pyodide-lock packages, but then install PyPI wheels first... took a bit to get what's in there working, so will try a sibling PR...

@bollwyvl
Copy link
Contributor Author

I think #181 is the better way forward, but will keep this open as a draft for reference.

@ryanking13
Copy link
Member

Closing in favor of #181

@ryanking13 ryanking13 closed this Feb 1, 2025
@bollwyvl bollwyvl deleted the gh-175-constraints branch February 1, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support constraints for transient dependencies?
3 participants