Saravanan666/pypi-org huggingface dataset:
Package: argparse-action
argparse_actionargparse_actionaims to be a minimalistic extension ofargparseand creates
cli options from the function signature given byinspect.signature.importargparseimportargparse_actionparser=argparse.ArgumentParser()action=argparse_action.Action(parser)@action.add("e")defecho(word,upper=False):print(word.upper()ifupperelseword)namespace=parser.parse_args()namespace.action(namespace)Asumes that the code above is saved asmy_script.py:$ python3 my_script.py echo hello
hello

$ python3 my_script.py e hello
hello

$ python3 my_script.py echo --upper hello
HELLOInstallationpip install argparse_actionConfigurationmake devCI checkThecheckmake target collects the targets which are run by the CI server.makecheckTestingThetesttarget requires a virtulenv whereargparse_actionis installed.
Thedevtarget creates that virtualenv under.venvdirectory.make testFormattingThe argparse_action project is formatted withblack. The CI check invokes thecheck-formattarget to ensure that the python files are formatted withblack.makecheck-formatblackcan be run with theformatmake target.makeformatLinterThelinttarget runspylintover the argparse_action project.makelintDocumentationDocumentation can be build with thedocmake target. To ensure the documentation build
tools themake devhas to be executed once beforemake doc.make docOnline version can be read atreadthedocs.org.
Package: argparse-addons
AboutAdditional Python argparse types and actions.Project homepage:https://github.com/eerimoq/argparse_addonsInstallation$ pip install argparse_addonsExamplesInteger typeThe script. Seeexamples/integer.pyfor the complete script.parser.add_argument('--min-max',type=argparse_addons.Integer(0,255))parser.add_argument('--min',type=argparse_addons.Integer(0,None))parser.add_argument('--max',type=argparse_addons.Integer(None,255))parser.add_argument('--any',type=argparse_addons.Integer())Error message for the--min-maxargument.$ python3 examples/integer.py --min-max -1
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --min-max: -1 is not in the range 0..255Error message for the--minargument.$ python3 examples/integer.py --min -1
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --min: -1 is not in the range 0..infError message for the--maxargument.$ python3 examples/integer.py --max 1000
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --max: 1000 is not in the range -inf..255Error message for the--anyargument.$ python3 examples/integer.py --any a
usage: integer.py [-h] [--min-max MIN_MAX] [--min MIN] [--max MAX] [--any ANY]
integer.py: error: argument --any: invalid integer value: 'a'All values within allowed ranges.$ python3 examples/integer.py --min-max 47 --min 1000 --max -5 --any 1
--min-max: 47
--min:     1000
--max:     -5
--any:     1ContributingFork the repository.Install prerequisites.pip install -r requirements.txtImplement the new feature or bug fix.Implement test case(s) to ensure that future changes do not break
legacy.Run the tests.make testCreate a pull request.
Package: argparse-color-formatter
argparse-color-formatterAformatter_classforargparsethat deals with ANSI colour escapes. Specifically, this formatter does not count escape characters as displayed characters when wrapping argparse's help text into the terminal.masterdevelopInstall$pipinstallargparse-color-formatterUsagePass inargparse_color_formatter.ColorHelpFormatterto a new argument parser asformatter_classimportargparsefromargparse_color_formatterimportColorHelpFormatterparser=argparse.ArgumentParser(formatter_class=ColorHelpFormatter)Before & AfterANSI colour escapes using the defaultHelpFormatter:ANSI colour escapes using this libraries newColorHelpFormatter:
Package: argparse-complete-fig
Autogenerate Completions for CLI tools built withargparseThis package generatesFig
completionsfor CLI tools built
with Python's built-inargparsemodule.InstallationInstall the integration as a dependency using pip:pipinstallargparse-complete-figUsageimportargparsefromargparse_complete_figimportadd_completion_spec_commandparser=argparse.ArgumentParser(prog='my-cli')# Call on your root-level parser for full completionsadd_completion_spec_command(parser)Calling theadd_completion_spec_commandfunction will add
a--generate-fig-specargument to the parser. When your CLI is invoked
with this flag it will print a Fig spec.To save your completion spec skeleton to a file, run the following:my-cli--generate-fig-spec>my-cli.ts
Package: argparse-custom-types
argparse-custom-typesSpecial custom types for argparseHow to installpip install argparse_custom_typesDescriptionAdditional custom types to be used with argparseHow to useImport argparse_custom_types setup the custom type then pass the function to the type keyword in argparse.add_argument()Typesint_rangecustom int in range from start to stop (not including) optional stepdefint_range(start:int,stop:int,step:int=1):example:t=int_range(5,21,5)int types 5, 10, 15, 20 would be acceptedint_abovedefint_above(minimum:int):int equal to or above the minimum enteredexample:t=int_above(40)int types 40 and above would be acceptedint_belowdefint_below(maximum:int):int equal to or below maximumexample:t=int_below(25)int types 25 or below would be acceptedint_evendefint_even(pos_number:bool=True,neg_number:bool=False,include_zero:bool=False):even int with option to include negative, zero or exclude positiveexample:t=int_even(neg_number=True)int types 2, -30, 102 would be accepted
int types 1, -29, 101 would not be acceptedint_odddefint_odd(pos_number:bool=True,neg_number:bool=False,include_zero:bool=False):odd int with option to include negative, zero or exclude positiveexample:t=int_odd(neg_number=True)int types 1, -29, 101 would be accepted
int types 2, -30, 102 would not be acceptedin_sequence_stringsdefin_sequence_strings(sequence:Union[Tuple[str],List[str]],show_on_invalid:bool=False,case_sensitive:bool=True):Value that is in the tuple or list and returns that value as a string.example:t=in_sequence_strings(["one","test","parser"])any value not in the list ["one", "test", "parser"] will not be acceptedin_sequence_intsdefin_sequence_ints(sequence:Union[List[int],Tuple[int]],show_on_invalid:bool=False):Int value in sequence will be accepted and return a int value
Package: argparse-dataclasses
argparse_dataclassesIn this package we'll place some boilerplate code that helps:to convertdataclassestoargparsecommandline argument parsers;to convertargparsecommandline arguments todataclasses.Why so?Dozens of times I had to create settings classes for my Python console scripts. Here's some utility boilerplate code that helps to create commandline parsers for dataclasses in a couple of lines = )How to installpython3 -m pip install argparse-dataclassesHow to useAt first, let's create a simple scriptsimple_example.py, in which we:import some stuff from our module,declare a simpledataclassand inherit it from ourCmdParsingMixin(this adds support for automaticargparse.ArgumentParsercreation.simple_example.pyfromdataclassesimportdataclass,fieldfromargparse_dataclassesimportCmdParsingMixin@dataclassclassSimpleSettings(CmdParsingMixin):#name:strnum_experiments:int=field(default=1)settings=SimpleSettings.build_from_commandline()print(settings)# That's all, folks!And let's run this script from commandline:$python3simple_example.pyIt will give us the error message.usage: simple_example.py [-h] --name NAME [--num-experiments NUM_EXPERIMENTS]
    simple_example.py: error: the following arguments are required: --nameOkay, just as planned. As we can see, we've forgot a required commandline argument. Let's try again$python3simple_example.py--name=DJ_BLYATMAN--num-experiments=33This will print us the settings instance:SimpleSettings(name='DJ_BLYATMAN', num_experiments=33)Be careful: use-in commandline argument names and_in Python dataclass field names. It does make sense!Our code works withargparse.ArgumentParserunder the hood, so it also supports--helpcommandline argument to explicitly order help message:$python3simple_example.py--helpIt will output the following:usage: simple_example.py [-h] --name NAME [--num-experiments NUM_EXPERIMENTS]Creating SimpleSettings instance from commandline args...optional arguments:-h, --help            show this help message and exit--name NAME--num-experiments NUM_EXPERIMENTS
