Skip to content

Commit

Permalink
Add a Sankey diagram of supported managers
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Aug 12, 2024
1 parent c864000 commit 418cabb
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 6 deletions.
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
> \[!IMPORTANT\]
> This version is not released yet and is under active development.
- \[mpm\] Add a Sankey diagram of all supported package managers.

## [5.18.0 (2024-08-02)](https://github.com/kdeldycke/meta-package-manager/compare/v5.17.0...v5.18.0)

- \[mpm\] Add new command to export installed packages to a SBOM file in SPDX or CycloneDX standard. Closes {issue}`936`.
Expand Down
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
]
myst_fence_as_directive = ["mermaid"]

# Always use the latest version of Mermaid.
mermaid_version = "latest"

master_doc = "index"

exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
Expand Down
32 changes: 27 additions & 5 deletions meta_package_manager/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""Introspection utilities to produce comparison matrixes between managers."""
"""Introspection utilities to produce feature inventory of all managers."""

from __future__ import annotations

Expand All @@ -27,8 +27,21 @@
from .pool import pool


def managers_sankey() -> str:
"""Produce a sankey diagram to map ``mpm`` to all its supported managers."""
table = []
for mid, m in sorted(pool.items()):
line = f"Meta Package Manager,{mid},1"
table.append(line)

output = "```mermaid\nsankey-beta\n\n"
output += "\n".join(table)
output += "\n```"
return output


def operation_matrix() -> str:
"""Inspect manager and print a matrix of their current implementation."""
"""Produce a table of managers' metadata and supported operations."""
# Build up the column titles.
headers = [
"Package manager",
Expand Down Expand Up @@ -109,10 +122,19 @@ def operation_matrix() -> str:


def update_readme() -> None:
"""Update `readme.md` at the root of the project with the implementation table for
each manager we support."""
"""Update ``readme.md`` with implementation table for each manager we support."""

readme = Path(__file__).parent.parent.joinpath("readme.md")

replace_content(
readme,
"<!-- managers-sankey-start -->\n",
"\n<!-- managers-sankey-end -->",
managers_sankey(),
)

replace_content(
Path(__file__).parent.parent.joinpath("readme.md"),
readme,
"<!-- operation-matrix-start -->\n\n",
"\n\n<!-- operation-matrix-end -->",
operation_matrix(),
Expand Down
44 changes: 43 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,49 @@
- Because `mpm` try to wrap all other package managers, it became another
pathological case of [XKCD #927: Standards](https://xkcd.com/927/)

## Supported package managers and operations
## Supported package managers

One CLI to rule them all:

<!-- managers-sankey-start -->
```mermaid
sankey-beta
Meta Package Manager,apm,1
Meta Package Manager,apt,1
Meta Package Manager,apt-mint,1
Meta Package Manager,brew,1
Meta Package Manager,cargo,1
Meta Package Manager,cask,1
Meta Package Manager,choco,1
Meta Package Manager,composer,1
Meta Package Manager,dnf,1
Meta Package Manager,emerge,1
Meta Package Manager,flatpak,1
Meta Package Manager,gem,1
Meta Package Manager,mas,1
Meta Package Manager,npm,1
Meta Package Manager,opkg,1
Meta Package Manager,pacaur,1
Meta Package Manager,pacman,1
Meta Package Manager,paru,1
Meta Package Manager,pip,1
Meta Package Manager,pipx,1
Meta Package Manager,pkg,1
Meta Package Manager,scoop,1
Meta Package Manager,snap,1
Meta Package Manager,steamcmd,1
Meta Package Manager,uv,1
Meta Package Manager,vscode,1
Meta Package Manager,winget,1
Meta Package Manager,yarn,1
Meta Package Manager,yay,1
Meta Package Manager,yum,1
Meta Package Manager,zypper,1
```
<!-- managers-sankey-end -->

## Metadata and operations

<!-- operation-matrix-start -->

Expand Down

0 comments on commit 418cabb

Please sign in to comment.