losalamos.project#

Project management and filesystem initialization utilities.

This module provides high-level helpers and abstractions for creating, loading, and managing projects organized around a predefined filesystem structure. It defines the core Project class and convenience functions for initializing new projects or restoring existing ones from disk.

The module is designed to evolve as a central coordination layer between project metadata, filesystem layout, and downstream processing workflows.

Functions

load_project(project_folder)

Loads a Project from folder

new_project(specs)

Create a new Project from a specification dictionary.

Classes

Project([name, alias])

Project filesystem abstraction.

losalamos.project.new_project(specs)[source]#

Create a new Project from a specification dictionary.

Danger

This method overwrites all existing default files.

Parameters:

specs (dict) –

Dictionary containing project specifications.

Required keys:

  • folder_base (str): Path where the project folder will be created.

  • name (str): Name of the project.

Optional keys:

  • alias (str): Alternative identifier. Defaults to None.

  • source (str): Source reference. Defaults to empty string.

  • description (str): Project description. Defaults to empty string.

Raises:

ValueError – If any required key is missing.

Returns:

A new :class:`losalamos.Project instance initialized with the given specifications.

Return type:

losalamos.Project

Script example
import losalamos

# [CHANGE THIS] setup specs dictionary
project_specs = {
    "folder_base": "C:/to/losalamos", # change this path
    "name": "newProject",
    "alias": "NPrj",
    "source": "Me",
    "description": "Just a test"
}

pj = losalamos.new_project(specs=project_specs)
losalamos.project.load_project(project_folder)[source]#

Loads a Project from folder

Parameters:

project_folder (str or Path) – path to project root folder

Returns:

A new :class:`losalamos.Project instance.

Return type:

losalamos.Project

Script example

Load an existing losalamos.Project

# import the package
import losalamos

# get project instance
pj = losalamos.load_project(project_folder="path/to/project/folder")
class losalamos.project.Project(name='LosAlamosProject', alias='LAProj')[source]#

Bases: FileSys

Project filesystem abstraction.

This class represents a project rooted in a filesystem structure and extends losalamos.root.FileSys. It initializes and manages project metadata and default folder definitions.

load_data()[source]#

Initialize internal project data.

Creates a dataframe describing the default project folder structure based on SUBFOLDERS and assigns it to self.data.

publish(targets, prefix, output_folder=None, surface=False)[source]#

Publish a versioned snapshot of selected directories to a managed output location.

Parameters:
  • targets (list) – A list of directory paths to be included in the snapshot.

  • prefix (str) – The string prefix used for naming the generated archive file.

  • output_folder (pathlib.Path) – [optional] The destination directory for the published archives.

  • surface (bool) – If True, target folders are placed at the zip root instead of preserving project subfolder structure.

Returns:

A dictionary containing the publication status, the resulting path, and metadata.

Return type:

dict

Note

The function performs directory validation, checks for publish frequency constraints based on self.publish_delta, and handles the rotation of the previous ‘latest’ archive into a history folder before promoting the new build.