Package: argparsedirs
This is a very simple action for argparse that allows
you to specify a readable or a writeable directory as anargparseaction.
I found it on StackOverflow years ago and used it since then,
unfortunately I cannot find the original source now.I guess it would be best to have this added directly intoargparseanyway.UsageJust import and use as an action:import argparse
import argparsedirs

argparser = argparse.ArgumentParser()

argparser.add_argument('indir', action=argparsedirs.ReadableDir)
argparser.add_argument('outdir', action=argparsedirs.WriteableDir)

args = argparser.parse_args()
Package: argparse-enh
ARGPARSE ENHANCEMENTSDescriptionAdds the following additional functionalities to Python's argparse.Argparse-API: Use the argparse script as a importable module in another Python script.Argparse-Shell: Use Python's argparse as the argument parser in other shell scripts.Argparse-GUI: Automatically create a GUI interface for the argparse script using Streamlit.Please refer the documentation for more details.Installationpip install argparse-enhDocumentationFor more details and usage, refer to the documentation mirrored in one of these places.Github DocsGitlab DocsReadTheDocs
Package: argparse-ext
argparse-extargparse extension;installpip install argparse-extlicenseCopyright (C) 2018-2021 Cyker WayThis program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with
this program.  If not, seehttps://www.gnu.org/licenses/.
Package: argparse-extensions
argparse-extensionsargparseextensions.Installationpip install argparse-extensionsUsageaction=argparse_extensions.NegatableStoreTrueActionis a drop-in replacement
foraction='store_true':parser = argparse.ArgumentParser()
parser.add_argument(
    '--foo',
    action=argparse_extensions.NegatableStoreTrueAction)This will handle--no-fooin addition to--foo.LicenseMIT License
