Skip to main content

brandspec

CI PyPI Python 3.11+

brandspec separates conceptual direction (authored as a declarative JSON specification) from geometric execution (compiled with exact Bezier booleans, symmetry, and optical normalization). Given the same spec.json, brandspec produces a byte-identical monochrome SVG, a 4-panel PNG inspection sheet, and deterministic raster quality metrics with zero headless browser dependencies.

Brandspec Thumbnail

Architecture

  • Core Geometry (core/): Resolves centered square, isometric (30-degree axial), and polar grids, builds continuous grid_path polylines with exact cubic Bezier corner fillets, applies symmetry, and computes outward halo offsets via skia-pathops.
  • Mark Engine (engines/mark/): Compiles constructive primitives (grid_path, arc_band, circle, ring, rect, polygon) and parametric optical effects (line_screen, radial_blades, halftone_grid) with clip_to masks, halo, and scoped halo_targets.
  • Visual Inspection (inspect/): Rasterizes via resvg-py to render a 4-panel sheet.png and computes metrics.json checks via numpy and pillow.
  • Expandable Engine Layout: Designed so future engines (wordmark, lockup, icons, pattern, kit, tokens) and an interactive localhost review surface can plug into the same core and spec.json loop.

Project Layout

brandspec/
├── .github/workflows/
│   ├── ci.yml                        # Pytest and wheel build checks
│   └── publish.yml                   # PyPI Trusted Publishing on v* tags
├── LICENSE                           # GNU General Public License v3.0
├── pyproject.toml
├── skills/brandspec/SKILL.md         # Agent workflow and DSL guide
├── samples/                          # Reference brand mark specs
│   ├── kronos-chambers.json
│   ├── solaris-aperture.json
│   └── vela-sails.json
├── src/brandspec/
│   ├── cli.py                        # CLI commands: archetypes, init, build, check
│   ├── core/                         # Shared grid, path, fillet, and symmetry helpers
│   ├── engines/mark/                 # Geometric and optical mark compiler + archetypes
│   └── inspect/                      # 4-panel sheet.png renderer and metrics gate
└── tests/
    └── test_compiler.py

Installation and Usage

Requires Python 3.11 to 3.13 and uv.

Install the CLI globally from GitHub (or PyPI once published):

uv tool install git+https://github.com/rafifmsn/brandspec
brandspec archetypes

Or run directly in one command with uvx:

uvx --from git+https://github.com/rafifmsn/brandspec brandspec archetypes

Or run locally from a clone:

uv sync --extra dev
uv run brandspec archetypes
uv run brandspec init ribbon-weave --out spec.json
uv run brandspec build spec.json --out-dir out/ribbon-weave
uv run brandspec check spec.json

Install the bundled agent skill:

npx skills add rafifmsn/brandspec

CLI Commands

Command Description
brandspec archetypes Lists all bundled mark starter templates.
brandspec init <archetype> --out <path> Copies a bundled archetype spec to a working spec.json.
brandspec build <spec.json> [--out-dir <dir>] [--strict] Compiles logo.svg, sheet.png, metrics.json, and locked spec.json. Exits with code 2 under --strict if any quality warning triggers.
brandspec check <spec.json> Validates the schema and prints metrics.json without writing output files.

Design Specification (spec.json)

All coordinates, widths, and clearances are expressed in multiples of unit on a centered grid origin (0, 0).

