Skip to content
Framework

Publishing

structure()

The project's folder tree, to read before publishing it. Nothing is uploaded.

::

fw.structure()
fw.structure("analysis", depth=2, notes={"models": "One script per model"})

Usage

structure(
    path: str | Path | Sequence[str | Path] | None = None,
    *,
    depth: int | None = None,
    exclude: str | Sequence[str] | None = None,
    notes: Mapping[str, str] | None = None,
    open: str | Sequence[str] | None = None,
    highlight: str | Sequence[str] | None = None,
    ignored: str = 'rules',
) -> Structure

Arguments

Name Type Default Description
path str | Path | Sequence[str | Path] | None None

A folder, or a list of folders, relative to the project root. Default: the project root. Outside a Framework project, the root is the current folder.

depth int | None None

Levels to list. Folders below it show as stubs with a file count. Default: no limit.

exclude str | Sequence[str] | None None

Globs, as .gitignore writes them, for paths to leave out entirely.

notes Mapping[str, str] | None None

Notes by path, such as {"R/": "Reusable functions"}.

open str | Sequence[str] | None None

Folders that start open in an embed.

highlight str | Sequence[str] | None None

Paths drawn as highlighted in an embed.

ignored str 'rules'

"rules" shows ignored paths with their rules; "hide" leaves them out.

Value

A Structure. Printing it shows the tree. Its published is the tree as publish_structure() publishes it, and document the JSON it uploads.

Details

The tree lists ignored files by name with the rule that ignores them, up to 20 per folder and rule, so it shows what the .gitignore does. Ignored and private folders show as stubs with a file count, as they publish. publish_structure() takes the same arguments and publishes the tree without the ignored names.

Raises

  • FrameworkError: An argument is not valid, or notes, open, or highlight names a path that is not in the tree.

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