Skip to content

Commit

Permalink
better display package dependencies
Browse files Browse the repository at this point in the history
example: wppm -r dask[complete] , wppm -r dask[array,test]
  • Loading branch information
stonebig committed May 21, 2023
1 parent d3266e2 commit 411645e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
3 changes: 3 additions & 0 deletions winpython/data/packages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3601,3 +3601,6 @@ description = Accelerate
[spatialpandas]
description = Pandas extension arrays for spatial/geometric operations
[comm]
description = Jupyter Python Comm implementation, for usage in ipykernel, xeus-python etc.
42 changes: 24 additions & 18 deletions winpython/piptree.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,33 @@ def _downraw(self, pp, extra="", version_req="", depth=20, path=[]):
"""build a nested list of needed packages with given extra and depth"""
envi = {"extra": extra, **self.environment}
p = normalize(pp)

# several extras request management: example dask[array,diagnostics]
extras = extra.split(",")

ret_all = []
if p in path:
if p+"["+extra+"]" in path: # for dask[complete]->dask[array,test,..]
print("cycle!", "->".join(path + [p]))
elif p in self.distro and len(path) <= depth:
if extra == "":
ret = [f'{p}=={self.distro[p]["version"]} {version_req}']
else:
ret = [f'{p}[{extra}]=={self.distro[p]["version"]} {version_req}']
for r in self.distro[p]["requires_dist"]:
if r["req_key"] in self.distro:
if "req_marker" not in r or Marker(r["req_marker"]).evaluate(
environment=envi
):
ret += self._downraw(
r["req_key"],
r["req_extra"],
r["req_version"],
depth,
path + [p],
)
ret_all += [ret]
for extra in extras: # several extras request management
envi = {"extra": extra, **self.environment}
if extra == "":
ret = [f'{p}=={self.distro[p]["version"]} {version_req}']
else:
ret = [f'{p}[{extra}]=={self.distro[p]["version"]} {version_req}']
for r in self.distro[p]["requires_dist"]:
if r["req_key"] in self.distro:
if "req_marker" not in r or Marker(r["req_marker"]).evaluate(
environment=envi
):
ret += self._downraw(
r["req_key"],
r["req_extra"],
r["req_version"],
depth,
path + [p+"["+extra+"]"],
)
ret_all += [ret]
return ret_all

def _upraw(self, pp, extra="", version_req="", depth=20, path=[]):
Expand Down

0 comments on commit 411645e

Please sign in to comment.