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

support constraints for transient dependencies? #175

Closed
bollwyvl opened this issue Jan 22, 2025 · 2 comments · Fixed by #181
Closed

support constraints for transient dependencies? #175

bollwyvl opened this issue Jan 22, 2025 · 2 comments · Fixed by #181

Comments

@bollwyvl
Copy link
Contributor

elevator pitch

Add the concept of constraints for controlling resolution of transient dependencies.

motivation

For a number of use cases, constraints help achieve reproducible environments
with more familiar tools and data than the still-prickly pyodide-lock.json.

design ideas

For parity with the positional dependencies, this would likely be a list of PEP-508 specs which get normalized, either up-front affecting all future solves, or in a one-off install:

micropip.set_constraints(["maybe-transient-dep==1.2.3"])

await micropip.install(
    ["direct-dep"], 
    constraints=[
        "another-transient-dep==4.5.6",
        "yet-another-transient-dep@https://example.com/yet_another_transient_dep.py3-none-any.whl",
    ]
)

In an outer build environment, the output of pip list --format=freeze could provide any "interesting" dependencies to something that should work in the browser, even if they need to be slightly tweaked to avoid any emscripten- or pyodide-specific .whl.

@hoodmane
Copy link
Member

+1 for this. I like set_constraints better.

bollwyvl added a commit to bollwyvl/micropip that referenced this issue Jan 23, 2025
@bollwyvl
Copy link
Contributor Author

Started this up: #177

bollwyvl added a commit to bollwyvl/micropip that referenced this issue Jan 24, 2025
bollwyvl added a commit to bollwyvl/micropip that referenced this issue Jan 30, 2025
ryanking13 pushed a commit that referenced this issue Feb 1, 2025
…181)

* strawman api/docs changes for #175

* update PR number

* apply constraints in transaction

* add minimal test

* test set_constraints

* add set_constraints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* more tests

* handle more emfs cases

* address review comments

* update changelog

* update docs

* handle env markers and additive constraints

* continue gathering requreiments from pyodide packages, reverse pydodide/wheel install order

* fix pr number in changelog

* fix spelling

* tighten up utils, docstrings

* skip an await if not needed, rework changelog entry

* try more url checking

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants