project_init
tit.project_init ¶
Project initialization helpers for TI-Toolbox.
Provides utilities for detecting new projects, scaffolding BIDS-compliant
directory structures, and reading/writing project_status.json. The example
data is :func:tit.examples.fetch.
initialize_project_structure ¶
initialize_project_structure(project_dir: Path) -> None
Scaffold a full BIDS-compliant directory structure for project_dir.
Idempotent, and honest about it: the "New project detected" banner and the per-item
✓ … created lines are printed only for work this call actually did. An established
project -- one :func:has_project_data_or_markers recognises -- gets a single
Project structure verified line, because that is all that happened. (Before
2026-09-15 the banner and every ✓ printed unconditionally, so asking an established
project for anything that re-ran this looked like it was being re-initialised.)
Parameters¶
project_dir : Path Root directory of the project.
Source code in tit/project_init/initializer.py
is_new_project ¶
Return True if project_dir exists and contains no project data.
Parameters¶
project_dir : Path Root directory of the project.
Returns¶
bool
True when the directory is empty of project data and markers.
Source code in tit/project_init/initializer.py
load_project_status ¶
Read project_status.json and return its contents.
Returns an empty dict when the file is missing or unreadable. This function never writes to disk.
Parameters¶
project_dir : Path Root directory of the project.
Source code in tit/project_init/initializer.py
update_project_status ¶
Merge updates into project_status.json and write back.
Performs a recursive (deep) merge so that nested keys such as
user_preferences.show_welcome can be updated without clobbering
sibling keys. Automatically sets last_updated.
If the file does not yet exist a warning is logged and the function
returns False — the file should have been created by
:func:initialize_project_status.
Parameters¶
project_dir : Path Root directory of the project. updates : dict Fields to merge into the existing status.
Returns¶
bool
True on success.