Skip to main content

A tool for bootstrapping and managing documentation project structures

Project description

DocStrap

A tool for creating structured documentation hierarchies.

Installation

# Using pipx (recommended for CLI usage)
pipx install docstrap

# Using pip
pip install docstrap

# Using poetry
poetry add docstrap

Usage

CLI

# Create structure using config
docstrap -c config.yaml

# Create in specific directory
docstrap -c config.yaml -d /path/to/project

# Preview changes without making them
docstrap -c config.yaml --dry-run

# Skip confirmation prompts
docstrap -c config.yaml -y

# Enable verbose output
docstrap -c config.yaml -v

Library

from pathlib import Path
from docstrap import DocumentationManager, StructureConfig, SilentFileHandler

# Load config from YAML
config = StructureConfig.from_yaml("config.yaml")

# Or create programmatically
config = StructureConfig(
    docs_dir="docs",  # Use "." for project root
    use_numbered_prefix=True,
    use_markdown_headings=True,
    initial_prefix=10,
    dir_start_prefix=20,
    prefix_step=10,
    padding_width=3,
    directories={
        "guides": ["getting-started.md"],
        "reference": ["api.md"]
    },
    top_level_files=["index.md"]
)

# Choose handler:
# - SilentFileHandler: No prompts
# - InteractiveFileHandler: Prompt before changes
# - DryRunFileHandler: Preview only
handler = SilentFileHandler()

# Create structure
manager = DocumentationManager(config, handler)
manager.create_structure(Path("/path/to/project"))  # Optional path

Configuration

# Documentation directory (use "." for project root)
docs_dir: "docs"

# Enable/disable numbered prefixes (010_, 020_, etc.)
use_numbered_prefix: true

# Enable/disable markdown h1 headings in .md files
use_markdown_headings: true

# Numbering configuration
initial_prefix: 10  # Start with 010
dir_start_prefix: 20  # Start with 020
prefix_step: 10  # Increment by 10
padding_width: 3  # For 010, 020, etc.

# Directory structure
directories:
  - guides:
      - getting-started.md
      - configuration.md
  - reference:
      - api.md
  - examples:
      - basic.md
      - advanced.md

# Top-level files
top_level_files:
  - index.md

Output Example

With use_numbered_prefix: true:

docs/
├── README.md
├── 010_index.md
├── 020_guides/
│   ├── 010_getting-started.md
│   └── 020_configuration.md
├── 040_reference/
│   └── 010_api.md
└── 060_examples/
    ├── 010_basic.md
    └── 020_advanced.md

With use_numbered_prefix: false:

docs/
├── README.md
├── index.md
├── guides/
│   ├── getting-started.md
│   └── configuration.md
├── reference/
│   └── api.md
└── examples/
    ├── basic.md
    └── advanced.md

Development

# Setup
git clone https://github.com/yourusername/docstrap.git
cd docstrap
poetry install

# Setup pre-commit hooks
poetry run pre-commit install

# Test
poetry run pytest

# Lint (also run automatically on commit)
poetry run black .
poetry run isort .
poetry run mypy src/docstrap
poetry run pylint src/docstrap

License

MIT - see LICENSE.md

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

docstrap-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

docstrap-0.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file docstrap-0.1.0.tar.gz.

File metadata

  • Download URL: docstrap-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for docstrap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d5377bba1bbad25d25811b4ada7726b0c0e6f3fd60f24d7a8e4430a123286d4d
MD5 c36b85d1d654b7b432bf35eb608df750
BLAKE2b-256 6a9d9a394aca9fdf3b37a7ea61e9eec7963b07fd5fc2666bf178a8bec4b6e07a

See more details on using hashes here.

Provenance

The following attestation bundles were made for docstrap-0.1.0.tar.gz:

Publisher: publish.yml on tjcunliffe/docstrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file docstrap-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: docstrap-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for docstrap-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e155d23286eea4b5cb70546d0b5d05ca1a70732511c50e63b64910acffddd14
MD5 c24e3829007be4c61bf4dd14f41281f8
BLAKE2b-256 2929e5d5f269af9efb808dc34333827a37da194414f25a9a6bb018959e3c1e9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for docstrap-0.1.0-py3-none-any.whl:

Publisher: publish.yml on tjcunliffe/docstrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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