Skip to content

Commit

Permalink
docs: add docstrings to classes and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kreczko committed Oct 10, 2023
1 parent aa96412 commit 7023b1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"source_directory": "docs/",
"light_logo": "fast-flow-black.png",
"dark_logo": "fast-flow-white.png",
"announcement": "<em>THIS IS WORK IN PROGRESS</em>!",
"announcement": 'Interested in contributing? Head to the <a href="https://github.com/FAST-HEP/fasthep-flow">GitHub repository</a> and open a pull request!',
}
html_css_files = ["css/custom.css"]

Expand Down
4 changes: 4 additions & 0 deletions src/fasthep_flow/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@

@app.command()
def lint(config: Path) -> None:
"""Lint a config file. Throws errors if the config is invalid."""
typer.echo(f"Linting {config}")
load_config(config)
typer.echo("Looks good to me!")


@app.command()
def print_defaults() -> None:
"""Print the default config."""
typer.echo("Printing defaults...")


@app.command()
def execute(config: Path) -> None:
"""Execute a config file."""
typer.echo(f"Executing {config}...")


def main() -> None:
"""Entrypoint for the CLI."""
app()
5 changes: 5 additions & 0 deletions src/fasthep_flow/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

@dataclass
class StageConfig:
"""A stage in the workflow."""

name: str
type: str
needs: list[str]
Expand All @@ -18,10 +20,13 @@ class StageConfig:

@dataclass
class FlowConfig:
"""The workflow."""

stages: list[StageConfig]


def load_config(config_file: pathlib.Path) -> Any:
"""Load a config file and return the structured config."""
schema = OmegaConf.structured(FlowConfig)
conf = OmegaConf.load(config_file)
return OmegaConf.merge(schema, conf)

0 comments on commit 7023b1d

Please sign in to comment.