Skip to content
Framework

Project management

new_project()

Create a new Python project with your defaults.

Usage

new_project(
    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,
    url: 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. ~ is expanded and a relative path is taken from the current directory. With no location, an interactive session shows <current directory>/<project-name> and asks Create the project here (<path>)? [y/n]. With a Projects folder set in Framework Cloud Settings, it offers <Projects folder>/<project-name> instead and asks Create the project in <path>? [y/n], creating the Projects folder if needed. Answering n asks for the folder to put the project in; leaving it blank uses the current directory. A non-interactive session raises an error asking for location.

type str | None None

project, project_sensitive, course, presentation, or bare. App types "shiny" (Shiny for Python; "shiny_python" is the same) and "fastapi" are Framework Cloud blueprints: type="fastapi" is blueprint="framework/fastapi", and needs cloud_login(). "plumber" is R only. 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 project, the Standard Project, otherwise, as in R's new(). Pass type="bare" for a bare project.

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.

url str | None None

With key: the Framework Cloud server that issued the token. No login is needed. The server is saved as FW_CLOUD_URL in the project's .env. Default: FW_CLOUD_URL, then the server you last logged in to with cloud_login(). With neither, new() raises NoServerError rather than assume https://framework.pub.

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 cannot 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.

Search guides and reference for R, Python, Stata, the CLI, and Framework Cloud.