| Title: | Functions to Find an Acceptable Python Binary |
|---|---|
| Description: | Package designed to find an acceptable python binary. |
| Authors: | Trevor L. Davis [aut, cre] (ORCID: <https://orcid.org/0000-0001-6341-4639>), Paul Gilbert [aut] |
| Maintainer: | Trevor L. Davis <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.9 |
| Built: | 2026-05-09 07:53:55 UTC |
| Source: | https://github.com/trevorld/findpython |
can_find_python_cmd() runs find_python_cmd() and returns whether it could find a suitable python cmd.
If it was successful its output also saves the found command as an attribute.
can_find_python_cmd( minimum_version = NULL, maximum_version = NULL, required_modules = NULL, error_message = NULL, silent = FALSE )can_find_python_cmd( minimum_version = NULL, maximum_version = NULL, required_modules = NULL, error_message = NULL, silent = FALSE )
minimum_version |
The minimum version of python it should be.
Should be a string with major and minor number separated by a |
maximum_version |
The maximum version of python it should be.
Should be a string with major and minor number separated by a |
required_modules |
Which modules should be required.
Can use a single |
error_message |
What error message the user will see if couldn't find a sufficient python binary. If left NULL will print out a default message. |
silent |
Passed to |
TRUE or FALSE depending on whether
find_python_cmd() could find an appropriate python binary.
If TRUE the path to an appropriate python binary is also set as an attribute.
did_find_cmd <- can_find_python_cmd() python_cmd <- attr(did_find_cmd, "python_cmd")did_find_cmd <- can_find_python_cmd() python_cmd <- attr(did_find_cmd, "python_cmd")
find_python_cmd() finds a suitable python cmd or raises an error if not possible
find_python_cmd( minimum_version = NULL, maximum_version = NULL, required_modules = NULL, error_message = NULL )find_python_cmd( minimum_version = NULL, maximum_version = NULL, required_modules = NULL, error_message = NULL )
minimum_version |
The minimum version of python it should be.
Should be a string with major and minor number separated by a |
maximum_version |
The maximum version of python it should be.
Should be a string with major and minor number separated by a |
required_modules |
Which modules should be required.
Can use a single |
error_message |
What error message the user will see if couldn't find a sufficient python binary. If left NULL will print out a default message. |
The path to an appropriate python binary. If such a path wasn't found then it will throw an error.
can_find_python_cmd() for a wrapper which doesn't throw an error
try(find_python_cmd()) try(find_python_cmd(minimum_version = "2.6", maximum_version = "2.7")) try(find_python_cmd(required_modules = c("argparse", "json | simplejson")))try(find_python_cmd()) try(find_python_cmd(minimum_version = "2.6", maximum_version = "2.7")) try(find_python_cmd(required_modules = c("argparse", "json | simplejson")))
is_python_sufficient() checks whether a given python binary has all the
desired features (minimum and/or maximum version number and/or access to
certain modules).
is_python_sufficient( path, minimum_version = NULL, maximum_version = NULL, required_modules = NULL )is_python_sufficient( path, minimum_version = NULL, maximum_version = NULL, required_modules = NULL )
path |
The path to a given python binary. If binary is on system path just the binary name will work. |
minimum_version |
The minimum version of python it should be.
Should be a string with major and minor number separated by a |
maximum_version |
The maximum version of python it should be.
Should be a string with major and minor number separated by a |
required_modules |
Which modules should be required.
Can use a single |
TRUE or FALSE depending on whether the python binary met all requirements
try({ cmd <- find_python_cmd() is_python_sufficient(cmd, minimum_version = "3.3", required_modules = "sys") })try({ cmd <- find_python_cmd() is_python_sufficient(cmd, minimum_version = "3.3", required_modules = "sys") })