NotebookFinder#

class mobu.services.notebook_finder.NotebookFinder(*, repo_path, repo_config, exclude_dirs=None, collection_rules=None, available_services=None, logger)#

Bases: object

A helper to select which notebooks to execute based on config.

This config can come from many places, like flock config, or an in-repo config file.

Parameters:
  • repo_path (Path) – The local path on disk of a cloned repository of notebooks

  • repo_config (RepoConfig) – Config from a config file in the notebook repo

  • exclude_dirs (set[Path] | None, default: None) – DEPRECATED: A set of paths relative to the repo root in which any descendant notebooks will not be executed

  • collection_rules (list[CollectionRule] | None, default: None) – A set of rules describing which notebooks in a repo to run

  • available_services (set[str] | None, default: None) – A list of Phalanx services that are available in the environment

  • logger (BoundLogger) – A structlog logger

Methods Summary

find()

Return a list of notebooks to execute.

Methods Documentation

find()#

Return a list of notebooks to execute. :rtype: set[Path]

  • Start with all notebooks in the repo.

  • For each collection rule, remove notebooks:

    • Intersect rules will remove notebooks that are not in the intersection of:

      • The current set

      • The union of the matched patterns.

    • Exclude rules will remove notebooks from the current set that are in the union of the matched patterns.

  • Remove any remaining notebooks that require unavailable services.