This directory contains utility scripts for maintaining the BambooHR API Python SDK.
Purpose: Runs the full post-generation pipeline after openapi-generator outputs to the project root.
The generator runs with default output (project root), placing package code at bamboohr_sdk/,
docs at docs/, etc. This script handles cleanup and processing after generation.
Steps:
- Cleans up unwanted generator artifacts (
.gitlab-ci.yml,.github/, etc.) - Removes
PublicAPIApifiles and references (internal-only API) - Formats generated code with
ruff - Adds custom headers to API documentation
- Cleans up obsolete files (compares old vs new FILES manifest)
Usage: Called automatically by make generate. Not typically run manually.
python scripts/post_generate.pyPurpose: Removes files that are no longer generated by the OpenAPI Generator.
How it works:
- Before generation, the Makefile backs up
.openapi-generator/FILESto.openapi-generator/FILES.old - After generation, this script compares the old and new FILES manifests
- Files in the old manifest but not the new one are considered obsolete
- The script prompts for confirmation before deleting (unless
--forceis used) - Empty directories are cleaned up automatically
Usage:
# Automatic (runs as part of make generate with --force)
make generate
# Manual with confirmation prompt
make cleanup-obsolete
# or directly:
python scripts/cleanup_obsolete_files.py
# Force mode (no confirmation, for CI/unattended runs)
python scripts/cleanup_obsolete_files.py --forceFirst Run: On the first run there will be no .openapi-generator/FILES.old backup,
so the script will skip cleanup. This is expected. Subsequent runs will properly detect
and remove obsolete files.
Purpose: Generates the specific exception classes in bamboohr_sdk/exceptions.py
from the ERROR_MESSAGES catalog defined in bamboohr_sdk/api_error_helper.py.
Usage: Called automatically by make generate (via post_generate.py). Can also be run manually:
python scripts/generate_exceptions.pyPurpose: Generates exception documentation in docs/Exceptions/ from the error catalog
and mustache templates in templates-python/.
Generates:
docs/Exceptions/Exceptions.md— index of all exception classesdocs/Exceptions/Classes/<Name>Exception.md— per-exception docs with causes and tipsdocs/Exceptions/Classes/ApiException.md— base exception documentationdocs/Exceptions/Classes/ClientException.md— client exception base documentationdocs/Exceptions/Classes/ServerException.md— server exception base documentation
Templates used (from templates-python/):
error_codes_doc.mustache— index page templateexception_doc.mustache— per-exception page templateapi_exception_doc.mustache— ApiException page templateclient_exception_doc.mustache— ClientException page templateserver_exception_doc.mustache— ServerException page template
Usage: Called automatically by make generate (via post_generate.py). Can also be run manually:
python scripts/generate_error_docs.pyDependency: Requires chevron (Mustache renderer). Installed automatically with pip install -e ".[dev]".
Purpose: Orchestrates both exception generation scripts in the correct order:
generate_exceptions.py— updates exception classes inbamboohr_sdk/exceptions.pygenerate_error_docs.py— generates documentation indocs/Exceptions/
Usage: Called automatically by make generate (via post_generate.py). Can also be run manually:
python scripts/update_error_docs.py
# or
make generate-error-docsReference: PHP SDK scripts/update_error_docs.sh