pyduinocli.commands.arduino
- class pyduinocli.commands.arduino.ArduinoCliCommand(cli_path='arduino-cli', config_file=None, additional_urls=None, log_file=None, log_format=None, log_level=None, no_color=None)
This is the main class of pyduinocli. This class wraps all calls to
arduino-cli
.This is the only class that a user should create instances of.
- Parameters:
cli_path (str) – The
arduino-cli
command name if available in$PATH
. Can also be a direct path to the executableconfig_file (str or NoneType) – The path to the
arduino-cli
configuration file to be usedadditional_urls (list or NoneType) – A list of URLs to custom board definitions files
log_file (str or NoneType) – A path to a file where logs will be stored
log_format (str or NoneType) – The format the logs will use
log_level (str or NoneType) – The log level for the log file
no_color (bool or NoneType) – Disable colored output
- property board
The board command wrapper for this
arduino-cli
wrapper
- property burn_bootloader
The burn-bootloader command wrapper for this
arduino-cli
wrapper
- property cache
The cache command wrapper for this
arduino-cli
wrapper
- property compile
The compile command wrapper for this
arduino-cli
wrapper
- property completion
The completion command wrapper for this
arduino-cli
wrapper
- property config
The config command wrapper for this
arduino-cli
wrapper
- property core
The core command wrapper for this
arduino-cli
wrapper
- property daemon
The daemon command wrapper for this
arduino-cli
wrapper
- property debug
The debug command wrapper for this
arduino-cli
wrapper
- property lib
The lib command wrapper for this
arduino-cli
wrapper
- property monitor
The monitor command wrapper for this
arduino-cli
wrapper
- property outdated
The outdated command wrapper for this
arduino-cli
wrapper
- property sketch
The sketch command wrapper for this
arduino-cli
wrapper
- property update
The update command wrapper for this
arduino-cli
wrapper
- property upgrade
The upgrade command wrapper for this
arduino-cli
wrapper
- property upload
The upload command wrapper for this
arduino-cli
wrapper
- property version
The version command wrapper for this
arduino-cli
wrapper
pyduinocli.commands.board
- class pyduinocli.commands.board.BoardCommand(base_args)
This class wraps the call to the
board
command ofarduino-cli
- attach(port=None, fqbn=None, sketch_path=None, discovery_timeout=None, protocol=None, board_options=None)
Calls the
board attach
command.- Parameters:
port (str or NoneTYpe) – Upload port address, e.g.: COM3 or /dev/ttyACM2
fqbn (str or NoneTYpe) – Fully Qualified Board Name, e.g.: arduino:avr:uno
sketch_path (str or NoneTYpe) – The path of the sketch to attach to the board
discovery_timeout (str or NoneTYpe) – Max time to wait for port discovery, e.g.: 30s, 1m (default 5s)
protocol (str or NoneTYpe) – Upload port protocol, e.g: serial
board_options (dict or NoneTYpe) – Board options
- Returns:
The output of the related command
- Return type:
dict
- details(fqbn, full=None, list_programmers=None, board_options=None, show_properties=None)
Calls the
board details
command.- Parameters:
fqbn (str) – The fqbn of the board
full (bool or NoneTYpe) – Show full board details
list_programmers (bool or NoneType) – Show list of available programmers
board_options (dict or NoneType) – Board options
show_properties (str, bool or NoneType) – Show build properties. The properties are expanded, use show_properties=unexpanded” if you want them exactly as they are defined. (default “disabled”)
- Returns:
The output of the related command
- Return type:
dict
- list(discovery_timeout=None, watch=None, board_options=None, fqbn=None)
Calls the
board list
command.- Parameters:
discovery_timeout (str or NoneType) – Max time to wait for port discovery, e.g.: 30s, 1m (default 1s)
watch (bool or NoneTYpe) – Command keeps running and prints list of connected boards whenever there is a change. Added to pyduinocli for completion but won’t actually return, use a loop instead
fqbn (str or NoneType) – Fully Qualified Board Name, e.g.: arduino:avr:uno
board_options (dict or NoneType) – Dict of board options (option_name:value)
- Returns:
The output of the related command
- Return type:
dict
- listall(boardname=None, show_hidden=None)
Calls the
board listall
command.- Parameters:
boardname (str or NoneType) – The name of the board, all board will be returned if left unset (or None)
show_hidden (bool or NoneTYpe) – Show also boards marked as ‘hidden’ in the platform
- Returns:
The output of the related command
- Return type:
dict
- search(boardname=None, show_hidden=None)
Calls the
board search
command.- Parameters:
boardname (str or NoneType) – The name of the board
show_hidden (bool or NoneTYpe) – Show also boards marked as ‘hidden’ in the platform
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.burn_bootloader
- class pyduinocli.commands.burn_bootloader.BurnBootloaderCommand(base_args)
This class wraps the call to the
burn-bootloader
command ofarduino-cli
- __call__(discovery_timeout=None, fqbn=None, port=None, programmer=None, protocol=None, verify=None, board_options=None, verbose=None)
Calls the
burn-bootloader
command- Parameters:
fqbn (str or NoneType) – The fqbn of the board to burn
port (str or NoneTYpe) – The port to use to burl the bootloader
programmer (str or NoneTYpe) – The programmer to use for the burning process
verify (bool or NoneTYpe) – Verifies that the bootloader was successfully burnt
discovery_timeout (str or NoneType) – Max time to wait for port discovery, e.g.: 30s, 1m (default 5s)
protocol (str or NoneType) – Upload port protocol, e.g: serial
board_options (dict or NoneTYpe) – Board options
verbose (bool or NoneTYpe) – Turns on verbose mode
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.cache
pyduinocli.commands.compile
- class pyduinocli.commands.compile.CompileCommand(base_args)
This class wraps the call to the
compile
command ofarduino-cli
.- __call__(sketch, build_cache_path=None, build_path=None, build_properties=None, fqbn=None, output_dir=None, port=None, preprocess=None, show_properties=None, upload=None, verify=None, warnings=None, libraries=None, library=None, optimize_for_debug=None, export_binaries=None, programmer=None, clean=None, only_compilation_database=None, discovery_timeout=None, protocol=None, board_options=None, encrypt_key=None, keys_keychain=None, sign_key=None, dump_profile=None, profile=None, verbose=None)
Calls the
compile
command- Parameters:
sketch (str) – The sketch to compile, can also be a path to a sketch
build_cache_path (str or NoneType) – Builds of ‘core.a’ are saved into this path to be cached and reused.
build_path (str or NoneType) – Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.
build_properties (list or NoneType) – Override build properties with custom values.
fqbn (str or NoneType) – Fully Qualified Board Name, e.g.: arduino:avr:uno
output_dir (str or NoneType) – Save build artifacts in this directory.
port (str or NoneType) – Upload port, e.g.: COM10 or /dev/ttyACM0
preprocess (bool or NoneType) – Print preprocessed code to stdout instead of compiling.
show_properties (str, bool or NoneType) – Show build properties. The properties are expanded, use show_properties=”unexpanded” if you want them exactly as they are defined. (default “disabled”)
upload (bool or NoneType) – Upload the binary after the compilation.
verify (bool or NoneType) – Verify uploaded binary after the upload.
warnings (str or NoneType) – Optional, can be “none”, “default”, “more” and “all”. Defaults to “none”. Used to tell gcc which warning level to use (-W flag). (default “none”)
libraries (list or NoneType) – List of custom libraries dir paths separated by commas. Or can be used multiple times for multiple libraries dir paths.
library (list or NoneType) – List of paths to libraries root folders. Libraries set this way have top priority in case of conflicts. Can be used multiple times for different libraries.
optimize_for_debug (bool or NoneType) – Optional, optimize compile output for debugging, rather than for release.
export_binaries (bool or NoneType) – If set built binaries will be exported to the sketch folder.
programmer (str or NoneType) – Optional, use the specified programmer to upload.
clean (bool or NoneType) – Optional, cleanup the build folder and do not use any cached build.
only_compilation_database (bool or NoneType) – Just produce the compilation database, without actually compiling.
discovery_timeout (str or NoneType) – Max time to wait for port discovery, e.g.: 30s, 1m (default 5s)
protocol (str or NoneType) – Upload port protocol, e.g: serial
board_options (dict or NoneType) – Board options
encrypt_key (str or NoneType) – The name of the custom encryption key to use to encrypt a binary during the compile process. Used only by the platforms that support it.
keys_keychain (str or NoneType) – The path of the dir to search for the custom keys to sign and encrypt a binary. Used only by the platforms that support it.
sign_key (str or NoneType) – The name of the custom signing key to use to sign a binary during the compile process. Used only by the platforms that support it.
dump_profile (bool or NoneType) – Create and print a profile configuration from the build.
profile (str or NoneType) – Sketch profile to use
verbose (bool or NoneType) – Optional, turns on verbose mode
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.completion
- class pyduinocli.commands.completion.CompletionCommand(base_args)
This class wraps the call to the
completion
command ofarduino-cli
.- __call__(shell, no_description=None)
Calls the
completion
command- Parameters:
shell (str) – The shell name that will use completition
no_description (bool or NoneTYpe) – Disable completion description for shells that support it
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.config
- class pyduinocli.commands.config.ConfigCommand(base_args)
This class wraps the call to the
config
command ofarduino-cli
.- add(setting_name, values)
Calls the
config add
command- Parameters:
setting_name (str) – The name of the setting to add
values (list) – The values to add to the setting
- Returns:
The output of the related command
- Return type:
dict
- delete(setting_name)
Calls the
config delete
command- Parameters:
setting_name (str) – The name of the setting to delete
- Returns:
The output of the related command
- Return type:
dict
- dump()
Calls the
config dump
command- Returns:
The output of the related command
- Return type:
dict
- init(dest_dir=None, dest_file=None, overwrite=None)
Calls the
config init
command- Parameters:
dest_dir (str or NoneType) – The directory where to save the file
dest_file (str or NoneType) – A path where the file will be saved
overwrite (bool or NoneType) – Overwrites an existing file
- Returns:
The output of the related command
- Return type:
dict
- remove(setting_name, values)
Calls the
config remove
command- Parameters:
setting_name (str) – The name of the setting from which values will be removed
values (list) – The list of values to remove
- Returns:
The output of the related command
- Return type:
dict
- set(setting_name, values)
Calls the
config set
command- Parameters:
setting_name (str) – The name of the setting to set
values (list) – The list of values to set
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.core
- class pyduinocli.commands.core.CoreCommand(base_args)
This class wraps the call to the
core
command ofarduino-cli
.- download(downloads)
Calls the
core download
command- Parameters:
downloads (list) – A list of cores to download
- Returns:
The output of the related command
- Return type:
dict
- install(installs, run_post_install=None, skip_post_install=None, no_overwrite=None, run_pre_uninstall=None, skip_pre_uninstall=None)
Calls the
core download
command- Parameters:
installs (list) – A list of cores to install
run_post_install (bool or NoneType) – Force run of post-install scripts
skip_post_install (bool or NoneType) – Force skip of post-install scripts
no_overwrite (bool or NoneType) – Do not overwrite already installed platforms
run_pre_uninstall (bool or NoneType) – Force run of pre-uninstall scripts (if the CLI is not running interactively)
skip_pre_uninstall (bool or NoneType) – Force skip of pre-uninstall scripts (if the CLI is running interactively).
- Returns:
The output of the related command
- Return type:
dict
- list(updatable=None, all=None)
Calls the
core list
command- Parameters:
updatable (bool or NoneType) – Only shows cores that are not up to date
all (bool or NoneType) – Shows all installed and non installed cores (also shows manually installed cores)
- Returns:
The output of the related command
- Return type:
dict
- search(keywords=None, all=None)
Calls the
core search
command- Parameters:
keywords (list or NoneType) – A list of keywords to use to search, if None, all cores will show up
all (bool or NoneType) – Shows all available core versions
- Returns:
The output of the related command
- Return type:
dict
- uninstall(uninstalls, run_post_install=None, run_pre_uninstall=None, skip_post_install=None, skip_pre_uninstall=None)
Calls the
core uninstall
command- Parameters:
uninstalls (list) – A list of cores to uninstall
run_post_install (bool or NoneType) – Force run of post-install scripts (if the CLI is not running interactively).
run_pre_uninstall (bool or NoneType) – Force run of pre-uninstall scripts (if the CLI is not running interactively).
skip_post_install (bool or NoneType) – Force skip of post-install scripts (if the CLI is running interactively).
skip_pre_uninstall (bool or NoneType) – Force skip of pre-uninstall scripts (if the CLI is running interactively).
- Returns:
The output of the related command
- Return type:
dict
- update_index()
Calls the
core update-index
command- Returns:
The output of the related command
- Return type:
dict
- upgrade(upgrades=None, run_post_install=None, skip_post_install=None, run_pre_uninstall=None, skip_pre_uninstall=None)
Calls the
core upgrade
command- Parameters:
upgrades (list or NoneType) – A list of cores to upgrade, if None, all cores will be upgraded
run_post_install (bool or NoneType) – Force run of post-install scripts
skip_post_install (bool or NoneType) – Force skip of post-install scripts
run_pre_uninstall (bool or NoneType) – Force run of pre-uninstall scripts (if the CLI is not running interactively).
skip_pre_uninstall (bool or NoneType) – Force skip of pre-uninstall scripts (if the CLI is running interactively).
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.daemon
- class pyduinocli.commands.daemon.DaemonCommand(base_args)
This class wraps the call to the
daemon
command ofarduino-cli
.- __call__(daemonize=None, port=None, debug=None, debug_filter=None, debug_file=None)
Calls the
daemon
command- Parameters:
daemonize (bool or NoneType) – Do not terminate daemon process if the parent process dies
port (str, integer or NoneType) – The TCP port the daemon will listen to
debug (bool or NoneType) – Enable debug logging of gRPC calls
debug_filter (str or NoneType) – Display only the provided gRPC calls
debug_file (str or NoneType) – Append debug logging to the specified file
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.debug
- class pyduinocli.commands.debug.DebugCommand(base_args)
This class wraps the call to the
debug
command ofarduino-cli
. Warning, While this has been added in pyduinocli, it has not been tested, and won’t probably work since it will start an interactive gdb session and won’t return- __call__(fqbn=None, input_dir=None, port=None, interpreter=None, info=None, programmer=None, sketch=None, discovery_timeout=None, protocol=None, board_options=None)
Calls the
debug
command- Parameters:
fqbn (str or NoneType) – Fully Qualified Board Name, e.g.: arduino:avr:uno
input_dir (str or NoneType) – Directory containing binaries for debug.
port (str or NoneType) – Debug port, e.g.: COM10 or /dev/ttyACM0
interpreter (str or NoneType) – Debug interpreter e.g.: console, mi, mi1, mi2, mi3 (default “console”)
info (str or NoneType) – Show metadata about the debug session instead of starting the debugger.
programmer (str or NoneType) – Programmer to use for debugging
sketch (str or NoneType) – The sketch to debug
discovery_timeout (str or NoneType) – Max time to wait for port discovery, e.g.: 30s, 1m (default 5s)
protocol (str or NoneType) – Upload port protocol, e.g: serial
board_options (dict or NoneTYpe) – Board options
- Returns:
The output of the related command
- Return type:
dict
- check(fqbn=None, input_dir=None, port=None, interpreter=None, info=None, programmer=None, discovery_timeout=None, protocol=None, board_options=None)
Calls the
debug check
command- Parameters:
fqbn (str or NoneType) – Fully Qualified Board Name, e.g.: arduino:avr:uno
input_dir (str or NoneType) – Directory containing binaries for debug.
port (str or NoneType) – Debug port, e.g.: COM10 or /dev/ttyACM0
interpreter (str or NoneType) – Debug interpreter e.g.: console, mi, mi1, mi2, mi3 (default “console”)
info (str or NoneType) – Show metadata about the debug session instead of starting the debugger.
programmer (str or NoneType) – Programmer to use for debugging
discovery_timeout (str or NoneType) – Max time to wait for port discovery, e.g.: 30s, 1m (default 5s)
protocol (str or NoneType) – Upload port protocol, e.g: serial
board_options (dict or NoneTYpe) – Board options
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.lib
- class pyduinocli.commands.lib.LibCommand(base_args)
This class wraps the call to the
lib
command ofarduino-cli
.- deps(library)
Calls the
lib deps
command- Parameters:
library (str) – The name of the library for dependency checking
- Returns:
The output of the related command
- Return type:
dict
- download(downloads)
Calls the
lib download
command- Parameters:
downloads (list) – A list of libraries to download
- Returns:
The output of the related command
- Return type:
dict
- examples(library, fqbn=None, board_options=None)
Calls the
lib examples
command- Parameters:
library (str) – The name of the library
fqbn (str or NoneType) – The board FQBN
board_options (dict or NoneTYpe) – Board options
- Returns:
The output of the related command
- Return type:
dict
- install(libraries=None, git_urls=None, zip_paths=None, no_overwrite=None, install_in_builtin_dir=None)
Calls the
lib install
command- Parameters:
libraries (list or NoneType) – A list of libraries to install
git_urls (list or NoneType) – A list of git repositories containing libraries to install
zip_paths (list or NoneType) – A list of paths to zip files to install
no_overwrite (bool or NoneType) – Do not overwrite already installed libraries.
install_in_builtin_dir (bool or NoneType) – Install libraries in the IDE-Builtin directory
- Returns:
The output of the related command
- Return type:
dict
- list(all=None, updatable=None, fqbn=None, board_options=None)
Calls the
lib list
command- Parameters:
all (bool or NoneType) – Includes built-in libraries
updatable (bool or NoneType) – Only shows libraries that are not up to date
fqbn (str or NoneType) – Shows libraries for the specified board
board_options (dict or NoneTYpe) – Board options
- Returns:
The output of the related command
- Return type:
dict
- search(keywords=None, names=None, omit_releases_details=None)
Calls the
lib search
command- Parameters:
keywords (list or NoneType) – A list of keywords to use to search, if None, all libraries will show up
omit_releases_details (bool or NoneType) – Omit library details far all versions except the latest (produce a more compact JSON output).
names (bool or NoneType) – Only shows libraries names
- Returns:
The output of the related command
- Return type:
dict
- uninstall(uninstalls)
Calls the
lib uninstall
command- Parameters:
uninstalls (list) – A list of libraries to uninstall
- Returns:
The output of the related command
- Return type:
dict
- update_index()
Calls the
lib update-index
command- Returns:
The output of the related command
- Return type:
dict
- upgrade(upgrades=None)
Calls the
lib upgrade
command- Parameters:
upgrades (list or NoneType) – A list of libraries to upgrade, if None, all libraries will be upgraded
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.monitor
- class pyduinocli.commands.monitor.MonitorCommand(base_args)
This class wraps the call to the
monitor
command ofarduino-cli
.- __call__(config=None, describe=None, discovery_timeout=None, fqbn=None, port=None, protocol=None, quiet=None, board_options=None, raw=None, timestamp=None)
Calls the
monitor
command- Parameters:
config (str or NoneType) – Configuration of the port.
describe (bool or NoneType) – Show all the settings of the communication port.
discovery_timeout (str or NoneType) – Max time to wait for port discovery, e.g.: 30s, 1m (default 5s)
fqbn (str or NoneType) – Fully Qualified Board Name, e.g.: arduino:avr:uno
port (str or NoneType) – Upload port address, e.g.: COM3 or /dev/ttyACM2
protocol (str or NoneType) – Upload port protocol, e.g: serial
quiet (bool or NoneType) – Run in silent mode, show only monitor input and output.
board_options (dict or NoneTYpe) – Board options
raw (bool or NoneType) – Set terminal in raw mode (unbuffered).
timestamp (bool or NoneType) – Timestamp each incoming line.
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.outdated
pyduinocli.commands.sketch
- class pyduinocli.commands.sketch.SketchCommand(base_args)
This class wraps the call to the
sketch
command ofarduino-cli
.- archive(sketch_path='.', archive_path=None, include_build_dir=None, overwrite=None)
Calls the
sketch archive
command- Parameters:
sketch_path (str) – The path to the sketch to archive
archive_path (str or NoneType) – The path of the output archive
include_build_dir (bool or NoneType) – Includes the build directory in the archive
overwrite (bool or NoneType) – Overwrites an already existing archive
- Returns:
The output of the related command
- Return type:
dict
- new(name, overwrite=None)
Calls the
sketch new
command- Parameters:
name (str) – The name of the sketch to create
overwrite (bool or NoneType) – Overwrites an existing .ino sketch.
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.update
pyduinocli.commands.upgrade
- class pyduinocli.commands.upgrade.UpgradeCommand(base_args)
This class wraps the call to the
upgrade
command ofarduino-cli
.- __call__(run_post_install=None, skip_post_install=None, run_pre_uninstall=None, skip_pre_uninstall=None)
Calls the
upgrade
command- Parameters:
run_post_install (bool or NoneType) – Force run of post-install scripts
skip_post_install (bool or NoneType) – Force skip of post-install scripts
run_pre_uninstall (bool or NoneType) – Force run of pre-uninstall scripts (if the CLI is not running interactively).
skip_pre_uninstall (bool or NoneType) – Force skip of pre-uninstall scripts (if the CLI is running interactively).
- Returns:
The output of the related command
- Return type:
dict
pyduinocli.commands.upload
- class pyduinocli.commands.upload.UploadCommand(base_args)
This class wraps the call to the
upload
command ofarduino-cli
.- __call__(sketch=None, fqbn=None, input_dir=None, input_file=None, port=None, verify=None, programmer=None, discovery_timeout=None, protocol=None, board_options=None, profile=None, upload_fields=None, verbose=None)
Calls the
upload
command- Parameters:
sketch (str or NoneType) – The sketch to upload, cap be the full path or just the name
fqbn (str or NoneType) – The fully qualified board name of the target board
input_dir (str or NoneType) – A path containing the binaries to upload
input_file (str or NoneType) – A path to the binary file to upload
port (str or NoneType) – The upload port e.g.: COM10 or /dev/ttyACM0
verify (bool or NoneType) – Verify the uploaded binary after the upload
programmer (str or NoneType) – Programmer to use for the upload process
discovery_timeout (str or NoneType) – Max time to wait for port discovery, e.g.: 30s, 1m (default 5s)
protocol (str or NoneType) – Upload port protocol, e.g: serial
board_options (dict or NoneTYpe) – Board options
profile (str or NoneType) – Sketch profile to use
verbose (bool or NoneType) – Optional, turns on verbose mode.
upload_fields (dict or NoneType) – Sets values for fields required to upload
- Returns:
The output of the related command
- Return type:
dict