meta_package_manager.logo module¶
Terminal rendition of the mpm brand mark, and the --version screen it decorates.
The mark is the isometric open box of docs/assets/logo-square.svg, redrawn as a
half-block raster: two sub-pixel rows share one terminal line, so LOGO paints
as half as many lines as it has rows.
Half-blocks are the primitive because a terminal cell is twice as tall as it is
wide, which makes their sub-pixels square. That also rules out the alternative worth
naming, since it looks obvious and is not: drawing the mark as directional line-art
characters (╱, ╲, │), the way edge-detection ASCII art does. An isometric edge
sits at slope 0.25 in cell space, far too shallow for ╱, and that figure is
scale-invariant — no height fixes it. Stretching the projection to 45° earns the
diagonals but leaves the mark only ~12 columns wide, too few for the four flaps.
Caution
The mark’s structure is carried by color alone: strip the ANSI codes and it
collapses into one solid silhouette. LogoVersionOption therefore only draws
it when color reaches the output, falling back to click-extra’s plain rendering
everywhere else — which is also the form machine readers parse, the bar plugin
probing mpm --no-color --version.
- meta_package_manager.logo.DOCS_URL = 'https://mpm.run'¶
Canonical documentation host, advertised on the version screen.
- meta_package_manager.logo.TAGLINE = 'Meta Package Manager'¶
What the
mpmacronym stands for, as spelled out under the logo’s wordmark.
- meta_package_manager.logo.LOGO: tuple[str, ...] = (' .. .. ', ' ..... ..... ', ' ......::++...... ', ' ......::::++++...... ', ' ....::::....++++.... ', ' .:::::++::+++++. ', ' ...::::++::++++... ', ' ......:::+:+++...... ', ' ......:::+++...... ', ' +......:+......: ', ' +++....+:....::: ', ' ++++++++:::::::: ', ' ++++++++:::::::: ', ' ++++++++:::::::: ', ' +++++++::::::: ', ' +++++::::: ', ' +++::: ', ' +: ')¶
The mark, as one shading tone per sub-pixel, two rows to a rendered line.
A space is transparent and leaves the terminal’s own background alone. The rest name the plane the sub-pixel faces, which is what an isometric solid shades by:
.up (the flap tops and the cube’s lid),:right,+left. No outlines: the solid is reconstructed from the three shades its planes catch, the way an unlit render reads.Rasterized from a model re-derived from the SVG’s polygon geometry — rim, flap fold depth, body height and cube placement all measured off it — then mirrored about its vertical axis, swapping
+for:since what faces left on one side faces right on the other. Symmetry is imposed at that point rather than left to the rasterizer, which drifted three separate ways: a column count rounded off the row scale left the sampling grid off-centre, paint order tilted mirror-paired surfaces, and an odd column count gave the axis a column that would have had to face both ways at once.The box is open, so the two far walls show through its rim, and they carry the plane opposite the one they sit behind: the far-left wall is lit as a right-facing face, which is why the interior’s left half is
:where the exterior’s is+. That mirroring is what keeps the floating cube legible against the wall behind it, each of its faces landing on the other tone. The interior cells were filled by testing every empty cell’s centre against the rim quadrilateral in the artwork’s own coordinates, so they cannot drift from the SVG the way an eyeballed fill would.Hand-editing a row is fine, but keep the rows equal in length and even in number, keep the width even, and keep every row symmetric.
- meta_package_manager.logo.BRAND_WASH = '#d3d3f6'¶
The pale lavender of the artwork’s lit planes.
One of the two colors the whole identity is drawn from, with
BRAND_INK. Declared here as well as indocs/brand_update.pybecause runtime code cannot read the SVG sources, which are not shipped in the wheel;test_ansi_logo_tracks_the_brand_palettefails if the two ever disagree.
- meta_package_manager.logo.BRAND_INK = '#2d2364'¶
The deep purple of the artwork’s shadowed planes, and of its lettering.
The second brand color. It used to be the wordmark’s alone, the box outline carrying a third, lighter purple that this mark’s shadow faces stood in for, so the terminal rendition inherited a mismatch the artwork has since dropped.
- meta_package_manager.logo.BRAND_MID = '#807bad'¶
The midpoint of the two, for the third plane an isometric solid needs.
Computed rather than chosen, so the palette remains two colors and a derivation. The artwork gained it when the mark went flat: with no outline left to separate the faces, a right-facing plane can no longer share a value with a left-facing one.
- meta_package_manager.logo.TONES: dict[str, int] = {'+': 17, '.': 189, ':': 103}¶
Xterm-256 palette index per shading tone of
LOGO.One index per plane, mapped to the closest thing the palette can render: the lit faces take
BRAND_WASH, the shadowed onesBRAND_INK, and the right-hand planesBRAND_MID.Indices rather than truecolor: the 256-color cube is the widest-supported palette, and click emits no downgrade of its own for a terminal that cannot do 24-bit — including Apple’s own Terminal, where a 24-bit sequence would take the mark with it. The cost is borne entirely by the ink: the cube resolves dark colors coarsely, so
#00005fis as close as it gets (a perceptual distance of ~24, against ~3 for the wash). It is the nearest entry that keeps any chroma at all, the closer ones by raw distance all being grays, which would paint a purple mark in ash.
- meta_package_manager.logo.LOGO_WIDTH = 22¶
Columns the mark occupies, every rendered line being padded to it.
- meta_package_manager.logo.LOGO_LINES = 9¶
Terminal lines the mark renders to, two sub-pixel rows making one.
- meta_package_manager.logo.GUTTER = ' '¶
Blank columns separating the mark from the metadata column beside it.
- meta_package_manager.logo.LABEL_WIDTH = 10¶
Column width the metadata keys are padded to, aligning their values.
- meta_package_manager.logo.Colors¶
A cell’s foreground and background palette indices.
Noneis transparent, leaving the terminal’s own color to show through.
- meta_package_manager.logo.env_summary()[source]¶
One-line interpreter and platform summary.
Feeds both the plain
--versionoutput (as click-extra’senv_infotemplate field) and the version screen’s ownPythonandPlatformrows, so the two renderings can never disagree on what they report.- Return type:
- meta_package_manager.logo.platform_label()[source]¶
Current platform and CPU architecture, as displayed to the user.
- Return type:
- meta_package_manager.logo.render_logo()[source]¶
Paint
LOGOinto styled lines, one per pair of sub-pixel rows.A cell whose two sub-pixels carry different tones paints the top one as foreground over the bottom one as background, which is what fits two independent colors on one line. Runs of cells sharing a color pair are styled together rather than one escape sequence per character, keeping the mark from tripling in size.
- meta_package_manager.logo.version_screen(prog_name, version)[source]¶
Compose the mark and the metadata column into the full version screen.
The metadata is centred against the mark’s height, and either column may be the taller of the two: a line missing from one side simply renders blank.
Returns
Nonewhen the terminal is too narrow to seat the two columns side by side, leaving the caller to fall back rather than emit a wrapped mess. The threshold is measured off the metadata actually built, since its widest row grows with the manager count and the platform name. A non-interactive stream reportsshutil’s 80-column default, wide enough that a redirected-but-forced-color run still gets the screen it asked for.
- meta_package_manager.logo.colors_reach_output()[source]¶
Will ANSI codes survive all the way to the user’s terminal?
Resolves click-extra’s color tri-state, deferring to the output stream’s TTY status on its
autodefault, exactly asclick.echodoes when it decides whether to strip the codes itself.- Return type:
- class meta_package_manager.logo.LogoVersionOption(param_decls=None, message=None, fields=None, styles=None, message_style=None, is_flag=True, expose_value=False, is_eager=True, help='Show the version and exit.', **kwargs)[source]¶
Bases:
VersionOption--version, upgraded to the full version screen when the terminal allows it.Three conditions gate the screen, and failing any one of them falls back to click-extra’s plain
messagetemplate unchanged — which is a deliberate guarantee, not just a default: that plain form is the one every machine reader parses.Color reaches the output. The mark keeps its structure in its colors alone, so a stripped one is an unreadable blob.
The terminal is wide enough to seat the metadata column beside the mark without wrapping it.
Accessible mode is off. A raster read out cell by cell is noise to a screen reader, so
--accessiblekeeps the plain two lines.
Preconfigured as a
--versionoption flag.- Parameters:
message (
str|None) – the message template to print, in format string syntax. Defaults to{prog_name}, version {version}.fields (
Mapping[str,Any] |None) – mapping of template field name to a forced value, overriding the value auto-computed for that field. Keys must be members oftemplate_fields(for example{"version": "1.2.3"}).styles (
Mapping[str,Callable[[str],str] |None] |None) – mapping of template field name to itsStyle, merged overdefault_styles. PassNoneas a value to clear a field’s default style. Keys must be members oftemplate_fields.message_style (
Callable[[str],str] |None) – fallback style for the message literals and for any field that has no style of its own.
- meta_package_manager.logo.version_screen_params()[source]¶
click-extra’s default parameters, with
--versionswapped for our own.Passed to the CLI’s
@group(params=…), the documented hook for tuning that list. Swapping the instance in place keeps click-extra’s carefully ordered parameter sequence, and keepsversion_fields=working: it targets whichever parameter is aVersionOption, which the subclass still is.