Skip to main content

layer.init

init()

  • Parameters

    • project_name (str) -- Name of the project to be initialized.
    • fabric (Optional[str**]) -- Default fabric to use for current project when running code in Layer's backend.
    • pip_packages (Optional[List[str]]) -- List of packages to install in Layer backend when running code for this project.
    • pip_requirements_file (Optional[str**]) -- File name with list of packages to install in Layer backend when running code for this project.
  • Returns

    Project object.

Initializes a project with given name both locally and remotely.

If the project does not exist in the Layer backend, then it will be automatically created. Additional settings can be passed in as parameters: namely fabric and packages to install. These settings are only applied to runs initiated from the current local environment.

Other users can set different settings for the same project in their own local environments via layer.init, and those will not impact your runs.

Note that only one of pip_packages or pip_requirements_file should be provided.

# Initialize new project and create it in Layer backend if it does not exist
project = layer.init("my_project_name", fabric="x-small")