Saravanan666/pypi-org huggingface dataset:
Package: argsy
argsyTiny wrapper for Python'sargparsepackage with YAML-based cli configuration.OverviewTheargsypackage aims to make CLI argument configuration and parsing declarative and simple, while still leveraging Python'sargparsepackage to handle the parsing details and user help messaging.Configuration supports declarative configuration of:top-level position args, options / flagsa single tier of subcommandsposition args, options / flags for each subcommandsupport for setting default values for options / flagspartialnvarssupport for capturing multiple input valuessupport for theactiondirective (for things like toggling booleans)Getting StartedInstallargsypipinstallargsy>=1.0.0Define your program structureCLI arguments are define as either:a YAML file or string, ora PythondictobjectYAML file## my_cli_args.yml#program:name:my_programdescripton:"Aboutwhatmy_programdoes."args:option1:cmd_type:optionflags:'-o|--option1'help:"Shorttextabouttheoption."required:true## my_program.py#fromargsyimportArgsyargsy_parser=Argsy(config_file_name="my_cli_args.yml")parsed_args=argsy_parser.parse_args(sys.argv[1:])# User runs:#     my_program -o USER_PROVIDED_OPTION_VALUE## Resulting 'parsed_args':# {#   'cmd': None,#   'args': {#     'option1': USER_PROVIDED_OPTION_VALUE#   }# }YAML String## my_program.py#fromargsyimportArgsyCLI_ARGS="""program:name: my_programdescripton: "About what my_program does."args:option1:cmd_type: optionflags: '-o|--option1'help: "Short text about the option."required: true"""argsy_parser=Argsy(config_str=CLI_ARGS)parsed_args=argsy_parser.parse_args(sys.argv[1:])# User runs:#     my_program -o USER_PROVIDED_OPTION_VALUE## Resulting 'parsed_args':# {#   'cmd': None,#   'args': {#     'option1': USER_PROVIDED_OPTION_VALUE#   }# }Python Dictionary## my_program.py#fromargsyimportArgsyCLI_ARGS=dict(program=dict(name='my_program',description='About what my_program does.',args=dict(option1=dict(cmd_type='option',flags='-o|--option1',help='Short text about the option.',required=True))))argsy_parser=Argsy(config_dict=CLI_ARGS)parsed_args=argsy_parser.parse_args(sys.argv[1:])# User runs:#     my_program -o USER_PROVIDED_OPTION_VALUE## Resulting 'parsed_args':# {#   'cmd': None,#   'args': {#     'option1': USER_PROVIDED_OPTION_VALUE#   }# }
Package: argtoml
READMETheargtomlpackage wraps aroundargparse.
It adds the content of a toml file to the cli options.
After parsing, it creates atypes.SimpleNameSpaceobject.installArgtoml has no mandatory dependencies outside of pythons standard library.pipinstallargtomlYou can optionally installtomli_wif you want to save your configuration at runtime.pipinstall'argtoml[save]'usageIf there's asrc/config.tomldebug=truehome="~"[project]author="Jono"name="argconfig"pyproject="./pyproject.toml"and asrc/__main__.pyfromargtomlimportparse_args# , ArgumentParserargs=parse_args(path=True)print(args.debug)print(args.home)print(args.project.author)print(args.project.name)print(args.project.pyproject)then the shell can look like$pwd/home/jono/project
$pythonsrc/__main__.py--project.nameargtoml--no-debug
False
/home/jono
Jono
argtoml
/home/jono/project/pyproject.tomldocumentationThere is none, the code is not that large, but I expect you to only use:parse_args(# An argparse parser for adding extra arguments not present in the toml.parser:Optional[argparse.ArumentParser]=None,# An extra help message.description:str="",# The location of the toml file.toml_path:pathlib.Path=Path("config.toml"),# The dictionary in which to look for the toml file.toml_dir:Optional[TPath]=None,# Whether to try to interpret strings as paths.base_path:Union[Path,bool]=True,# Whether to look for the toml file in the parent of the toml_dir folder.grandparent:bool=True)->SimpleNamespacesave(args:Union[SimpleNamespace,dict],path:pathlib.Path):withopen(path,"wb")asf:tomli_w.dump(args,f)toml file locationYou are encouraged to specify the location of the toml file when callingparse_argswith an absolute path like this:parse_args(toml_path="/home/user/dir/my_config.toml")If you provide a relative path,argtomlwill look formy_config.tomlin the package directory if the main file usingargtomlis from a package, otherwiseargtomlwill look formy_config.tomlin the same directory as the main file.
This automatic toml-finding function might change in the future, so probably just provide absolute paths.packagingIf you want to ship a toml file with your package, make sure toadd the toml file to your package.
You should also callparse_argswith a relativetoml_path.notesThis is a personal tool thus far, some idiosyncrasies remain:Adding dotted arguments not present in the toml might break everything I didn't even test this.I don't feel like adding other formats but toml.I don't know if, in the above example, the user can do something likepython __main__.py --project {author="jo3"} --project.author jjj, but it should crash if they do this.Interpreting strings as pathsprobablyonly works with unix style paths.todosAdd toml comments as argument descriptions.Pretty-print the output of parse_args.Load and merge multiple toml files
Package: argtools
ArgtoolsDescriptionA collection of decorators wrapping argparse module for building command-line tools withminimal effort.Quick startInstallation$pipinstallargtoolsBuilding a simple command-line tool# examples/test.pyfromargtoolsimportcommand,argument@command@argument('foo',help='a positional arugment')@argument('--bar',default=3,help='an optional argument')defmain(args):""" One line description hereWrite details here (printed with --help|-h)"""printargs.barprintargs.fooreturn1# return codeif__name__=='__main__':command.run()$pythontest.py
$pythontest.py-v# Increasing the verbosity of logging moduleTheargumentdecorator has the same api as argparse.ArgumentParser.add_argument.
Seehttp://docs.python.org/dev/library/argparse.htmlfor details.Building subcommands# examples/subtest.pyfromargtoolsimportcommand,argument@command.add_subdeffoo(args):""" This is foo"""print'foo'@command.add_subdefbar(args):""" This is bar"""print'bar'@command.add_sub(name=baz)# set different namedefbar(args):""" This is baz"""print'baz'if__name__=='__main__':command.run()$pythontest.pyfoo# print foo$pythontest.pybar# print bar$pythontest.pybar-h# print help text of bar subcommandOther featuresIncommand.run(), the logging module is setup. You can control the verbosity with options: -v, -vv, ..Incommand.run(), SIGPIPE occured inside of wrapped function will be ignored to ease piping.To usegrouporexclusivefunctionality of argparse, giveargumentobjects (e.g. arg1, arg2, arg3) as@argument.group(arg1, arg2, arg3)or@argument.exclusive(arg1, arg2, arg3), respectively (documentation is #TODO).Builtin options: -v, --verbose and --debug can be turned off by settingcommand.add_verbose = Falseorcommand.add_debug = False
Package: argtyp
# argtyp.py[![PyPI version](https://badge.fury.io/py/argtyp.svg)](https://badge.fury.io/py/argtyp)
[![Build Status](https://travis-ci.org/raviqqe/argtyp.py.svg?branch=master)](https://travis-ci.org/raviqqe/argtyp.py)
[![License](https://img.shields.io/badge/license-unlicense-lightgray.svg)](https://unlicense.org)Argument type collection for argparse## License[The Unlicense](https://unlicense.org)
Package: argtyper
ArgTyper-- ArgumentParser on Typehints and DecoratorsArgTyper let's you build command line applications from python functions.
It is similar toTyper(which has more
features), Contrary to Typer, which is based onclick,
ArgTyper is based on standard argparse.ArgumentParser (for better or for
worse).You can find the documentation athttps://argtyper.readthedocs.io/
Package: arguable
Arguable“arguable” stands for “argparse configurable”. This project enables class-level configuration via argparse and the command line interface.Installationpip install arguableUsageClasses inheriting fromarguable.Arguabledefine a class-levelargparse.Namespaceobjectconfigwhich holds relevant
parameters and their defaults. The corresponding argument parser is
created automatically from these parameters and is stored as theconfig_parserclass attribute.For example:fromargparseimportNamespacefromarguableimportArguableclassExample(Arguable):config=Namespace(language='en')print(Example().config.language)When the class is created, theExample.config_parserattribute holds
an argument parser with an argument--example-languagewithtype=stranddefault='en'.When the class is instantiated it automatically configures its instances
by assigning an instance-level attributeconfigwhich picks up the
provided command line arguments and shadows the class-levelconfigdefaults.So invoking the above script viapython example.py--example-language=deprintsdewhile omitting the parameter uses the defaulten.Parameter typesOther supported parameter types are sequences (e.g. tuples) which will
use the following argument definition:# `par` is the tuple parameter default.parser.add_argument(name,type=type(par[0]),nargs=len(par),default=par)bool:# `par` is the bool parameter default.parser.add_argument(name,action=f'store_{"false"ifparelse"true"}')and of course all the numeric types.CustomizationBy default the class name in lowercase will be used as a prefix for
parameter names. This can be configured by two class variables:config_prefix– If provided then this is used directly as the prefix.config_removesuffix– Ifconfig_prefixis not provided,
the class name in lowercase is used and reduced by this suffix
(if provided).These variables can also be provided during class creation without
theconfig_prefix, e.g.:classExampleA(Arguable,prefix='test'):config_prefix='text'# similarclassExampleB(Arguable,removesuffix='b'):config_removesuffix='b'# similarShowing the full help textIn order to make the application aware of all registered parameters,
theArguableclass has asuper_parserattribute which is an
instance ofargparse.ArgumentParser. Whenever a class registers
new parameters, not only the class-level parserconfig_parsergets
updated, but also the application-levelsuper_parser. This parser
can be used to show the help text involving all parameters.This package provides a helper parser class,arguable.ArgumentParser,
which automatically falls back onsuper_parserwhen--helpis requested.Thissuper_parsercan also be used used to verify the correctness of
all given parameters. Since every class is only concerned with their own
parameters, excess arguments are simply ignored (usingparse_known_args).
Using thesuper_parserone can verify that all provided arguments
are supported by the application:fromarguableimportArguableif__name__=='__main__':# The following will report any excess arguments.Arguable.super_parser.parse_args()
Package: arguelay
arguelayAdd a short description here!A longer description of your project goes here…Making Changes & ContributingThis project usespre-commit, please make sure to install it before making any
changes:pip install pre-commit
cd arguelay
pre-commit installIt is a good idea to update the hooks to the latest version:pre-commit autoupdateDon’t forget to tell your contributors to also install and use pre-commit.NoteThis project has been set up using PyScaffold 4.3.1. For details and usage
information on PyScaffold seehttps://pyscaffold.org/.
Package: argueview
ArgueView is a tool for generating text-based presentations for machine-learning predictions and feature-importance based explanation tools. The tool makes use of Toulmin's model of argumentation for structuring the text-based explanations.Example output using the visualizer:The procedure for creating ArgueView explanations is as follows:A traditional machine-learning context is created (i.e. data, model)An explainer is employed to producefeature importance. This can be a white-box or black-box explainer. An example of a black-box explainer isLIME.The machine-learning context and thefeature importanceare given to ArgueView such that it can produce a textual explanation.InstallationArgueView is available as a python package onPyPi. You can install it usingpip:pip install argueviewOr, usingpipenv:pipenv install argueviewUsageUsage is documented in our examples. Examples are available in python and jupyter notebooks. The following examples are available:minimal, hypothetical data and explainer:pythoncreditg data withLIMEexplainer:python,notebookcreditg data withshapexplainer:python,notebookRunning the examplesThere are two examples available to help you learn how to use ArgueView. The 'plain' examples uses hypothetical data to show a minimalistic use-case. The CreditG example uses real data and a real ML model to illustrate a real-world use case.If you would like to run the CreditG example the script needs to obtain the data. For this we useOpenML. However, usage requires a valid API key and you will need to obtain one to run the example.After you have obtained your key, create a.envfile with yourOpenMLAPI key.echo "OML_APIKEY={my-key}" > .envNote: You can skip this step if you want to run the hypothetical example.Install all dependencies:pipenv install --devRun an example:/path/to/python3 ./examples/{example}/example.pyAdditionally, there is are Jupyther Notebooks available to directly see how ArgueView works.BuildingFollow these steps to build ArgueView from source.make sure you install the dependencies. ArgueView requires the following dependencies:python>=3.5,pip3,pipenv,git.build using makemakeUsing DockerAlternatively you can build ArgueView using docker.build context dockerfiledocker build -t argueview/context:local .runbuild.shin a containerCID=$(docker run 
    -v /var/run/docker.sock:/var/run/docker.sock
    argueview/context
    build.sh)copy results from the containerdocker cp ${CID}:/argueview/argueview.egg-info ./argueview.egg-info
docker cp ${CID}:/argueview/build ./build
docker cp ${CID}:/argueview/dist ./dist
Package: argufy
python-argufyOverviewInspection based parser built on argparse. Build complex CLI interfaces bywriting more code-complete applications.MotivationArgufy is designed to be an alternative to decorator based parsers such asClick. Decorators have limitations that prevent effective use of inspectionwithout drawbacks. This parser easilly allows a CLI to be created with minimaleffort while enabling inspection.Installpip install argufyCreate a parserfrom argufy import Parser
from . import cli

def main():
    '''Do main function for CLI.'''
    parser = Parser()
    parser.add_commands(cli)
    parser.dispatch()

if __name__ == '__main__':
    main()Create the command line subcommands and arguments.'''Example module named CLI.'''

def _ignored():
    '''This function is ignored.'''
    pass

def example(argument: bool = False):
    '''Provide an example command.

    Parameters
    ----------
    argument: bool, optional
        Provide an example argument.

    '''
    if argument:
        print('This is a true argument')
    else:
        print('This is a false argument')Example help message.$ command --help
usage: command [-h] {example} ...

positional arguments:
  {example}
    example             Provide an example command.

optional arguments:
  -h, --help            show this help message and exitExample command help message.$ command example --help
usage: command [-h] [--argument ARGUMENT]

optional arguments:
  -h, --help           show this help message and exit
  --argument ARGUMENT  Provide an example argument.
Package: arguing
ArguingArguing is a Lightweight and simpleArgument parsinglibrary that gives you all the control, no third party libraries.InstallationYou can use PIP to install the library.pipinstallarguingUseAfter installing the library, here's a brief tutorial.importarguingargument=arguing.set('--argument',# Argument name.type=str,# Type of the argument, by default string.default='default_value',# If the user don't pass the flag or it doesn't have a value, it will be automatically setted to this.help='Help.'# Help message# You can also add required arguments witht the "required" parameter (Bool)!)# Also, you can define a variable to the function and it will return the argument value.arguing.get('--argument')# arguing.get() returns the parameters value# It will return it converted to the selected type on arguing.set() if used# If arguing.get() can't get the parameters value, it will return the default on arguing.set() or None.# In case you wan't to check if the user passed an specific argument you can use:arguing.check('--argument')# Checks if argument is on ARGV and if it has a value, returns Bool.print(arguing.get('--argument'))print(argument)# Both are validWhat's new[Added] Now, you can receive input from pipes with the.pipe()function.[Fixed bug].check()would returnTrueeven if the flag does not have any value.[Fixed bug] When adding flag without a value, raisesIndexError. Should return it's default value or None.
Package: argument
Argument parsing for python developersUsage:importargumentf=argument.Arguments()#Requried arguments, first argument will be stored as "candy"f.require("candy",help="Candy name")#optional unnamed valuef.maybe("soda")#optional value, set a default, can be changed by adding: --num=30, or -n=30f.option("num",25,help="How many pieces?",abbr="n")#add a switch, a flag with no argumentf.switch("reverse",help="Reverse ordering",abbr="r")f.switch("unwrap",help="unwrapcandy",abbr="u")#Process data before saving itf.process("candy",lambdax:x.upper())#Parse num as integerf.process("num",lambdax:int(x))f.validate("num",lambdax:x>10)#get dataarguments,errors=f.parse()Example:python tests/demo.py bubblegum{‘num’: 25, ‘soda’: None, ‘reverse’: False, ‘candy’: ‘BUBBLEGUM’,
‘unwrap’: False}python demo.py bubblegum cubacola{‘num’: 25, ‘soda’: ‘cubacola’, ‘reverse’: False, ‘candy’:
‘BUBBLEGUM’, ‘unwrap’: False}python tests/demo.py bubblegum -r -n=123 –unwrap{‘num’: 123, ‘soda’: None, ‘reverse’: True, ‘candy’: ‘BUBBLEGUM’,
‘unwrap’: True}python tests/demo.py bubblegum –n=5{‘num’: 5, ‘soda’: None, ‘reverse’: False, ‘candy’: ‘BUBBLEGUM’,
‘unwrap’: False}Autogenerated help:print(f) ``` Usage: demo.py [OPTIONS] CANDYRequired arguments: CANDY Candy nameOptional arguments: SODA N/AOptions: -n –num=25 How many pieces?Switches: -r –reverse Reverse ordering -u –unwrap unwrapcandy ```
Package: argument-checks
Arg CheckA Python utility for checking that call args have the expected types and all required args are provided.Works only with Python 3.7(fixing that soon)Installationpip install arg-checkUsageThis library uses simple decorators.Argument Type Checking@enforce_arg_typesdeffoobar(a:int,b:str):...Type checking is performed via the annotations. If an argument does not have an
annotation, type checking is skipped just for that argument.If an argument is a collection, all items in the collection are checked.Can handleUnionandOptionalRequired Arguments@required_args("a","b")deffoobar(a,b,c=None):...Tests the given arguments and raises aValueErrorif the value is eitherNoneor an empty stringTo make all arguments required, use@required_argswithout parenthesisAll checks in one decorator@strict_argsdeffoobar(a:int,b:str):...All arguments are type checkedAll arguments are required
Package: argument-clinic
Argument ClinicAh. I'd like to have an argument, please.The standard way of writing a command line tool in Python is rather
repetitive. You construct anArgumentParserobject with a doc
string add documented parameters with their type, call parse on
it and then call yourmain(...)with exactly the same parameters
and if you are a good citizen, you document the call stuff again.defmain(input_file:str,*,scale:float=125,fps:int=30):"""Create a movie based that has droste aspects."""passif__name__=='__main__':parser=argparse.ArgumentParser('Create a movie based that has droste aspects.')parser.add_argument('input_file',type=str)parser.add_argument('--scale',type=float,default=125)parser.add_argument('--fps',type=float,default=30)args=parser.parse_args()main(args.input,scale=args.scale,fps=args.fps)With argument-clinic you can do the same with just:@argument.entrypointdefmain(input_file:str,*,scale:float=125,fps:int=30):"""Create a movie based that has droste aspects."""passif__name__=='__main__':main()Installationpip install argument-clinicMore detailsAs shown above, the basic usage is to use the@argument.entrypointfor your main and have all command line arguments to your script be
arguments of yourmain(..)entry point. When you callmainthe values
for each argument will be supplied automatically.Separate positional arguments and keyword arguments in your
main with a*(which is good practice anyway). Anything after
the star becomes a flag that requires a value.The doc string of yourmainwill automatically become the help
for your script. If you document the parameters to yourmainin your
doc string, these comments will be added to the right parameters (any type
specification will be ignored though)The best thing: it doesn't cost you 5 pounds for 5 more minutes.
Package: argument-esa-model
Get the required resourcesscp -rwebis@webislab40.medien.uni-weimar.de:/home/weci2587/projects/args-topic-modeling/resources .To run the ESA-script with all terms run:For normal ESA:./esa-all-terms.py  --similarity cos
                    --matrix-path <path_to_resources>/resources/esa-plain/<debatepedia|strategic-intelligence|wikipedia>.mat
                    --model-path <path_to_resources>/resources/esa-w2v/GoogleNews-vectors-negative300.bin
                    --model-vocab <path_to_resources>/resources/esa-w2v/w2v-vocab.p
                    --input-path <path_to_input_file>
                    --output-path <path_to_output_file>For word2vec-ESA:./esa-all-terms.py  --similarity max
                    --matrix-path <path_to_resources>/resources/esa-w2v/<debatepedia|strategic-intelligence|wikipedia>.mat
                    --model-path <path_to_resources>/resources/esa-w2v/GoogleNews-vectors-negative300.bin
                    --model-vocab <path_to_resources>/resources/esa-w2v/w2v-vocab.p
                    --input-path <path_to_input_file>
                    --output-path <path_to_output_file>To run the word2vec-ESA with reduced terms run:./esa-top-n-terms.py    -n <number_of_terms> 
                        --corpus-path <path_to_resources>/resources/corpora/<debatepedia|strategic-intelligence|wikipedia>.csv
                        --model-path <path_to_resources>/resources/esa-w2v/GoogleNews-vectors-negative300.bin
                        --model-vocab <path_to_resources>/resources/esa-w2v/w2v-vocab.p
                        --input-path <path_to_input_file>
                        --output-path <path_to_output_file>The input document must be a csv file with "|" as the separator and must contain the column "document", which is used as the input text for the ESA.
Package: argumento
Project descriptionconfig-argsis a Python library for reading configuration from config files and command-line args.InstallationpipinstallargumentoUsageYou can define configuration parameters both in config files and in command-line arguments.Command-line args have higher priority: param values from command line overwrite values from config files.Supported config file formats are:yaml (.yaml, .yml)toml (.toml)json (.json)Basic exampleimportargumentocfg_filename='my_config.yaml'args=argumento.create_parser(cfg_filename).parse()my_config.yaml:login:"my_login"max_retries:5ports:[8000,8001,8002]ratio:0.5nice_bool_false:Falsenice_bool_true:Truecommand line:<command> --login my_login --max_retries 5 --ports: [ 8000, 8001, 8002 ] \
--ratio 0.5 --nice_bool_false False --nice_bool_true TrueBool argumentsNote thatboolargs should be set in command line via 'nice' but non-canonical way.Supported usage:--nice_bool_false False --nice_bool_true Trueor--nice_bool_false false --nice_bool_true trueNot supported usage:--feature/--no-featurestyle.Required params not defined in configIf a parameter is required but is not set in config file,?:followed by type name is used instead of a value:login:"?:str"max_retries:"?:int"ratio:"?:float"ports:"?:list[int]"fractions:"?:list[float]"Supported data types are:strintfloatlist[int]list[float]