Repository navigation
dependency-table: fold duplicate dependencies; show and merge extras - #90
Conversation
New directive options: * ':duplicates: Expanded | Collapsed | Reference' (default Collapsed): how a tree shows the dependencies of a duplicate - a package whose dependencies an earlier line of the table already shows. Collapsed folds them below a marker '... 17 dependencies, listed at sphinx' linking to that line; HTML unfolds them on a click (<details>, new nodes FoldedDependencies/FoldedSummary). Reference shows the marker alone. LaTeX, text, man and Texinfo get the marker without link (post-transform ReplaceFoldedDependencies). * ':duplicate-match: Exact | Subset | Name' (default Subset): same release and extras / same release and the original's extras or fewer / any. Every first-level row is an original, so a dependency listed in a row of its own links to that row; otherwise the first line in reading order is the original, also for a package two trees share further down. A line whose dependencies the depth limit cut off is no original. A duplicate keeps its own line (version constraint, license). A package is shown with its requirement's extras, sorted: 'pyTooling[dependencies]'. Several statements of a package in one entrypoint (files, '-r' includes, published packages, pyproject.toml) keep the last statement's constraint with the extras of all of them, as pip does. pyTooling.Sphinx's own documentation folds 16 duplicates; every link has a target. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| UnusedCode | 1 minor |
| Documentation | 2 minor |
| CodeStyle | 6 minor |
🟢 Metrics 67 complexity · 0 duplication
Metric Results Complexity 67 Duplication 0
🟢 Coverage 86.53% diff coverage
Metric Results Coverage variation Report missing for 2aca4691 Diff coverage ✅ 86.53% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (2aca469) Report Missing Report Missing Report Missing Head commit (9e403f8) 5236 4653 88.87% Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#90) 193 167 86.53% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #90 +/- ##
==========================================
+ Coverage 86.85% 86.95% +0.09%
==========================================
Files 24 24
Lines 5083 5236 +153
Branches 814 839 +25
==========================================
+ Hits 4415 4553 +138
- Misses 568 583 +15
Partials 100 100
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…items * DuplicateFormat and DuplicateMatch are StringEnums with DEFAULT (Collapsed, Subset), read by their Parse as option converters, like LegendPosition. The option values are lower case: ':duplicates: collapsed', ':duplicate-match: subset'. DEFAULT_DUPLICATE_FORMAT/-MATCH are gone. * Every bullet list of a dependency tree is marked 'compact'. docutils makes a list 'simple' only if each item is a paragraph and at most one list; an item with folded dependencies (paragraph + <details>) made the whole list non-simple, so the theme kept the paragraph margins of every line in it - the gaps around the fold and before the nested lists of its siblings. pyTooling.Sphinx's dependency page: all 27 trees are 'simple' now. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
The marker of a duplicate reads '… same 4 dependencies as listed at requests' (was '… 4 dependencies, listed at requests'), so it says these are the same dependencies as at the linked line. Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
* An original's anchor is a readable ID on its whole table row or list
item: 'dependency-<entrypoint>-<package>' with the extras, e.g.
'#dependency-documentation-requests' (was a counted 'id7' on the text
line). It reads well in a URL and doesn't change when something earlier on
the page adds an ID. A second original of the same name gets '-2'; the ID
is registered with the document, which keeps it unique on the page.
* pyTooling.css: the row or list item a marker links to ('tr:target > td',
'li:target') is highlighted after the jump: its background fades from
Sphinx' highlight yellow to its own in 2.5 s (no 'to' keyframe, so a
theme's row stripe comes back). With 'prefers-reduced-motion: reduce' the
highlight stays. Custom property '--pyTooling-table-target-color'.
Co-Authored-By: Patrick Lehmann <Paebbels@gmail.com>
New Features
pyTooling.Sphinx.DependencyTable::duplicates: expanded | collapsed | reference, defaultcollapsed: how a dependency tree shows the dependencies of a duplicate, a package whose dependencies an earlier line of the table already shows.expandedshows them again, as before.collapsedfolds them below a marker like … same 17 dependencies as listed at sphinx, which links to the earlier line; in HTML, a click on the marker unfolds them (<details>), so the data is on the page but takes no space.referenceshows the marker alone.ReplaceFoldedDependencies).:duplicate-match: exact | subset | name, defaultsubset: when a line is a duplicate of an earlier line of the same package - the same release with the same extras, the same release with the earlier line's extras or fewer (everything it requires is shown there), or any release with any extras.sphinxbelowsphinx_autodoc_typehintslinks to the rowsphinx, even if the row is further down); otherwise the first line in reading order, also for a package two trees share several levels down (pydantic). A line whose dependencies the:depth:limit cut off is no original. A duplicate keeps its own line - version constraint and license -, as these differ by what requires the package.pyTooling[dependencies],pyTooling[console,packaging,yaml].#dependency-<entrypoint>-<package>with the extras, e.g.#dependency-documentation-requests; a second original of the same name gets-2, and the ID is registered with the document, which keeps it unique on the page. In HTML, the target row or item - the package with its dependencies - is highlighted after the jump: its background fades from Sphinx' highlight yellow to its own in 2.5 seconds, or stays highlighted if the reader's system asks for reduced motion (custom property--pyTooling-table-target-color).DuplicateFormatandDuplicateMatch,StringEnums withDEFAULT, likeLegendPosition.compact: an item with folded dependencies is more than a paragraph and a list, which would end docutils' simple list, and the theme would keep the paragraph margins of every line in it.pyTooling.Sphinx.Node: new nodesFoldedDependencies(HTML<details>) andFoldedSummary(HTML<summary>), registered inNODES.Bug Fixes
pyTooling.Sphinx.DependencyTable: when several statements of an entrypoint required the same package - a requirements file and a file it includes with-r, several files offiles, the published requirements of severalpackages- the last statement replaced the earlier ones entirely, so a laterpyToolingdropped the extra of an earlierpyTooling[yaml]and the table missed that extra's dependencies. The last statement's constraint is used now, with the extras of all statements, as pip installs every extra any statement names. The requirements of the requirements file model aren't changed; an extended requirement is a copy.Documentation
:duplicates:and:duplicate-match:with their values, the rule which line is the original, the anchors and the highlight; a paragraph on extras and on several statements of one package.Unit Tests
tests/unit/DependencyTable.py:Expanded; a collapsed and a referenced duplicate of a row further down; a package two trees share, with the link's target;SubsetandExactwith extras; another release, which onlyNamematches; an original cut off by the depth limit; a line without dependencies;ReplaceFoldedDependenciesfor formats without folding.tests/unit/Reports.py:setup()registersReplaceFoldedDependencies.sphinx, 4×requests, 2×pytest, ...) to 10 readable targets; every link has a target. Its LaTeX build writes the markers as text.Related Issues and Pull-Requests
pyproject; this PR applies the merge of extras to it too.