HPY Tool Documentation

Command-Line Usage

The hpy command is the main interface for interacting with hpy-tool. Here's a breakdown of the available commands and options.

$ hpy --help

usage: hpy [-h] [--init PROJECT_DIR] [-o DIR] [-v] [-s] [-p PORT] [-w] [--version] [SOURCE]

HPY Tool: Compile/serve .hpy projects. Configurable via hpy.toml.

positional arguments:
  SOURCE                Path to source .hpy file or directory.
                        (default: 'src' from hpy.toml or built-in)

options:
  -h, --help            show this help message and exit
  --init PROJECT_DIR    Initialize a new HPY project structure (creates hpy.toml). Ignores SOURCE.
  -o DIR, --output-dir DIR
                        Directory for compiled output.
                        (overrides hpy.toml, default: 'dist' from hpy.toml or built-in)
  -v, --verbose         Enable detailed output.
  -s, --serve           Start a dev server serving the output directory.
  -p PORT, --port PORT  Port for the development server.
                        (default: 8000)
  -w, --watch           Watch source for changes and rebuild/sync. Requires 'watchdog'.
                        Using -w implies -s and uses the effective input/output dirs.
  --version             show program's version number and exit

Positional Arguments

Options

Common Usage Examples

# Initialize a new project in 'my_app' directory
hpy --init my_app

# Build the project using settings from hpy.toml (e.g., src -> dist)
hpy

# Build the project, overriding the output directory
hpy -o build

# Build using a specific source directory, overriding output
hpy app_source -o public

# Build only a single file (no layout/static handling) into 'dist'
hpy src/pages/contact.hpy

# Build project and serve from the output directory on default port 8000
hpy -s

# Build project, watch for changes, and serve on port 8080
# (Uses input/output from hpy.toml or defaults)
hpy -w -p 8080

# Watch only a single file (no layout/static handling) and serve its output
# (Output placed in 'dist/single.html' by default, server serves 'dist')
hpy src/single.hpy -w
# Make sure this closing tag is aligned as needed