Tools API

mini.pkg_tool.setup_py_pkg(project_dir: str) str[source]

Package a py project into a .whl file.

Parameters

project_dir – project file root directory

Returns

the absolute path of the generated .whl file

Return type

str

mini.pkg_tool.install_py_pkg(package_path: str, robot_id: str, debug: bool = False)[source]

Install a py program installation package on the robot with the specified serial number.

Parameters
  • package_path – the absolute path of the installation package

  • robot_id – robot serial number

  • debug – Whether to print the log when pkg is uninstalled on the robot side

Returns

None

mini.pkg_tool.uninstall_py_pkg(pkg_name: str, robot_id: str, debug: bool = False)[source]
Uninstall an installed py program from the robot with the specified serial number. For example, there is a py program whose setup.py file is configured as follows:

setuptools.setup(

name=”tts_demo”,

…#Omitted

),

Then, its pkg_name is “tts_demo”.

Parameters
  • pkg_name – program name

  • robot_id – robot serial number

  • debug – Whether to print the log when pkg is uninstalled on the robot side

Returns

None

mini.pkg_tool.query_py_pkg(pkg_name: str, robot_id: str) str[source]

Query the py program specified by pkg_name on the robot, and its detailed information, for example, there is a py program, and its setup.py file is configured as follows:

setuptools.setup(

name=”tts_demo”,

version=”0.0.2”,

author=’Gino Deng’,

author_email=’jingjing.deng@ubtrobot.com’,

description=”demo with mini_sdk”,

long_description=’demo with mini_sdk,xxxxxxx’,

long_description_content_type=”text/markdown”,

license=”GPLv3”,

packages=setuptools.find_packages(),

classifiers=[

“Programming Language :: Python :: 3”,

“Programming Language :: Python :: 3.6”,

“Programming Language :: Python :: 3.7”,

“Programming Language :: Python :: 3.8”,

“License :: OSI Approved :: MIT License”,

“Operating System :: OS Independent”,

],

install_requires=[

‘alphamini’,

],

),

When querying, specify pkg_name=”tts_demo”, and the returned information is as follows:

Name: tts-demo

Version: 0.0.2

Summary: demo with mini_sdk

Home-page: UNKNOWN

Author: Gino Deng

Author-email: jingjing.deng@ubtrobot.com

License: GPLv3

Location: /data/data/com.termux/files/usr/lib/python3.8/site-packages

Requires: alphamini

Required-by:

Parameters
  • pkg_name – py program name,

  • robot_id – robot serial number

Returns

install package trust information

Return type

str

mini.pkg_tool.list_py_pkg(robot_id: str) str[source]

List the py programs installed on the robot, for example:

Package Version

———- ——-

alphamini 0.1.0

ifaddr 0.1.7

pip 20.1.1

protobuf 3.12.2

setuptools 47.3.1

six 1.15.0

tts-demo 0.0.2

websockets 8.1

wheel 0.34.2

Parameters

robot_id – robot serial number

Returns

name of all py programs-version number

Return type

str

mini.pkg_tool.run_py_pkg(entry_point: str, robot_id: str, debug: bool = False)[source]

Trigger a specified py program to run on the specified robot. :

Parameters
  • entry_point – The name of the console scripts of the py program, for example, in the setup.py file,

  • entry_points=( (such as configuration) –

    ‘console_scripts’: [

    ‘XXX = Packages.Modules:XXX’

    ],

    }, the program entry name is xxx

  • robot_id – robot serial number

  • debug – Whether to return the log when the program is executed

Returns

None

mini.pkg_tool.switch_adb(robot_id: str, switch: bool = True)[source]

Turn on the robot ADB debugging switch :param switch: bool, True or False :param robot_id: robot serial number

Returns

None

mini.pkg_tool.upload_script(cmd_id: int, robot_id: str, file_name: Optional[str] = None, content: Optional[bytes] = None)[source]