Grids

  • square: [x, y] in grid units (+x right, +y down).
  • isometric: [q, r] 30-degree axial coordinates ((1, 0) down-right 30 deg, (0, 1) straight down, (1, -1) up-right 30 deg).
  • polar: [ring, angle_deg] (0 deg at 12 o'clock, increasing clockwise).

Shapes

  • grid_path: Continuous open or closed polyline through grid points with optional width (0 for filled polygon), corner_radius, cap (butt, round, square), and join (miter, round, bevel).
  • arc_band: Circular arc or filled pie wedge defined by center, radius, start_deg, end_deg, width, and fill_sector.
  • circle, ring, rect, polygon: Standard geometric primitives with optional angle_deg and corner_radius.
  • line_screen: Parallel stripes modulated by constant, linear, center_bulge, center_pinch, sine, or exponential thickness profiles.
  • radial_blades: N-fold twisted curved blades arranged radially around a center.
  • halftone_grid: Grid of circle, square, or diamond cells scaled by radial_decay, radial_grow, linear_x, linear_y, diagonal, or sine_ripple.

Layered Booleans, halo, and halo_targets

Each entry in layers supports op (unite, subtract, intersect, xor), optional clip_to silhouette masks, and optional per-layer symmetry (none, mirror_x, mirror_y, mirror_xy, rotate, glide_x).

Setting "halo": 0.38 on a unite layer automatically dilates that layer outward and subtracts the clearance gap from earlier layers before uniting. To weave bands over and under each other without cutting earlier segments of the same band, set "halo_targets": ["<crossing-layer-id>"] so the clearance carve applies only to the specified target layers.

Visual Audit and Metrics Gate

Every brandspec build outputs:

  1. logo.svg: Flattened single-path monochrome vector normalized to 1000x1000.
  2. sheet.png: 4-panel visual sheet showing (1) the construction grid overlay, (2) 400px positive render, (3) 400px inverted render, and (4) 96px, 48px, and 24px positive/inverted scale tests.
  3. metrics.json: Automated checks covering ink_ratio (target 0.16 to 0.72), ink_ratio_24px (0.06 to 0.74), bbox_aspect (<= 2.6), island_count, tiny_island_count (0 tolerated), and optical_drift_pct.
  4. spec.json: Locked specification for deterministic reproduction.

Bundled Archetypes and Samples

Recipe Category Grid Focus
ribbon-weave geometric square Interlocking stadium links using halo and halo_targets
iso-impossible geometric isometric Three-fold rotational folded hexagon
line-screen-disc effect square Linearly modulated stripes clipped to a sphere with diagonal cut
radial-vortex effect polar Six-blade twisted optical aperture
stencil-monogram monogram square Modular figure-ground letterform with rounded arches
samples/vela-sails.json effect square Concave curved sails over a modulated stripe hull
samples/solaris-aperture.json effect polar Eight-blade kinetic core inside a segmented corona ring
samples/kronos-chambers.json geometric square Four-way interlocking acoustic chambers around a central core

Development

uv run pytest -v
uv build

License

GNU General Public License v3.0 (LICENSE).

Metadata

Release files for brandspec 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brandspec 0.1.0
File Size Uploaded Provenance Actions
brandspec-0.1.0.tar.gz 162.5 kB With provenance Details for brandspec-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for brandspec 0.1.0
File Interpreter ABI Platform Actions
brandspec-0.1.0-py3-none-any.whl Python 3 none any Details for brandspec-0.1.0-py3-none-any.whl

Total release size: 199.9 kB

Release files / brandspec-0.1.0.tar.gz

Download URL brandspec-0.1.0.tar.gz
Size 162.5 kB
Tags Source
SHA-256 checksum
How to use checksums
55bdc5b92b1a9319ed96a8fb500e32affb5f66b131bc4585bb57249fbc4ef672
BLAKE2b-256 checksum
How to use checksums
68607e197ec8eec25d6a8ab8d680127768947445727e9d7a74d43ed031b8df3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / brandspec-0.1.0-py3-none-any.whl

Download URL brandspec-0.1.0-py3-none-any.whl
Size 37.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6f73c8b7b9b42f7ec03710e34c538a2b6ddbf82cdceb176b95614d907c9693f3
BLAKE2b-256 checksum
How to use checksums
184784e62d18c1594a613a004d8da063ae8ad52e3d4c5966e8c6eb0f88447f28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for brandspec 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for brandspec-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page