Package: argparse.extra
Python argparse.ArgumentParser subclass(es)Quick example of argparser declaration from dictionary:import sys
from argparse.extra import DictArgumentParser

def run_testarg_processing(args, argv):
    print 'testarg argument used'

ARGUMENTS = {'--use-something':{'dest':'use_something',
                               'action':'store_true',
                               'default':False},
             'sub:testarg':{
                 #sub:testarg will create subparser 'testarg'
                 #depth of subargs is unlimited
                 'description':'Test arg subcommand',
                 'help':'Test help'
                 'func':run_testarg_processing,
                 '--use-sub-something':{'dest':'use_sub_something',
                                               'action':'store_true',
                                               'default':False},
             }}

DEFAULTS_ONLY = ['func',]
def get_argparser(argsdict=ARGUMENTS):
    #always create get_argparser function for your cli apps
    #this will enable easy integration of subsequent applications
    #with your argparser
    return DictArgumentParser(argsdict, DEFAULTS_ONLY)

def main(args=sys.argv):
    args, argv = get_argparser().parse_known_args(args[1:])
    args.func(args, argv)

if __name__ == '__main__':
    main()InstallationTry one of these:python setup.py install

easy_install argparse.extra

pip install argparse.extra
Package: argparse-from-jsonschema
argparse-from-jsonschemaParse Argument with JSON Schema.InstallationNeed Python 3.6+.pipinstallargparse-from-jsonschemaUsageSchema:{"$schema":"http://json-schema.org/draft-04/schema#","title":"argument_config","description":"Arg-parse Schema UnitTest","type":"object","properties":{"config":{"type":"string","positional":true,"description":"path of config file"},"resume":{"type":"boolean","description":"resume from checkpoint or not"},"foo":{"type":"boolean","description":"--with-foo for true or --no-foo for false","false-prefix":"no","true-prefix":"with"},"scale":{"type":"number","default":1.0,"description":"scale of image"},"mode":{"enum":["happy","high","heaven"],"default":"happy","description":"speed mode"},"composition":[{"type":"string","description":"Only first element is use"},{"type":"null"}]},"required":["config"]}Python Code:# demo.pyimportargparse_from_jsonschemaprint(argparse_from_jsonschema.parse(schema='./tests/argument_config.json'))Run with arguments:python3demo.py/path/to/config.py#> {'config': '/path/to/config.py', 'resume': False, 'foo': False 'scale': 1.0, 'mode': 'happy'}CLI:argparse-from-jsonschematests/argument_config.json#> Show help for schema file [tests/argument_config.json]:#> usage: YOUR-COMMAND [-h] [--resume] [--with-foo] [--scale SCALE]#>                     [--mode {happy,high,heaven}]#>                     config#>#> Arg-parse Schema UnitTest#>#> positional arguments:#>   config                path of config file#>#> optional arguments:#>   -h, --help            show this help message and exit#>   --resume              resume from checkpoint or not#>   --with-foo, --no-foo  --with-foo for true or --no-foo for false#>   --scale SCALE         scale of image, [1.0] in default#>   --mode {happy,high,heaven}#>                         speed mode, [happy] in default
Package: argparse-helper
Yet another argparse helper: complex sub-command trees made simpleWriting complex subcommand parsers usingargparseis certainly possible, but it involves a lot
of laborious repetition.This library provides a small wrapper aroundargparsethat adds a convenience method. That
lets you specify a sequence of words that form a command, together with flags - and the
definitions of those flags are passed at the same time.parser = ArgumentParser()
parser.add_command("foo bar baz --json",
                   func=lambda *args: print("foo-bar-baz"),
                   json=dict(default=False, action="store_true"),
                   )
