Skip to main content

@project

The @project decorator makes it convenient to create isolated Metaflow namespaces and corresponding proudction deployments. When multiple flows use the same project name, they can fetch data across them safely using the Client API, without interference from other users running the same flows.

By itself, @project doesn't change the behavior besides exposing new attributes in the current object. It alters the flow names when they are deployed in production, allowing multiple parallel deployments.

For more information, see Coordinating Larger Metaflow Projects.

@project(...)

[source]

from metaflow import project

Specifies what flows belong to the same project.

A project-specific namespace is created for all flows that use the same @project(name).

Parameters 

name: str

Project name. Make sure that the name is unique amongst all projects that use the same production scheduler. The name may contain only lowercase alphanumeric characters and underscores.

branch: Optional[str], default None

The branch to use. If not specified, the branch is set to user.<username> unless production is set to True. This can also be set on the command line using --branch as a top-level option. It is an error to specify branch in the decorator and on the command line.

production: bool, default False

Whether or not the branch is the production branch. This can also be set on the command line using --production as a top-level option. It is an error to specify production in the decorator and on the command line. The project branch name will be:

  • if branch is specified:
    • if production is True: prod.<branch>
    • if production is False: test.<branch>
  • if branch is not specified:
    • if production is True: prod
    • if production is False: user.<username>