Skip to main content

A Python-first architectural linter for small, composable, Unix-like code.

Project description

Bubbles Lint logo

Bubbles Lint is an architectural linter for Python code. It is inspired by Unix and Linux software design principles: do one thing well, keep modules small, compose simple parts, and make boundaries easy to inspect.

Think of it as Ruff for architecture. It does not compete with Ruff, Black, Flake8, or Pylint. Bubbles Lint looks for software shape problems: code that is too large, too coupled, too magical, or too monolithic.

Installation

pip install bubbles-lint

For local development from this repository:

pip install -e ".[dev]"

Usage

Scan the current repository:

bubbles-lint scan .

Emit JSON for CI systems:

bubbles-lint scan . --json

Bubbles Lint exits with status 1 when findings are present and 0 when the scan is clean.

Philosophy

Bubbles Lint encourages codebases where:

  • modules have one clear responsibility
  • functions and classes stay small enough to replace
  • dependencies flow through explicit interfaces
  • configuration is loaded at the edge
  • side effects are isolated from pure logic
  • text and data move through well-defined boundaries
  • components are easy to inspect, test, and swap

The goal is not style enforcement. The goal is software design discipline, especially in Python codebases that have grown quickly with help from AI coding assistants.

Rules

Bubble Burst

Flags code that has grown too large:

  • files over max_file_lines
  • functions over max_function_lines
  • classes with more than max_class_methods
  • functions with more than max_function_params

Bubble Leak

Flags hidden coupling and mixed side effects:

  • global mutable state
  • direct environment variable reads outside config modules
  • functions mixing too many side-effect categories, such as filesystem, network, database, subprocess, logging, and rendering

Bubble Boundary

Flags dependency boundary problems:

  • circular imports where practical
  • modules importing too many dependencies
  • imports from private modules like from package._internal import thing

AI Smells

Flags common broad abstractions produced in rushed or generated code:

  • oversized utils.py, helpers.py, manager.py, and service.py modules
  • broad classes ending in Manager, Service, or Handler
  • deeply nested control flow

Configuration

Configure Bubbles Lint in pyproject.toml:

[tool.bubbles-lint]
max_file_lines = 500
max_function_lines = 50
max_class_methods = 10
max_function_params = 5
max_imports_per_module = 20
max_nesting_depth = 4
allow_private_imports = false

Additional knobs:

[tool.bubbles-lint]
max_side_effect_kinds = 3
max_ai_module_lines = 200
max_ai_class_dependencies = 8
excludes = ["generated"]

Bubbles Lint always ignores .venv, venv, .git, __pycache__, build, and dist.

Existing [tool.bubbles] configs are still read for compatibility, but new projects should use [tool.bubbles-lint].

Human Output

Bubble: Bubble Burst

src/payment_service.py:1
warning: File has 1437 lines; recommended maximum is 500.

Suggestion:
Split this module into smaller bubbles with one responsibility each.

JSON Output

{
  "findings": [
    {
      "rule": "bubble-burst/file-too-large",
      "severity": "warning",
      "path": "src/payment_service.py",
      "line": 1,
      "message": "File has 1437 lines; recommended maximum is 500.",
      "suggestion": "Split this module into smaller bubbles with one responsibility each."
    }
  ],
  "files_scanned": 1
}

CI

Example GitHub Actions step:

- name: Install Bubbles Lint
  run: pip install .

- name: Scan architecture
  run: bubbles-lint scan . --json

Development

Run tests:

pip install -e ".[dev]"
pytest

The rule engine is intentionally small. New rules implement a check(context) method and return Finding objects. Parsing, configuration, scanning, reporting, and CLI code are separated so the tool can grow without becoming the kind of monolith it warns about.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bubbles_lint-0.1.1.tar.gz (307.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bubbles_lint-0.1.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file bubbles_lint-0.1.1.tar.gz.

File metadata

  • Download URL: bubbles_lint-0.1.1.tar.gz
  • Upload date:
  • Size: 307.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for bubbles_lint-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dabb1a2e3d6283ca194f3b849660d8128d6b752f0b6f87fe454690e56861221b
MD5 1ede2d454220ad0a9fb81abb36bbb018
BLAKE2b-256 047f9d18c52d2c3069a6c9c59d2c767be18743f2a9256b0a4f47e16b3602e5e7

See more details on using hashes here.

File details

Details for the file bubbles_lint-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bubbles_lint-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for bubbles_lint-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6864a31908e2c054d25d526c144cc39884c5e63c699a0967cd009196d83cf7
MD5 e4a9f43c5a62e4160a3365181ed47998
BLAKE2b-256 d8dc836b76d6a2fed7ef8bcf5aee824906e108673b423a1a45e6358cece29eda

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page