parser.add_command("foo bar quux",
                   func=lambda *args: print("foo-bar-quux"),
                   )Thefuncparameter will be set on the resulting namespace. Note, there is no particular requirement
for the arguments that must be passed tofunc- this is down to the library user to define.Additionally, a newargparse.Actionsubclass is provided,OptionalOverride. This supports
having thesameflag appear in a global position and be repeated by a subcommand. It works
well - in as much as defaults set by the global position won't be re-set in the subordinate
position.parser.add_command("--flag", flag=dict(default="foo"))
parser.add_command("xyzzy --flag", flag=dict(action=OptionalOverride))Where a flag is repeated in anadd_commandcall, the second and subsequent values receive anOptionalOveridesetting automatically.parser.add_command("--glob xyzzy --glob", glob=dict(action=AtMostOnce))
# the second iteration becomes OptionalOverrideAtMostOnceis supplied as an action type; this causes an explicit error (rather than
just overriding the previous value) if a flag is specified more than once.We also haveAppendN(t)as an action type. It works likeAppend, but the type constructortis applied to its collected argument(s) before the result is appended to the list.
Package: argparsejson
argparsejsonEasily parse arguments, simply by writing JSON!Getting StartedCopyexample_commands.jsontocommands.jsonModify as necessary.To get anargparseArgumentParser, callargparsejson.parse_arguments(<commands_file>)(adding optional parameters if necessary). Then, callparse_args()on the returned ArgumentParser.DocumentationAll documentation can be foundhereThe fully up-to-date JSON schema can be foundhere
Package: argparse-logging
Argparse_loggingThis is a simple library to configure logging from command line argument when using argparse.Withoutargparse_logging:from argparse import ArgumentParser

parser = ArgumentParser()
parser.add_argument(
    "--log-level",
    default=logging.INFO,
    type=lambda x: getattr(logging, x)),
    help="Configure the logging level.",
)
args = parser.parse_args()
logging.basicConfig(level=args.log_level)This is a bit annoying to copy paste in every program.Instead you can use argparse_logging to get the following:from argparse import ArgumentParser
from argparse_logging import add_log_level_argument

