Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pwwang/pipen-args
Command line argument parser for pipen
https://github.com/pwwang/pipen-args
Last synced: 14 days ago
JSON representation
Command line argument parser for pipen
- Host: GitHub
- URL: https://github.com/pwwang/pipen-args
- Owner: pwwang
- Created: 2020-11-04T17:50:06.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-11T06:30:25.000Z (5 months ago)
- Last Synced: 2024-12-13T03:51:30.772Z (21 days ago)
- Language: Python
- Size: 500 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pipen-args
Command line argument parser for [pipen][1]
## Usage
```python
from pipen import Proc, Pipenclass Process(Proc):
"""My processInput:
a: Input data
"""
input = 'a'
input_data = range(10)
script = 'echo {{in.a}}'Pipen().set_start(Process).run()
``````shell
$ python example.py --help
Usage: test.py [-h | -h+] [options]Undescribed process.
Use `@configfile` to load default values for the options.Pipeline Options:
--name NAME The name for the pipeline, will affect the default workdir and
outdir. [default: pipen-0]
--profile PROFILE The default profile from the configuration to run the pipeline.
This profile will be used unless a profile is specified in the
process or in the .run method of pipen. You can check the
available profiles by running `pipen profile`
--outdir OUTDIR The output directory of the pipeline [default: ./-output]
--forks FORKS How many jobs to run simultaneously by the scheduler
--scheduler SCHEDULER
The scheduler to run the jobsNamespace :
--in.a A [A ...] Input dataOptional Arguments:
-h, --help, -h+, --help+
show help message (with + to show more options) and exit
```See more examples in `tests/pipelines/` folder.
## Plugin options
- `args_hide`: (process level) Hide the arguments in the help message. Default: `False`
- `args_group`: (pipeline level) The group name for the arguments. Default: `pipeline options`
- `args_flatten`: (pipeline level) Flatten the arguments in the help message when there is only one process in the pipeline. Default: `auto` (flatten if single process, otherwise not)## Metadata for Proc envs items
The metadata in the docstring of env items determines how the arguments are defined.
```python
class Process(Proc):
"""My process# other docstring sections
Envs:
a (): ...
"""
```The metadata could be key-value pairs separated by `;`. The separator `:` or `=` is used to
separate the key and value. The value is optional. If the value is not specified, it
will be set to `True`. The keys are valid arguments of `argx.ArgumentParser.add_argument`, except that `hidden` will be interpreted as `show=False` in `argx.ArgumentParser.add_argument`. If the value of `choices` is not specified, the subkeys of the env item will be used as the choices.[1]: https://github.com/pwwang/pipen