bibliotekar.Shelf#

class bibliotekar.Shelf(path)[source]#

A code shelf.

__init__(path)[source]#

Initialize from any path within the shelf.

Methods

__init__(path)

Initialize from any path within the shelf.

latest_commit_of(path)

Get the latest commit of a file in this shelf.

notebook_templates()

Find all notebook templates in this shelf.

notebooks()

Find all notebooks in this shelf.

scripts()

Find all scripts in this shelf.

submissions()

Find all code submissions in this shelf.

Attributes

name

The name of this shelf.

notebooks_dir

Path to the notebooks directory in this shelf.

repo

The git repository of this shelf.

root

The root directory of this shelf.

scripts_dir

Path to the scripts directory in this shelf.

templates_dir

Path to the templates directory in this shelf.

url

The URL of this shelf.

latest_commit_of(path)[source]#

Get the latest commit of a file in this shelf.

Return type:

Commit | None

property name: str#

The name of this shelf.

Typically, the instrument name in lowercase.

notebook_templates()[source]#

Find all notebook templates in this shelf.

This function yields all Jupyter notebook template submissions in self. Only templates in the {root}/templates folder and its subfolders are yielded.

Yields:

Paths to all notebook templates that were found.

Return type:

Iterable[Path]

notebooks()[source]#

Find all notebooks in this shelf.

This function yields all Jupyter notebook submissions in self. Only notebooks in the {root}/notebooks folder and its subfolders are yielded.

Yields:

Paths to all notebooks that were found.

Return type:

Iterable[Path]

property notebooks_dir: Path#

Path to the notebooks directory in this shelf.

property repo: Repo#

The git repository of this shelf.

property root: Path#

The root directory of this shelf.

scripts()[source]#

Find all scripts in this shelf.

This function yields all Python scripts submissions in self. Only scripts in the {root}/scripts folder and its subfolders are yielded.

Yields:

Paths to all scripts that were found.

Return type:

Iterable[Path]

property scripts_dir: Path#

Path to the scripts directory in this shelf.

submissions()[source]#

Find all code submissions in this shelf.

This function yields all

  • Jupyter notebooks,

  • Jupyter notebook templates,

  • Python scripts.

Only files in the respective submission folders and their subfolders are yielded.

Yields:

Paths to all files that were found.

See also

fShelf.notebooks

Find only Jupyter notebooks.

Shelf.notebook_templates

Find only Jupyter notebook templates.

Shelf.scripts

Find only Python scripts.

Return type:

Iterable[Path]

property templates_dir: Path#

Path to the templates directory in this shelf.

property url: str#

The URL of this shelf.