API¶
Pyrig plugin for generating a project's logo, banner, and badge configuration.
rig ¶
Pyrig runtime integration for the badge plugin.
configs ¶
Configuration managers that add project badges to generated files.
base ¶
Shared base configuration classes for badge-enabled files.
badges ¶
Badge-augmented Markdown configuration base class.
BadgesConfigFile ¶
Bases: BadgesConfigFile
Add the generated project banner before the base class's badge groups.
badges_content() -> str
Return the project banner followed by the generated badge groups.
Returns:
| Type | Description |
|---|---|
str
|
Markdown containing the banner image and the base badge content. |
Source code in src/pyrig_badge/rig/configs/base/badges.py
image_path() -> Path
Return the configured banner file's path.
Returns:
| Type | Description |
|---|---|
Path
|
Path to the project's banner asset. |
logo_content() -> str
Return a linked Markdown image for the project's banner.
Returns:
| Type | Description |
|---|---|
str
|
Markdown linking the banner image to its own file, using the |
str
|
project name as its alternative text. |
Source code in src/pyrig_badge/rig/configs/base/badges.py
svg ¶
Base class for managing dictionary-backed SVG configuration files.
SVGConfigFile ¶
Bases: XMLConfigFile
Manage SVG files using the XML configuration lifecycle.
insert_svg(svg: type[SVGConfigFile]) -> dict[str, Any]
Return svg's content as a nested <svg> element.
The nested element mirrors the loaded root of svg, including its
attributes and children, so this SVG is self-contained and changes to
svg propagate on sync. Its width, height, and viewBox are
svg's values, and its x and y place it at this SVG's viewBox
origin plus half the remaining space, rounded down to integers; these
five attributes override any same-named attributes of svg. The
inserted dimensions must be integer strings and are used unchanged as
this SVG's user-space dimensions, so svg is not scaled to fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
svg
|
type[SVGConfigFile]
|
The |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary representing a nested |
dict[str, Any]
|
|
dict[str, Any]
|
this SVG's viewBox. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the inserted dimensions are not integer strings or the viewBox is not four whitespace-separated integer values. |
Source code in src/pyrig_badge/rig/configs/base/svg.py
abstractmethod
¶Return the SVG-specific configuration dictionary.
The _configs method adds the root <svg> element, namespace,
dimensions, and viewBox. Returned attributes override those defaults.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary representing the SVG configuration. |
Source code in src/pyrig_badge/rig/configs/base/svg.py
Split the viewBox into its four whitespace-separated values.
Returns:
| Type | Description |
|---|---|
tuple[str, str, str, str]
|
Minimum x, minimum y, width, and height, in that order, as strings. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the viewBox does not contain exactly four whitespace-separated values. |
Source code in src/pyrig_badge/rig/configs/base/svg.py
xml ¶
Base class for managing dictionary-backed XML configuration files.
XMLConfigFile ¶
Bases: DictConfigFile
Manage XML using element names, @ attributes, and #text content.
Repeated elements are represented as lists. Subclasses must implement
parent_path(), stem(), and _configs(), returning one root element.
Values should use the strings and structures returned by xmltodict.parse.
This dictionary representation does not preserve mixed-content ordering.
docs ¶
Configuration managers for documentation assets and pages.
badge ¶
Configuration manager for the Shields.io badge JSON asset.
BadgeConfigFile ¶
Bases: JSONDictConfigFile
Generate project badge data and embed the configured logo SVG.
banner ¶
Configuration manager for the generated documentation banner.
BannerConfigFile ¶
Bases: SVGConfigFile
Manage the banner SVG, centering the logo within a viewBox that fits it.
parent_path() -> Path
Return the documentation assets directory.
Returns:
| Type | Description |
|---|---|
Path
|
The same directory used by the project logo. |
Return the logo's SVG content inserted within the banner's viewBox.
Centering offsets are rounded down to integers by insert_svg.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary representing a nested |
dict[str, Any]
|
the logo's content. |
Source code in src/pyrig_badge/rig/configs/docs/banner.py
view_box() -> str
Return the stored viewBox, enlarged to fit the logo if needed.
The inserted logo is sized in the banner's user units, so the viewBox
width and height are raised to at least the logo's width and height
to prevent cropping. The minimum coordinates are kept, and the
banner's width and height are unchanged because the viewBox
scales to them.
Returns:
| Type | Description |
|---|---|
str
|
The viewBox as four whitespace-separated integers. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the stored viewBox does not contain exactly four whitespace-separated values, or its size or the logo's dimensions are not integers. |
Source code in src/pyrig_badge/rig/configs/docs/banner.py
index ¶
Configuration file manager for the documentation landing page.
IndexConfigFile ¶
Bases: BadgesConfigFile, IndexConfigFile
Generate the documentation landing page with its banner and badges.
logo ¶
Configuration manager for the generated documentation logo.
LogoConfigFile ¶
Bases: SVGConfigFile
Manage the project logo SVG under the documentation assets directory.
parent_path() -> Path
Return the documentation assets directory.
Returns:
| Type | Description |
|---|---|
Path
|
The documentation source directory joined with |
Return no additional SVG elements or attributes.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
An empty dictionary; the base SVG config supplies the required |
dict[str, Any]
|
root element, namespace, dimensions, and viewBox, and Pyrig merges |
dict[str, Any]
|
existing SVG content. |
Source code in src/pyrig_badge/rig/configs/docs/logo.py
readme ¶
Configuration management for the project's README.md file.
ReadmeConfigFile ¶
Bases: BadgesConfigFile, ReadmeConfigFile
Generate the project README with the configured banner and badges.