Framework for Python

Project Management

new()

Create a new Python project with your defaults.

Usage

new(
    name: str | None = None,
    location: str | Path | None = None,
    type: str | None = None,
    *,
    workflow: str | None = None,
    tools: Mapping[str, bool] | Sequence[str] | None = None,
    package_sets: Sequence[str] = (),
    skill_sets: Sequence[str] = (),
    blueprint: str | None = None,
    structure: str | None = None,
    skills: Sequence[str] = (),
    sensitive: bool | None = None,
    ai: bool | Mapping[str, Any] | None = None,
    git: bool | None = None,
    key: str | None = None,
    interactive: bool | None = None,
    offline: bool = False,
) -> Path

Arguments

Name Type Default Description
name str | None None

Project name. Asked for when interactive.

location str | Path | None None

The project folder to create. Asked for when interactive.

type str | None None

project, project_sensitive, course, presentation, or bare. When you are logged in to Framework Cloud, every choice is resolved there: a type is its system blueprint (framework/<type>), and with no choices at all the project starts from your defaults. When not logged in, a missing type is asked for interactively and is bare otherwise, as in R's new().

workflow str | None None

How notebooks are written: "jupyter" (.ipynb, with Quarto kept for rendering and publishing), "quarto" (.qmd), or "scripts" (no notebooks). Default: "jupyter" for project and project_sensitive, and the structure's own setup for the others (Quarto for course and presentation).

tools Mapping[str, bool] | Sequence[str] | None None

Tools to turn on, as a list of ids such as ["jupyter"], or a map of id to true or false, which can also turn off a default such as Quarto. A tool another one needs is turned on too, with a message. Default: the type's tools (uv, and Quarto for every type but bare). See tools_available().

package_sets Sequence[str] ()

Package sets to add. Offline, a bundled set; with blueprint or structure, any handle on Framework Cloud.

skill_sets Sequence[str] ()

Skill sets to add, such as ["framework"]. They replace the type's default skills; a sensitive project keeps framework-sensitive-data.

blueprint str | None None

A Framework Cloud blueprint handle, such as "framework/project" or "ada/lab". With blueprint or structure, the choices are resolved by the cloud (you must be logged in with cloud_login()), the project is built from the layers it returns, and then it is registered there and gets a project token in .env. Cannot be combined with type.

structure str | None None

A Framework Cloud structure handle, such as "framework/course". It replaces the blueprint's structure.

skills Sequence[str] ()

Skill handles to add on Framework Cloud. Needs blueprint or structure.

sensitive bool | None None

Turn the sensitive-data setting on or off. Needs blueprint or structure; offline, use type="project_sensitive".

ai bool | Mapping[str, Any] | None None

Turn AI assistants on or off, or a map such as {"enabled": True, "assistants": {"claude": True}}. Needs blueprint or structure.

git bool | None None

Turn git on or off. Needs blueprint or structure.

key str | None None

A Framework Cloud project token. The project's definition (its layers) is fetched from the cloud, and the token is saved in the new project's .env for publishing and the ledger.

interactive bool | None None

Whether to prompt. Default: whether stdin is a terminal.

offline bool False

Build from Framework's built-in defaults without contacting Framework Cloud. When you are logged in and pass no choices, new() resolves your defaults on the cloud and caches them. If the cloud can't be reached, it builds from that cache and says so. With no cache it asks first, or, when not interactive, stops unless offline is True. It never falls back silently.

Value

The project folder.