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

Option to skip selected dependencies #22

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions micropip/_micropip.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ class Transaction:
deps: bool
pre: bool
fetch_kwargs: dict[str, str]
skip_deps: list[str]

locked: dict[str, PackageMetadata] = field(default_factory=dict)
wheels: list[WheelInfo] = field(default_factory=list)
Expand Down Expand Up @@ -346,6 +347,9 @@ async def add_requirement_inner(
See PEP 508 for a description of the requirements.
https://www.python.org/dev/peps/pep-0508
"""
if req.name in self.skip_deps:
# don't install any dependencies we've been told to ignore
return
for e in req.extras:
self.ctx_extras.append({"extra": e})

Expand Down Expand Up @@ -443,6 +447,7 @@ async def install(
deps: bool = True,
credentials: str | None = None,
pre: bool = False,
skip_deps: list[str] = [],
) -> None:
"""Install the given package and all of its dependencies.

Expand Down Expand Up @@ -514,6 +519,11 @@ async def install(
If ``True``, include pre-release and development versions. By default,
micropip only finds stable versions.

skip_deps: ``Optional[list[str]]``

This parameter specifies a list of packages which should not be installed
if they are in the dependency tree.

Returns
-------
``Future``
Expand Down Expand Up @@ -544,6 +554,7 @@ async def install(
deps=deps,
pre=pre,
fetch_kwargs=fetch_kwargs,
skip_deps=skip_deps,
)
await transaction.gather_requirements(requirements)

Expand Down