parser = ArgumentParser()
add_log_level_argument(parser)
args = parser.parse_args()DeploymentYou will needgit,pipenv,python,pre-commit. Then you can set up your virtual environment:$ git clone git@github.com:nanassito/argparse_logging.git
$ cd argparse_logging
$ pipenv update --devDo whatever changes you want. You can run the tests and linting with:$ pipenv run py.test
$ pre-commit
Package: argparse-manpage-birdtools
This code is a fork ofhttps://github.com/praiskup/argparse-manpagewith various
opinions introduced, to make it easier to use for the usual style of the
Woodcroft lab bird tools. See alsohttps://github.com/wwood/bird_tool_utils-python/Also in contrast to upstream, the main aim of this repository is to provide code
that allows formatting of manpages at runtime, rather than at install-time.LicenseThis work is released under the terms of the Apache License v2.0. See LICENSE
for details, and upstream repositories for author information.
Package: argparsemd
argparsemdA package that extends Pythonargparse.ArgumentParserwith Markdown help.introFor documentation purposes it might be useful to be able to produce the help
text of a python program in markdown format.This package implements a subclass ofargparse.ArgumentParserand automatically adds a-mdoption that will produce the same information as the-hoption but as markdown.  The-hkeeps on working as before.An example is shown in the sectionexamplerequirementsNo external requirements but be aware that this only has been tested with Python 3.11.It might work with earlier or later versions but because theargparsepackage doesn't lend
itself very well to subclassing without rewriting hundreds of lines of code, your mileage
may vary.warningThis package does not have a test-suite and may break everything you touch. Use at your own risk.installationInstall it directly from PyPipip install argparsemdor alternatively, download it from GitHubgit clone https://github.com/varkenvarken/argparsemd.git
cd argparsemd
python setup.py installexamplefromargparsemdimportArgumentParserMDparser=ArgumentParserMD(description="Do nothing but showcase markdown help")parser.add_argument("-f","--filename",default="sample.png",help="Output filename. use - for stdout.",)parser.add_argument("--width",type=int,default=400,help="Width in pixels")parser.add_argument("--height",type=int,default=200,help="Height in pixels",)parser.add_argument("-c","--character",action="store_true",default=False,help="Height and width are in character units",)args=parser.parse_args()If you save this aspyprog.pyand call that withpython myprog -md,
his will result in the following markdown output:# myprog.py:

    ```

    usage: myprog.py [-h] [-md] [-f FILENAME] [--width WIDTH] [--height HEIGHT] [-c]

    ```

    Do nothing but showcase markdown help

    ## options:
    - **-h**, **--help** 

    show this help message and exit

    - **-md** 

    print Markdown-formatted help text and exit.

    - **-f**, **--filename** [sample.png]

    Output filename. use - for stdout.

    - **--width**:int [400]

    Width in pixels

    - **--height**:int [200]

    Height in pixels

    - **-c**, **--character** [False]

    Height and width are in character unitsWhich in a preview will show up as:myprog.py:usage: myprog.py [-h] [-md] [-f FILENAME] [--width WIDTH] [--height HEIGHT] [-c]Do nothing but showcase markdown helpoptions:-h,--helpshow this help message and exit-mdprint Markdown-formatted help text and exit.-f,--filename[sample.png]Output filename. use - for stdout.--width:int [400]Width in pixels--height:int [200]Height in pixels-c,--character[False]Height and width are in character units
Package: argparse-node
Argparse NodeA minimal multi-level argument parser for your python CLI apps.InstallationFrom PyPI:pip install argparse-nodeFrom Github:pip install git+https://github.com/enhuiz/argparse-node.gitRun an examplepython -m example.entry show hello
python -m example.entry wohs hello
python -m example.entry sub_example show hello
python -m example.entry sub_example wohs hello
python -m example.entry --verbose show hello
python -m example.entry --helpSeeexample/for details.
Package: argparse-oappend
Providesoappendaction forargparsethat works almost likeappend,
but skips the default list if the user gives any value for the option.Seeissue 16399for a discussion.ExampleYou may importOverrideAppendActionand register it with a parser or use the
provided parser:fromoappendimportOverrideAppendArgumentParserparser=OverrideAppendArgumentParser()parser.add_argument('-n',action='oappend',type=int,default=[1,2])args=parser.parse_args(['-n3','-n4'])# Namespace(n=[3, 4])With the standardappendaction the option would be set to[1, 2, 3, 4], combining your default with user choices.Installationpip3installargparse-oappend
Package: argparse-param-types
Argparse Param TypesIntroductionArgparse is an excellent standard library for managing input in command-line python script, but it ships with only basic types. This project provides a library of option types that covers a lot of common use case to avoid rewriting again and again the same basic code.Installationpip install argparse_param_typesHow to useAvailable option typesfile_typedirectory_typehost_typeip_typerawip_typeip4_typerawip4_typeip6_typerawip6_typenet_typerawnet_typenet4_typerawnet4_typenet6_typerawnet6_typeport_typeChangelog0.0.3Add missing dependencies in pyproject (dependencies not automatically installed when pip install)Add alogsflag on each param type to allow function nesting without erroneous error loggingBug fix: Do not log error when param_type function is used as a test in a success scenarioUse more precise except exception class to better fit business logic and not broadly catch exceptions0.0.2Refactor to be PEP8 compliant, improve/add documentation, add type hintingAdd easy import from module __init__Add .gitignore to projectAdd param type host_type & ip_type & rawip_type & ip4_type & rawip4_type & ip6_type & rawip6_type & net_type & rawnet_type & net4_type & rawnet4_type & net6_type & rawnet6_type & port_typeAdd unit tests for every param type0.0.1Initial commitImplement param type file_type & directory_typeLicenseMIT License© [ndmalc]