Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CLI entrypoint #4

Merged
merged 4 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 20 additions & 70 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ classifiers = [

dependencies = [
"dbt-core>=1.5",
"click>=7.1.1, <9.0.0",
]
requires-python = ">=3.10"
readme = "README.md"
Expand Down Expand Up @@ -47,6 +48,9 @@ docs = [
[tool.pdm.version]
source = "scm"

[tool.pdm.scripts]
dbt-score = {call = "dbt_score.cli:cli"}

### Mypy ###

[tool.mypy]
Expand All @@ -71,6 +75,7 @@ extend-select = [
"PL", # pylint
"Q", # flake8-quotes
"RUF", # ruff
"D", # pycodestyle
"E", # pycodestyle errors
"W", # pycodestyle warnings
]
Expand Down
9 changes: 9 additions & 0 deletions src/dbt_score/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Entry point of the dbt_score.

This enables module to be run directly.
"""

from dbt_score.cli import cli

if __name__ == "__main__":
cli()
34 changes: 34 additions & 0 deletions src/dbt_score/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""CLI interface."""

from typing import Final

import click
from dbt.cli.options import MultiOption

BANNER: Final[str] = r"""
__ __ __
____/ // /_ / /_ _____ _____ ____ _____ ___
/ __ // __ \ / __/______ / ___// ___// __ \ / ___// _ \
/ /_/ // /_/ // /_ /_____/(__ )/ /__ / /_/ // / / __/
\__,_//_.___/ \__/ /____/ \___/ \____//_/ \___/
"""


@click.version_option(message="%(version)s")
@click.group(help=f"\b{BANNER}", invoke_without_command=False)
def cli() -> None:
"""CLI entrypoint."""
druzhinin-kirill marked this conversation as resolved.
Show resolved Hide resolved


@cli.command()
@click.option(
"--select",
"-s",
help="Specify the nodes to include.",
cls=MultiOption,
type=tuple,
multiple=True,
)
def lint(select: tuple[str]) -> None:
"""Lint dbt models metadata."""
raise NotImplementedError()