Project scaffolding and native builds
Project scaffolding, existing-project adoption, and local native wheel builds.
ship_new creates a plain Python project by default, or selects another starter via --kind (python, maturin, crate, zig, site) with optional --nb notebook authoring in ship/. ship_rs_init and ship_npm_init wire packaging and CI in existing repositories without modifying application source files. ship_rs_build and ship_zig_build build local native wheels through uv build --wheel and the project's configured PEP 517 backend.
ship-new my-project
ship-new my-project --nb
ship-new my-rust-ext --kind maturin --nb
ship-new my-blog --kind site
Creating and adopting projects
Create new repositories with ship_new, or wire packaging and CI into existing repositories with ship_rs_init and ship_npm_init.
ship_new
def ship_new(
name:str, # Project or site name, e.g. `"my-project"`
kind:str='python', # Starter kind: `"python"`, `"maturin"`, `"crate"`, `"zig"`, or `"site"`
nb:bool=False, # Include notebook authoring starter (`ship/index.ipynb` and `ship/00_core.ipynb`, or `index.ipynb` for `site`)
package:str=None, # Python package import name, e.g. `"my_project"` (defaults from `name`)
description:str=None, # Short project description (defaults per `kind`)
path:str='.', # Parent directory to create the project folder in
gh_org:str='AnswerDotAI', # GitHub organization for repository and docs URLs
force:bool=False, # Overwrite the target folder if it already exists
)->pathlib._local.Path: # Path to the created project directory
Create a new fastship project or standalone site.
kind selects the starter template: "python" (default), "maturin" (PyO3/Cargo workspace with fastws.build_backend), "crate" (pure Rust crate), "zig" (CFFI/Zig shared library), or "site" (standalone ship.toml website/blog with content in ship/). Pass --nb to add notebook authoring (ship/index.ipynb and ship/00_core.ipynb with a manual export cell, or ship/index.ipynb for "site").
ship-new my-project
ship-new my-project --nb
ship-new my-ext --kind maturin --nb
ship-new my-site --kind site
ship_rs_init
def ship_rs_init(
branch:str=None, # Release branch for `[tool.fastship]` (defaults to existing or current branch)
force:bool=False, # Overwrite existing `[tool.fastship]` keys
):
Configure an existing maturin/PyO3 project's pyproject.toml for fastship without modifying application source files.
Removes any static [project].version, adds "version" to [project].dynamic, adds [project.optional-dependencies].dev when absent, sets [tool.fastship].branch, and prints the lines to add manually if you want runtime __version__ exposed from Cargo.
ship_npm_init
def ship_npm_init(
branch:str=None, # Release branch for `[tool.fastship]` (defaults to existing or current branch)
force:bool=False, # Overwrite an existing `.github/workflows/ci.yml`
)->pathlib._local.Path: # Path to the generated `.github/workflows/ci.yml`
Configure an existing Python+npm or npm-only project for tag-triggered OIDC releases via GitHub Actions.
Writes .github/workflows/ci.yml (running npm run build when defined, uv build --clear for Python+npm, and publishing on v* tags). For Python+npm projects, syncs package.json's version to Python's version, sets [tool.fastship] release = "tag", and adds "package.json" to version-files.
Local native builds
Build native wheels locally for maturin/PyO3 and Zig projects through uv build --wheel and the configured PEP 517 backend.
ship_rs_build
def ship_rs_build(
profile:str='release', # Cargo build profile (`"release"`, `"dist"`, `"dev"`, etc.)
target:str=None, # Optional Rust target triple
outdir:str='dist', # Directory to write the built wheel into
args:str='', # Extra CLI arguments forwarded to maturin's build backend
):
Build a maturin/PyO3 wheel through uv build --wheel and the configured PEP 517 backend.
Passes --profile (and --target / args when given) via -C maturin.build-args=..., preserving fastws.build_backend native binary staging when configured.
ship_zig_build
def ship_zig_build(
quiet:bool=False, # Reduce `uv build` output verbosity
):
Build the current platform wheel for a fastship Zig project (ziglang in [build-system].requires) via uv build --clear --wheel.