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

Develop CLI #27

Merged
merged 5 commits into from
Jan 15, 2024
Merged

Develop CLI #27

merged 5 commits into from
Jan 15, 2024

Conversation

eivindtostesen
Copy link
Owner

@eivindtostesen eivindtostesen commented Jan 4, 2024

Goal:

Develop a Command Line Interface.

Wanted features:

  • A CLI for a python package (invoke using the -m flag)
  • A tool (do one thing and do it well)
  • CSV input and CSV output (to work in pipes with other CLI tools)
  • Use argparse (to parse arguments and options)
  • Options: help, version, valleys, circular, long, maxsize, delimiter

Solution:

  • New package called peakoscope
  • Renamed modules and classes: NumSlice -> Scope, SliceStr - > Region
  • From standard library: sys, argparse, csv
  • CSV input, but text output
  • implemented options: help, valleys, delimiter, field
  • Dropped option maxsize (it would be two tools)

Create cli.py that gets data from file or stdin and prints a tree of peak regions.
@eivindtostesen eivindtostesen linked an issue Jan 4, 2024 that may be closed by this pull request
Closed
In the CLI, add optional arguments: for help (-h, --help) and for targeting valleys instead of peaks (-v, --valleys).
In the CLI, add a csv reader with new options (delimiter and field) from the command line.
Create peakoscope package with new namespace: peakoscope/__init__.py. Rename cli.py -> peakoscope/__main__.py to get CLI when running package.
Move all modules (.py) to peakoscope/. Modify imports in all modules (.py) and notebooks (.ipynb).
Rename modules: peaky_data.py -> data.py, strings.py -> formats.py, peaks_in_matplotlib.py -> interface_matplotlib.py, peaks_in_polars.py -> interface_polars.py, peaks_in_pandas.py -> interface_pandas.py, peaks_and_valleys.py -> peaks.py.
Rename classes: NumSlice -> Scope, SliceStr -> Region.
@eivindtostesen eivindtostesen marked this pull request as ready for review January 15, 2024 08:52
@eivindtostesen eivindtostesen merged commit dc39dec into main Jan 15, 2024
@eivindtostesen eivindtostesen deleted the 26-dev-cli branch January 15, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI
1 participant