Skip to main content

Boilerplate Tools

A collection of utility functions and tools to simplify common development tasks.

Installation

pip install boilerplate-tools

Features

  • Smart String Formatting: String templating with variable validation
  • Configuration Management: Load and process configuration files
  • JSON I/O: Simple functions for reading, writing, and appending JSON data
  • Path Management: Easily handle Python path configuration

Usage Examples

Smart Format

from boilerplate_tools import smart_format

# Format a string with required variables
result = smart_format("Hello, {name}!", {"name": "World"})
print(result)  # Output: Hello, World!

# Will raise KeyError for missing variables
try:
    smart_format("Hello, {name}!", {})
except KeyError as e:
    print(e)  # Missing required template variable: 'name'

# Will warn about unused variables
import warnings
with warnings.catch_warnings(record=True) as w:
    smart_format("Hello, {name}!", {"name": "World", "unused": "value"})
    if w:
        print(w[0].message)  # Unused variables provided that are not in the template: unused

Configuration Loading

from boilerplate_tools import load_config

# Load a configuration file with variable resolution
config = load_config("config.yaml")
print(config.some_key)

JSON I/O

from boilerplate_tools import read_json, write_json, append_json

# Read a JSON file
data = read_json("data.json")

# Write a JSON file
write_json("output.json", {"name": "John", "age": 30})

# Append to a JSON list file
append_json("list.json", [{"name": "John"}, {"name": "Jane"}])

Path Management

from boilerplate_tools import setup_root

# Add the current directory to sys.path
setup_root()

# Add the parent directory to sys.path
setup_root(n_up=1)

# Get the root directory path
root_dir = setup_root(n_up=1, return_root=True)
print(f"Root directory: {root_dir}")

Development

Distribution creation:

python setup.py sdist bdist_wheel

Upload to PyPI:

twine upload dist/*

TODO

  • Add Pytest tests for all functions

Metadata

Release files for bolerplate-tools 0.1.2

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

Source distribution (sdist)

Source distribution for bolerplate-tools 0.1.2
File Size Uploaded Provenance
bolerplate_tools-0.1.2.tar.gz 6.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bolerplate-tools 0.1.2
File Interpreter ABI Platform
bolerplate_tools-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / bolerplate_tools-0.1.2.tar.gz

Download URL bolerplate_tools-0.1.2.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
44a33f3931144af7438d85ad52f527d3262a43282f2321703949f63437c0dbb7
BLAKE2b-256 checksum
How to use checksums
0586a2074ed1e0f1bafb0543e45fc0e0ace3f5c138ee23e6aa015105190e7269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / bolerplate_tools-0.1.2-py3-none-any.whl

Download URL bolerplate_tools-0.1.2-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ec0402872e198337977e9734e7badff5b383ea5f18f0ea2d96c267392e4e53c
BLAKE2b-256 checksum
How to use checksums
3ace28cb81aad42168594a532015fba669b0d9821737cf4138d86e426a5e5a1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for bolerplate-tools 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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