$npx skillfedfor your agent

hatch-polylith-bricks

Hatch build hook plugin for Polylith

With conditionsPyPI Build ToolsReleased Jul 2026299.6K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — hatch_polylith_bricks-1.5.7-py3-none-any.whl
v1.5.7 · released 2026-07-03 · Python <4.0,>=3.8 · 2 runtime deps: hatchling, tomlkit

Yes, if you are using Hatch as your build backend and Polylith as your monorepo architecture. The hook solves the specific problem of packaging multiple libraries from one workspace without namespace conflicts. Install friction is low, maintenance is active, and there are no known vulnerabilities. Not relevant if you are not using Polylith or a different build system.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Hatch as your build backend and a Polylith workspace structure with bricks in bases/ and components/ directories.
  • Low friction: pure Python wheel with only two lightweight runtime dependencies (hatchling and tomlkit).
  • Active maintenance with a recent release 42 days ago and no security vulnerabilities.

License · maintenance · safety

MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

last release 2026-07-03 (42 days) · last repo commit 2026-08-07 · 553 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 299,580 downloads/mo, #7,857 on PyPI

Verify before relying

Add to pyproject.toml:

[build-system]
requires = ["hatchling", "hatch-polylith-bricks"]
build-backend = "hatchling.build"

[tool.hatch.build.hooks.polylith-bricks]
# Section enables the hook

[tool.polylith.bricks]
"../../bases/my_namespace/my_base" = "my_namespace/my_base"

Then run: hatch build
  • Whether AST-based import rewriting handles all Python import patterns (relative imports, star imports, etc.)
  • Performance impact when rewriting large codebases with many bricks
  • Compatibility with Polylith workspaces using non-standard directory layouts
Same gist for agents: .md · .json

What it is and what it does

This package is a Hatch build hook that bridges Polylith architecture—a modular monorepo pattern—with Python packaging. It reads brick definitions from your pyproject.toml (paths to bases and components in your Polylith workspace) and ensures they are correctly included in built wheels and source distributions. The hook also solves a real packaging problem: when multiple libraries built from the same monorepo share the same top-level namespace, they collide when installed in the same environment. This hook can rewrite imports during packaging to add a custom namespace wrapper, preventing those collisions.

The rewriting uses Python's ast module to parse and modify source code, injecting a custom top namespace into all imports. Without a custom namespace configured, the hook simply includes bricks as-is. It's designed for teams using Polylith who need to publish multiple independent libraries from a single workspace without namespace conflicts.

Use it for

  • Publishing multiple Python libraries from a Polylith monorepo without namespace collisions when installed together.
  • Automatically including Polylith bricks in wheel and sdist distributions during Hatch builds.
  • Adding a custom namespace prefix to library code during packaging to isolate it from other monorepo libraries.
  • Simplifying build configuration for Polylith workspaces by automating brick discovery and inclusion.
  • Rewriting internal imports in source code to reflect a different namespace structure in the published package.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you are using Hatch as your build backend and Polylith as your monorepo architecture.

The hook solves the specific problem of packaging multiple libraries from one workspace without namespace conflicts. Install friction is low, maintenance is active, and there are no known vulnerabilities. Not relevant if you are not using Polylith or a different build system.

Install

hatch-polylith-bricks on PyPI

Before you install

Low friction: pure Python wheel with only two lightweight runtime dependencies (hatchling and tomlkit). Active maintenance with a recent release 42 days ago and no security vulnerabilities.

Requires Hatch as your build backend and a Polylith workspace structure with bricks in bases/ and components/ directories.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

Add to pyproject.toml:

[build-system]
requires = ["hatchling", "hatch-polylith-bricks"]
build-backend = "hatchling.build"

[tool.hatch.build.hooks.polylith-bricks]
# Section enables the hook

[tool.polylith.bricks]
"../../bases/my_namespace/my_base" = "my_namespace/my_base"

Then run: hatch build

Verify before relying

  • Whether AST-based import rewriting handles all Python import patterns (relative imports, star imports, etc.)
  • Performance impact when rewriting large codebases with many bricks
  • Compatibility with Polylith workspaces using non-standard directory layouts

Package facts

LicenseMIT permissive
Python supportSupports the current Python release <4.0,>=3.8
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
hatchlingtomlkit
MaintenanceActively maintained 42 days since the last release
Last repo commit
First released
Downloads299,580 / month, #7,857 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Framework :: HatchLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Evidence: hatch_polylith_bricks-1.5.7-py3-none-any.whl

Tags

Capabilities
hatch build hook polylithpolylith bricks packagingmonorepo namespace collisionhatch plugin architecturepython polylith integrationcustom namespace packagingpolylith workspace build
Topics
monorepopolylith-architecturehatch-plugin

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “hatch build hook polylith”

Give your agent the search over MCP, or paste the wish link into any chat.

More Build Tools packages

packaging Worth it
PyPI · Build Tools · released Aug 2026

Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.

Apache-2.0 OR BSD-2-Clausepure Python · 3.9+
2.2Bdownloads / mo
tqdm Worth it
PyPI · Libraries · released Jul 2026

Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.

copyleftpure Python · 3.8+
648.6Mdownloads / mo
pip Worth it
PyPI · Build Tools · released Aug 2026

pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.

MITpure Python · 3.10+
617.5Mdownloads / mo
hatchling Worth it
PyPI · Python Modules · released Aug 2026

Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.

MITpure Python · 3.10+
484.2Mdownloads / mo
grpcio-tools Worth it
PyPI · Build Tools · released Jul 2026

Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.

Apache-2.0compiled wheel · 3.10+
278.2Mdownloads / mo
pre-commit Worth it
PyPI · Build Tools · released Aug 2026

pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.

Install it if your team needs consistent, automated validation at commit time.

permissive licensepure Python · 3.10+
179.9Mdownloads / mo

See also hatch-cython · polylith-cli · hatch_build_scripts · hatchling-autoextras-hook · hatch-requirements-txt · hatch-regex-commit · hatch-fancy-pypi-readme · hatch-nodejs-version · hatch-vcs