CLI Tools PluginΒΆ

Advanced development and automation tools for Structum framework.

Plugin License


OverviewΒΆ

The CLI Tools plugin extends the base Structum CLI with industry-grade features for security, testing, profiling, release automation, and more.

ArchitectureΒΆ

The plugin respects Structum’s Zero-Dependency philosophy by separating core from advanced tools:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ structum (Meta Package)              β”‚
β”‚ β”œβ”€ check      (Ruff/Black)           β”‚ ← Zero-Dep Core
β”‚ β”œβ”€ build-docs (Sphinx)               β”‚
β”‚ └─ license    (REUSE)                β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ structum-cli-tools (This Plugin)     β”‚
β”‚ β”œβ”€ security   (Bandit, Safety)       β”‚ ← Batteries-Included
β”‚ β”œβ”€ test       (pytest, coverage)     β”‚
β”‚ β”œβ”€ profile    (py-spy, memory)       β”‚
β”‚ β”œβ”€ release    (semantic-release)     β”‚
β”‚ β”œβ”€ api        (griffe)                β”‚
β”‚ β”œβ”€ plugin     (marketplace)           β”‚
β”‚ β”œβ”€ validate   (contract testing)      β”‚
β”‚ β”œβ”€ i18n       (babel)                 β”‚
β”‚ └─ telemetry  (opt-in analytics)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Auto-Discovery: Commands automatically register when plugin is installed (via entry points).


InstallationΒΆ

With Meta PackageΒΆ

# Recommended: Full tooling
pip install structum structum-cli-tools

StandaloneΒΆ

# Plugin only (requires structum)
pip install structum-cli-tools

DevelopmentΒΆ

# Clone repository
git clone https://github.com/PythonWoods/structum.git
cd structum

# Install with workspace
uv sync --extra dev

FeaturesΒΆ

πŸ”’ Security ScanningΒΆ

Static code analysis + dependency vulnerability checking:

structum security scan              # Bandit code scan
structum security audit             # Full audit (Bandit + Safety)
structum security report -o sec.json  # JSON report

See: :doc:/cli/security | :doc:/security/scanning


πŸ§ͺ Testing & CoverageΒΆ

pytest integration with enforced thresholds:

structum test                       # Run tests
structum test --cov                 # With coverage
structum test --cov --cov-fail-under=90  # Enforce 90%

Configuration: .coveragerc, pyproject.toml [tool.pytest]

See: :doc:/cli/testing


⚑ Performance Profiling¢

CPU and memory profiling for optimization:

structum profile run app.py         # CPU profiling
structum profile memory app.py      # Memory tracking
structum profile benchmark          # Run benchmarks

Tools: py-spy, memory_profiler, pytest-benchmark

See: :doc:/cli/profiling


πŸš€ Release AutomationΒΆ

Semantic versioning and changelog generation:

structum release prepare            # Bump version + changelog
structum release validate           # Pre-release checks
structum release publish            # Publish to PyPI

Based on: Conventional Commits, semantic-release

See: :doc:/cli/release | :doc:/contributing/releasing


πŸ“œ API StabilityΒΆ

Detect breaking changes in public API:

structum api diff v0.1.0..HEAD      # Compare versions
structum api validate               # Check current API

Tool: griffe (Python API inspector)

See: :doc:/cli/api


πŸ”Œ Plugin MarketplaceΒΆ

Discover and install community plugins:

structum plugin search redis        # Search plugins
structum plugin install structum-redis  # Install
structum plugin verify structum-redis   # Verify signatures

Registry: registry/plugins.json (GitHub Pages)

See: :doc:/cli/plugins | :doc:/plugins/marketplace


βœ… Contract TestingΒΆ

Validate plugin compliance with protocols:

structum validate plugin packages/auth/
structum validate all

Validates: Protocol implementation, type safety

See: :doc:/cli/validation | :doc:/plugins/development


🌍 Internationalization¢

Multi-language CLI support:

structum i18n extract               # Extract messages
structum i18n compile               # Compile .mo files
structum --lang=it check            # Italian messages

Platform: GNU gettext + Babel

See: :doc:/cli/i18n | :doc:/contributing/i18n


πŸ“ˆ Telemetry (Opt-in)ΒΆ

Privacy-first anonymous analytics:

structum telemetry enable           # Opt-in
structum telemetry status           # Check status
structum telemetry disable          # Opt-out

What’s collected: Command usage, error types (NO personal data)

See: :doc:/cli/telemetry | :doc:/privacy/policy


DevelopmentΒΆ

Adding New CommandsΒΆ

  1. Create module in src/structum/plugins/cli_tools/:

# src/structum/plugins/cli_tools/mycommand.py
import typer

mycommand_app = typer.Typer(
    name="mycommand",
    help="My new command",
)

@mycommand_app.command()
def run():
    """Run my command."""
    print("Hello!")
  1. Register in __init__.py:

def register_commands(app: typer.Typer) -> None:
    from structum.plugins.cli_tools.mycommand import mycommand_app
    app.add_typer(mycommand_app, name="mycommand")
  1. Document:

    • Add docs/cli/mycommand.rst

    • Update docs/cli/index.md

    • Add cross-references

  2. Test:

    • Create tests/cli_tools/test_mycommand.py

    • Verify help text

    • Integration test


Architecture DetailsΒΆ

Entry PointsΒΆ

Plugin registration via pyproject.toml:

[project.entry-points."structum.cli_plugins"]
cli_tools = "structum.plugins.cli_tools:register_commands"

Auto-DiscoveryΒΆ

Meta CLI loads plugins automatically:

# In structum.cli (Meta package)
from importlib.metadata import entry_points

for ep in entry_points(group="structum.cli_plugins"):
    register_func = ep.load()
    register_func(app)

Graceful DegradationΒΆ

If plugin not installed, commands unavailable but no errors:

$ structum security scan
# Without structum-cli-tools:
# Error: Unknown command 'security'
# Install with: pip install structum-cli-tools

DependenciesΒΆ

SecurityΒΆ

  • bandit[toml]>=1.7.5 - Code vulnerability scanner

  • safety>=3.0.0 - Dependency CVE checker

TestingΒΆ

  • pytest>=7.4.0 - Test framework

  • pytest-cov>=4.1.0 - Coverage plugin

  • coverage[toml]>=7.3.0 - Coverage measurement

ProfilingΒΆ

  • py-spy>=0.3.14 - Sampling profiler

  • memory-profiler>=0.61.0 - Memory tracking

  • pytest-benchmark>=4.0.0 - Benchmarking

ReleaseΒΆ

  • python-semantic-release>=8.5.0 - Semantic versioning

  • towncrier>=23.11.0 - Changelog generation

OthersΒΆ

  • griffe>=0.38.0 - API inspection

  • requests>=2.31.0 - HTTP client (marketplace)

  • keyring>=24.3.0 - Secure credential storage

  • babel>=2.14.0 - Internationalization


ContributingΒΆ

See main CONTRIBUTING for guidelines.

Plugin-specific:

  • All commands must have comprehensive docstrings

  • Sphinx cross-references required

  • Examples in both docstrings and .rst files

  • Unit tests + integration tests

  • Ruff/Black compliant


LicenseΒΆ

Apache-2.0 - See LICENSE


See AlsoΒΆ

  • :doc:/cli/index - Complete CLI reference

  • :doc:/plugins/development - Plugin development guide

  • :doc:/architecture/cli-design - CLI plugin system design

  • :mod:structum.cli - Base CLI module

  • :mod:structum.plugins.cli_tools - Plugin API reference