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

change: Better CLI with --help and --version #116

Open
mathysgrapotte opened this issue Feb 19, 2025 · 0 comments
Open

change: Better CLI with --help and --version #116

mathysgrapotte opened this issue Feb 19, 2025 · 0 comments
Assignees

Comments

@mathysgrapotte
Copy link
Owner

Is your change request related to a problem? Please describe.

current CLI is not modular, we should create a main cli using click.

Describe the solution you'd like

something like this :

import click
from importlib.metadata import version

@click.group(context_settings={"help_option_names": ["-h", "--help"]})
@click.version_option(version("stimulus-py"), "-V", "--version")
def app():
    """Stimulus command line interface"""
    pass

# Import and register subcommands
from .shuffle_csv import shuffle_csv
from .transform_csv import transform_csv
from .split_csv import split_csv
from .check_model import check_model
from .tuning import tuning
from .split_split import split_split
from .split_transforms import split_transforms

app.add_command(shuffle_csv, name="shuffle-csv")
app.add_command(transform_csv, name="transform-csv")
app.add_command(split_csv, name="split-csv")
app.add_command(check_model, name="check-model")
app.add_command(tuning, name="tuning")
app.add_command(split_split, name="split-split")
app.add_command(split_transforms, name="split-transforms")

and then we could update existing cli modules to use click commands instead of standalone scripts, i.e. :

import click

@click.command()
@click.argument("input-file")
@click.option("--output", "-o", required=True)
def shuffle_csv(input_file, output):
    """Shuffle CSV file contents"""
    # ... existing implementation ...
@mathysgrapotte mathysgrapotte changed the title change: change: Better CLI with --help and --version Feb 19, 2025
@mathysgrapotte mathysgrapotte moved this to Todo - mid issues in Stimulus v1.0 Feb 19, 2025
@mathysgrapotte mathysgrapotte moved this from Todo to In Progress in Stimulus v1.0 Feb 21, 2025
@mathysgrapotte mathysgrapotte self-assigned this Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

1 participant