Skip to content

Commit

Permalink
Merge pull request #226 from Renumics/fix/cant-set-folder-through-cli
Browse files Browse the repository at this point in the history
fix: correctly handle dataset=None from cli
  • Loading branch information
neindochoh authored Sep 14, 2023
2 parents 163917e + b44d4e3 commit d387798
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions renumics/spotlight/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import signal
import sys
from typing import Dict, Optional, Tuple, Union, List
from pathlib import Path

import click

Expand Down Expand Up @@ -41,13 +40,11 @@ def cli_dtype_callback(
@click.command() # type: ignore
@click.argument(
"dataset",
type=str,
required=False,
default=os.environ.get("SPOTLIGHT_TABLE_FILE", str(Path.cwd())),
default=os.environ.get("SPOTLIGHT_TABLE_FILE"),
)
@click.option(
"--folder",
type=str,
help="Root folder for filebrowser and file lookup.",
required=False,
)
Expand All @@ -61,7 +58,6 @@ def cli_dtype_callback(
@click.option(
"--port",
"-p",
type=str,
default="auto",
help="The port that Spotlight should listen on (use 'auto' to use a random free port)",
show_default=True,
Expand Down Expand Up @@ -99,12 +95,13 @@ def cli_dtype_callback(
@click.option(
"--analyze",
default=[],
multiple=True,
help="Automatically analyze issues for all columns.",
)
@click.option("-v", "--verbose", is_flag=True)
@click.version_option(spotlight.__version__)
def main(
dataset: str,
dataset: Optional[str],
folder: Optional[str],
host: str,
port: Union[int, str],
Expand Down
2 changes: 1 addition & 1 deletion renumics/spotlight/viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def show(
project_root = dataset
else:
project_root = dataset.parent
elif isinstance(dataset, pd.DataFrame):
elif isinstance(dataset, pd.DataFrame) or dataset is None:
project_root = None
else:
raise TypeError("Dataset has invalid type")
Expand Down

0 comments on commit d387798

Please sign in to comment.