argparse 2.2.5
CRAN release: 2024-12-20
- Tweaks the
parse_known_intermixed_args()tests so they work with the development version of Python.
argparse 2.2.4
CRAN release: 2024-11-20
-
ArgumentParser()’spython_cmdargument is now wrapped bynormalizePath(mustWork = FALSE).
argparse 2.2.3
CRAN release: 2024-04-09
-
Character values are now passed as “raw” strings to Python (#51).
In particular this avoids triggering an error in Python 3.12 when creating a string with escapes not supported by Python e.g.
default = "\\D"will continue to return a default value of"\\D"instead of triggering an error.-
However, this also means that any Python accepted escape sequences will no longer be interpreted as an escape sequence. If relying on such behaviour you may need to instead use the appropriate R escape sequences or Unicode values instead of Python escape sequences:
- E.g.
default = "\\t"will now return a default value of"\\t"(atpreceded by an (escaped) backslash) instead of"\t"(a horizontal tab). - https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences
- https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block)
- E.g.
Thanks Matthew Hall (@mdhall272) for bug report.
argparse 2.2.2
CRAN release: 2023-02-15
- Fixes bug when
add_argument()helpvalues ended in a"(#46). Thanks Oliver Dreschel (@oliverdreschel) for bug report.
argparse 2.2.1
CRAN release: 2022-12-08
-
We now support the following
ArgumentParser()methods:format_help()format_usage()-
parse_intermixed_args()(#45) -
parse_known_intermixed_args()(#45) -
set_defaults()(#43). Suggestion of @oliverbothe.
When an error is thrown by
ArgumentParser()$parse_args()andinteractive()isFALSEandgetOption("error")isNULLthen we now use a quieter default error handler that doesn’t output a trailing “Execution halted”.add_argument()now allows “numeric” as an alias for “double” for thetypeargument (#42). Suggestion of @dariober.ArgumentParser()now handlesdescriptionarguments with newlines in them (#44). Thanks Arthur Gilly (@agilly) for bug report.
argparse 2.1.6
CRAN release: 2022-07-17
-
The errors raised by
ArgumentParser()$parse_args()are now of class “argparse_parse_error”.They are now less verbose when
interactive()isFALSE(#40).There may still be a trailing “Execution halted” line output by R’s default error handler (when
interactive()isFALSE). This can be silenced by setting a new error handler near the top of your Rscript e.g.if (!interactive()) options(error=function(e) quit('no', status = 1, runLast = FALSE))
argparse 2.1.5
CRAN release: 2022-04-20
-
add_argumentnow usesas.logical()logic to cast variables to logical values iftype = "logical"andaction = "store"oraction = "append"instead of using Python’sbool()logic (#39).- We throw an error if we would get an NA by coercion.
- We no longer throw a warning when using
type = "logical"andaction = "store"suggesting users instead useaction = "store_true"oraction = "store_false".
argparse 2.1.1
CRAN release: 2021-09-08
- Parsers now support
parse_known_args()(#34). Suggestion of David Lacalle Castillo (@WaterKnight1998).
argparse 2.0.4
CRAN release: 2021-08-06
- May now specify a named
formatter_classargument (as a string) to asubparsers$add_parser()method. Thanks Regina (@oyxf) for bug report. - May now specify positional arguments in
ArgumentParser().
argparse 2.0.3
CRAN release: 2020-10-19
- Fixes bug when accidentally passing a positional argument to
ArgumentParser()when using Python 3.9. Thanks Kurt Hornik for bug report.
argparse 2.0.1
CRAN release: 2019-03-08
- Improved passing of arguments to Python from R. In particular should fix bug in using
add_helpargument inArgumentParser. Thanks George Chlipala for bug report. - Removes
getoptas a dependency.
argparse 2.0.0
CRAN release: 2018-11-30
- Now uses
R6classes instead ofprotoclasses (#25). The typical user shouldn’t need to change anyargparsecode but I did make private the previously publicpython_codeelement of the object returned byArgumentParser(). - Parsers now support
add_subparsers(#14). Suggestion of Zebulun Arendsee. - Parsers now support
add_argument_group(#26). Suggestion of Dario Beraldi. - Parsers now support
add_mutually_exclusive_group(#23). Suggestion of Vince Reuter.
argparse 1.1.1
CRAN release: 2018-01-24
- Better support for machines only running Python 2.7.
- DESCRIPTION makes explicit that it requires version 1.0.0 of
protodependency. Thanks Christophe Poulet for bug report.
argparse 1.1.0
CRAN release: 2017-11-29
- Better support for Unicode arguments/options. Thanks Erick Rocha Fonseca for bug report.
- Fix bug when setting
type='integer'inadd_argument. Thanks Dominik Mueller for bug report and suggested solution. - The package
protohas been moved fromDependstoImportsinDESCRIPTION. We now usejsonlitepackage instead ofrjsonto parseJSON. - Better error message when accidentally trying to define a positional argument in
ArgumentParser()Suggestion of Alex Reinhart. - Other error message output when an parsing error is detected have been tweaked slightly.
argparse 1.0.7
CRAN release: 2017-08-23
- Now supports showing program’s version with
action='version'. Suggestion of Dario Beraldi. - Fix bug when setting
required=FALSEinadd_argument. Thanks Claire D. McWhite for bug report.
argparse 1.0.4
CRAN release: 2016-10-28
- You can now pass in a character vector to the
metavarargument ofadd_argument. Thanks Paul Newell for bug report and a patch. -
add_argumentnow throws a warning recommending using action “store_true” or “store_false” if type set to “logical” and action set to “store”. Suggestion of Martí Duran Ferrer - You can now explicitly set a
NULLdefault inadd_argument. Previously one could only implicitly set aNULLdefault by not setting any default at all. Suggestion of Hyunsoo Kim. - Fixes parsing bug when using a very large argument list. Thanks Taylor Pospisil for bug report.
- Parse error usage message now prints to standard error. User requested help message quit status is now zero. Thanks to PlasmaBinturong for report/request.
- If Python script fails with error pass on error message to user. Thanks to Martí Duran Ferrer for report/request.
argparse 1.0.1
CRAN release: 2014-04-05
- Fix minor bug when running package tests on machines with both old and new versions of Python. Thanks Prof. Brian Ripley for bug report.
argparse 1.0.0
CRAN release: 2014-04-04
- Some support for
choicesargument inparser$add_argument. Thanks Christopher Small for report/request. - Some support for
formatter_classargument inArgumentParser. Thanks Costas Bouyioukos for report/request. - Package now looks for Python binaries with
findpython::find_python_cmdwhich is a little bit more robust than the previousargparse::find_python_cmd. - If
interactive() == TRUEthenparse_argswill no longerquit(status=1)after printing a help message but will instead throw an error.argparsewill continue toquit(status=1)after printing a help message for non-interactive Rscripts.
argparse 0.5.3
CRAN release: 2013-08-26
- Fix bug in
parser$add_argumentfor case when we specify a default vector instead of scalar. Thanks Martin Diehl for bug report. -
find_python_cmdwill now also look for apython2.7binary. - Website moved to https://github.com/trevorld/argparse