deploy
Static site deploy module — push generated docs to hosting providers.
Classes
class
class BaseDeployer(ABC)
Abstract base class for documentation deployers.
Methods
def
@abstractmethod
def deploy(self, docs_dir: Path) -> str
Deploy docs directory and return the deployed URL.
class
class NetlifyDeployer(BaseDeployer)
Deploy generated docs to Netlify via the REST API.
Requires env var NETLIFY_TOKEN and optionally NETLIFY_SITE_ID.
Methods
def
def __init__(self, token: str | None = None, site_id: str | None = None)
Initializes the Netlify API client.
Args:
token: The Netlify token, or None to use the NETLIFY_TOKEN environment variable.
site_id: The site ID, or None to use the NETLIFY_SITE_ID environment variable.
Raises:
ValueError: If the Netlify token is not provided and not set in the NETLIFY_TOKEN environment variable.
def
def deploy(self, docs_dir: Path) -> str
Deploy Netlify site and upload files.
Args:
docs_dir: The directory containing the files to deploy.
Returns:
The ID of the created deploy.
Raises:
httpx.HTTPError: If the request to the Netlify API fails.
Exception: If an unexpected error occurs during deployment.
class
class VercelDeployer(BaseDeployer)
Deploy generated docs to Vercel via the REST API.
Requires env var VERCEL_TOKEN and optionally VERCEL_PROJECT_ID.
Methods
def
def __init__(self, token: str | None = None, project_id: str | None = None)
Initializes the Vercel client.
Args:
token: Vercel API token, or None to use the VERCEL_TOKEN environment variable.
project_id: Vercel project ID, or None to use the VERCEL_PROJECT_ID environment variable.
Raises:
ValueError: If the Vercel token is not provided and not set in the VERCEL_TOKEN environment variable.
def
def deploy(self, docs_dir: Path) -> str
Deploy documentation to Vercel.
Args:
docs_dir: The directory containing the documentation files to deploy.
Returns:
The URL of the deployed documentation.
Raises:
httpx.HTTPError: If the HTTP request to deploy the documentation fails.
json.JSONDecodeError: If the response from Vercel is not valid JSON.
class
class S3Deployer(BaseDeployer)
Deploy generated docs to an AWS S3 bucket.
Requires env vars: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, S3_BUCKET.
Methods
def
def __init__(self, bucket: str | None = None, region: str | None = None)
Initialize an S3 client with optional bucket and region.
Args:
bucket: The S3 bucket name, or None to use the S3_BUCKET environment variable.
region: The AWS region, or None to use the AWS_REGION environment variable.
Raises:
ValueError: If the S3 bucket is not provided and the S3_BUCKET environment variable is not set.
def
def deploy(self, docs_dir: Path) -> str
Deploy documentation to an S3 bucket.
Args:
docs_dir: The directory containing the documentation to deploy.
Returns:
The URL of the deployed documentation.
Raises:
ImportError: If boto3 is not installed.
Functions
def
def get_deployer(target: str, **kwargs) -> BaseDeployer
Get a deployer instance by target name.