pypi pipdeptree 4.2.17

one hour ago

Bug fixes

  • Preserve text and notebook display metadata when copying or pickling the string returned by pipdeptree.render() (#917) by @mayankdhingra02.
  • Stop from-index with an error when a resolved package depends on a name that is not a project name, as from-lock already does. The resolver accepts a requirement on a name that ends in an underscore, such as helper_, and an index serving such a pair of packages ended the run in a PanicException traceback (#935) by @gaborbernat.
  • -o cyclonedx-json no longer parses its own output back into memory to add empty dependsOn arrays. With --computed unique-deps-names, a chain of 2,000 packages writes 214 MB of SBOM; rendering it now peaks at 0.9 GB instead of 1.6 GB, with the same output (#939) by @gaborbernat.
  • from-index no longer reads a URL as a relative path. Before, a requirement such as https://example.com/demo-1.0.tar.gz was joined to the working directory, or to the directory of the requirements file that listed it, so a directory tree spelled like the URL (https:/example.com/demo-1.0.tar.gz/) in a cloned repository resolved as a local project and its build backend ran. The URL now fails with URL requirements are not supported by the index resolver, as name @ URL already did, on the command line, as a requirements file line and after -e, and the message leaves out a user name and password. A -r or -c line and a --requirements or --pyproject value given as a URL stop the command too, where they used to name a file spelled like the URL. A path that starts with ./ still names such a directory (#937) by @gaborbernat.

Security

  • Check every package name and version of a lock against the 255-byte limit before from-lock builds the first requirement. Each dependency copies the locked version of the package it names, so a lock of about 150 KB whose first package listed thousands of dependencies on a later package with an oversized version used about 1 GB of memory before pipdeptree refused it (#928) by @gaborbernat.
  • Create the temporary directory for a generated from-index project with owner-only permissions on Unix. This protects requirements, local paths and index URLs from other local accounts while resolution runs and if a terminated process leaves the directory behind (#919) by @kemzeb.
  • Drop the repeated Project-URL, Home-page and Download-URL values of a package in linear time when writing cyclonedx-json. pipdeptree compared each URL with every one it had already collected for the package, so a 1 MB METADATA with 55,000 Project-URL headers took 4.4 seconds of CPU, four times as long for each doubling (#931) by @gaborbernat.
  • Evaluate a Requires-Dist marker, a lock package marker or the marker of a from-index requirement one comparison at a time instead of parsing it into a decision diagram. The limit of 1024 bytes and 16 extra comparisons did not bound that diagram, and from-index requirements had no limit: a 624-byte marker of in comparisons took 1.9 GB to parse, a 974-byte marker that parsed at once took 13 minutes to evaluate, and 2000 markers within the limit took 1.9 GB together, because a parsed marker is never freed. pipdeptree now spends time and memory proportional to the length of a marker. Two Requires-Dist entries for the same requirement now merge into one edge only when their markers are written the same way; markers that are spelled differently but mean the same used to merge too. from-index now hands a marker to the resolver as written, where it used to rewrite it, so the resolver decides what every comparison means, and an invalid marker on the command line is reported as invalid marker: followed by the marker (#927) by @gaborbernat.
  • Key the graph's tables of package and extra names with a randomly seeded hash. They used an unseeded one, so whoever wrote a lock file or METADATA could pick names that all fall into one bucket, and every lookup walked them all: a 1 MB METADATA declaring 16,000 such extras made --extras active take 4.8 seconds instead of 0.13 (#930) by @gaborbernat.
  • Preserve the renderer's UTF-8 bytes in redirected CLI output. Legacy stdout encodings could previously alter escaped Graphviz DOT labels or split -o freeze URLs into extra requirements-file options (#918) by @kemzeb.
  • Query the --python interpreter, or the one auto-detected from an activated environment, from the root directory on Unix instead of a fresh directory below the temporary directory. Its parent is the shared /tmp, so with a relative PYTHONPATH entry such as .., or a version-manager shim that reads its configuration from parent directories, another local user's files in /tmp ran as the user. Relative and empty PYTHONPATH entries are no longer passed to the query on Unix (#922) by @gaborbernat.
  • Reject a Requires-Dist entry, or a from-index requirement, with more than 4096 bytes before its marker or with more than 32 whitespace characters in a row after the @ of a URL requirement before parsing it. The parser copies the whole requirement once for each extra and, at each whitespace character of a URL, reads to the end of the run, so one 200 KB entry such as dep @ x: followed by blanks and a letter took 37 seconds to parse, and twice the length took four times as long. Installed metadata reports such an entry with the Invalid requirement found warning; from-index stops with an error. --summary likewise ignores a Requires-Python longer than 4096 bytes, whose 512 KB form took 16 seconds to rank (#927) by @gaborbernat.
  • Restore command lookup on PATH for bare --python names such as python3. Use an explicit path such as ./python3 to select an interpreter file in the working directory (#916) by @kemzeb.
  • Run dot in an empty temporary directory for -o graphviz-<format>, so that only what dot writes to its standard output becomes pipdeptree's output. Before, dot started in the user's working directory, where graphviz-vrml makes it write a node<N>.png texture per package and follow symbolic links of those names: a checkout that commits such links had a pipdeptree run inside it overwrite or create files outside the checkout (#926) by @gaborbernat.
  • Stop --freeze from running svn in an editable install when a .svn directory there or above it holds a non-empty wc.db-journal or wc.db-wal, or a wc.db that is a symbolic link. svn opens that database for writing and SQLite first finishes the transaction such a file describes; a rollback journal can name a file anywhere on disk for SQLite to delete, so an installed distribution that shipped one made the scan delete a file of the user running it. pipdeptree now reports such an install as having no remote (#924) by @gaborbernat.
  • Stop --freeze from taking an editable install's remote and commit from a Mercurial, Subversion or Bazaar checkout that another account created in a directory above the project, such as /tmp/.hg. pipdeptree now uses the nearest .hg, .svn or .bzr only when it belongs to the owner of the editable location or to root, or sits in a folder that only its owner or root can write to; otherwise the project freezes as an editable install with no version control. Windows keeps the previous lookup (#923) by @gaborbernat.
  • Stop running poetry env info --executable to find an environment. With no virtual or conda environment active, a plain pipdeptree and --python auto started Poetry in the working directory, and Poetry loads the project's .poetry/plugins and runs its in-project .venv interpreter before it answers, so a cloned repository that committed either ran its own code as the user. Skipping the interpreter Poetry reported did not prevent that. A plain run now inspects the interpreter running pipdeptree, and --python auto fails to detect an environment. To inspect a Poetry environment, activate it or, in a project you trust, pass --python "$(poetry env info --executable)" (#921) by @gaborbernat.
  • --computed unique-deps-count, unique-deps-names and unique-deps-size now find every package's exclusive dependencies in one pass and keep them as ranges of a single ordering of the packages, instead of storing a set for each package. A chain of 12,000 small distributions, under 500 KB of metadata, took 1.4 GB of memory to render as JSON; it now takes 55 MB (#933) by @gaborbernat.
  • --exclude-dependencies now runs in time proportional to the number of requirements. A package with many requirements on the same package, such as one Requires-Dist line repeated 400,000 times on an index from-index resolves from, or many distinct specifiers in installed metadata, could keep it busy for minutes (#929) by @gaborbernat.
  • --summary -o rich no longer panics when output is not a terminal and a license, classifier or Requires-Python value makes the table wider than 65,535 columns; the title is centered without Rust's formatter width, which stops there (#932) by @gaborbernat.
  • -o freeze no longer writes a pin that ends in an archive suffix such as .zip, .whl or .tar.gz. pip reads such a line as the path of a local archive instead of a requirement, so a lock file or an installed distribution with the version 1.0.zip made pip install -r build the file demo===1.0.zip from the directory pip ran in, even with --no-index. Freeze now writes - for the . that starts the suffix, which pins the same release when the version is valid (#925) by @gaborbernat.

New Contributors

🐍 PyPI release

📜 Full Changelog

Don't miss a new pipdeptree release

NewReleases is sending notifications on new releases.