Open main menu

DAVE Developer's Wiki β

Changes

DESK-MX6UL-AN-0004: Using Python for Embedded applications

4,194 bytes added, 11:08, 7 October 2021
easy install
</pre>
On top of that, some web packages are very useful for creating web application applications and remotely control/get information from the gatewayas '''[https://pypi.org/project/fastapi/ fastapi]''' (high-performance web framework): <pre class="board-terminal">root@desk-mx6ul-axelulite:~# easy3_install fastapiSearching for fastapiReading https://pypi.python.org/simple/fastapi/Downloading https://files.pythonhosted.org/packages/92/a8/10d8a171afa66e6e8a5cfe82771d11c4c84a2a874c19c0b55c7099001fac/fastapi-0.68.2-py3-none-any.whl#sha256=36bcdd3dbea87c586061005e4a40b9bd0145afd766655b4e0ec1d8870b32555cBest match: fastapi 0.68.2Processing fastapi-0.68.2-py3-none-any.whlInstalling fastapi-0.68.2-py3-none-any.whl to /usr/lib/python3.5/site-packageswriting requirements to /usr/lib/python3.5/site-packages/fastapi-0.68.2-py3.5.egg/EGG-INFO/requires.txtAdding fastapi 0.68.2 to easy-install.pth file Installed /usr/lib/python3.5/site-packages/fastapi-0.68.2-py3.5.eggProcessing dependencies for fastapiSearching for starlette==0.14.2Reading https://pypi.python.org/simple/starlette/Downloading https://files.pythonhosted.org/packages/15/34/db1890f442a1cd3a2c761f4109a0eb4e63503218d70a8c8e97faa09a5500/starlette-0.14.2-py3-none-any.whl#sha256=3c8e48e52736b3161e34c9f0e8153b4f32ec5d8995a3ee1d59410d92f75162edBest match: starlette 0.14.2Processing starlette-0.14.2-py3-none-any.whlInstalling starlette-0.14.2-py3-none-any.whl to /usr/lib/python3.5/site-packageswriting requirements to /usr/lib/python3.5/site-packages/starlette-0.14.2-py3.5.egg/EGG-INFO/requires.txtAdding starlette 0.14.2 to easy-install.pth file Installed /usr/lib/python3.5/site-packages/starlette-0.14.2-py3.5.eggSearching for pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2Reading https://pypi.python.org/simple/pydantic/Downloading https://files.pythonhosted.org/packages/ff/74/54e030641601112309f6d2af620774e9080f99c7a15742fc6a0b170c4076/pydantic-1.8.2-py3-none-any.whl#sha256=fec866a0b59f372b7e776f2d7308511784dace622e0992a0b59ea3ccee0ae833Best match: pydantic 1.8.2Processing pydantic-1.8.2-py3-none-any.whlInstalling pydantic-1.8.2-py3-none-any.whl to /usr/lib/python3.5/site-packageswriting requirements to /usr/lib/python3.5/site-packages/pydantic-1.8.2-py3.5.egg/EGG-INFO/requires.txtAdding pydantic 1.8.2 to easy-install.pth file Installed /usr/lib/python3.5/site-packages/pydantic-1.8.2-py3.5.eggSearching for typing-extensions>=3.7.4.3Reading https://pypi.python.org/simple/typing-extensions/Downloading https://files.pythonhosted.org/packages/74/60/18783336cc7fcdd95dae91d73477830aa53f5d3181ae4fe20491d7fc3199/typing_extensions-3.10.0.2-py3-none-any.whl#sha256=f1d25edafde516b146ecd0613dabcc61409817af4766fbbcfb8d1ad4ec441a34Best match: typing-extensions 3.10.0.2Processing typing_extensions-3.10.0.2-py3-none-any.whlInstalling typing_extensions-3.10.0.2-py3-none-any.whl to /usr/lib/python3.5/site-packagesAdding typing-extensions 3.10.0.2 to easy-install.pth file Installed /usr/lib/python3.5/site-packages/typing_extensions-3.10.0.2-py3.5.eggFinished processing dependencies for fastapi root@desk-mx6ul-axelulite:~#</pre> and finally an MQTT client like [http://www.eclipse.org/paho/ Eclipse paho MQTT] is installed too: <pre class="board-terminal">root@desk-mx6ul-axelulite:~# easy3_install paho-mqttSearching for paho-mqttReading https://pypi.python.org/simple/paho-mqtt/Downloading https://files.pythonhosted.org/packages/32/d3/6dcb8fd14746fcde6a556f932b5de8bea8fedcb85b3a092e0e986372c0e7/paho-mqtt-1.5.1.tar.gz#sha256=9feb068e822be7b3a116324e01fb6028eb1d66412bf98595ae72698965cb1caeBest match: paho-mqtt 1.5.1Processing paho-mqtt-1.5.1.tar.gzWriting /tmp/easy_install-vkarrpqi/paho-mqtt-1.5.1/setup.cfgRunning paho-mqtt-1.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vkarrpqi/paho-mqtt-1.5.1/egg-dist-tmp-tt8lku70creating /usr/lib/python3.5/site-packages/paho_mqtt-1.5.1-py3.5.eggExtracting paho_mqtt-1.5.1-py3.5.egg to /usr/lib/python3.5/site-packagesAdding paho-mqtt 1.5.1 to easy-install.pth file Installed /usr/lib/python3.5/site-packages/paho_mqtt-1.5.1-py3.5.eggProcessing dependencies for paho-mqttFinished processing dependencies for paho-mqttroot@desk-mx6ul-axelulite:~#</pre> === pip === It is possible to use <code>pip3</code> for installing other web/API framework like '''[https://bottlepy.org/docs/dev/ bottle]''' (lightweight WSGI micro web-framework), and '''[https://pypiflask.palletsprojects.orgcom/projecten/fastapi2.0.x/ fastapiflask]''' (high-performance web framework). For this task we used <code>pip3</code>:
<pre class="board-terminal">
</pre>
and finally an MQTT client JSON framework like '''[httphttps://www.eclipsepypi.org/pahoproject/ujson/ Eclipse paho MQTTujson] is installed too''':
<pre class="board-terminal">
root@desk-mx6ul-axelulite:~# easy3_install paho-mqttpip3 install ujsonSearching for paho-mqttReading httpsDEPRECATION://pypiPython 3.5 reached the end of its life on September 13th, 2020.pythonPlease upgrade your Python as Python 3.org/simple/paho-mqtt/Downloading https://files5 is no longer maintained.pythonhostedpip 21.org/packages/32/d3/6dcb8fd14746fcde6a556f932b5de8bea8fedcb85b3a092e0e986372c0e7/paho-mqtt-10 will drop support for Python 3.5in January 2021.1pip 21.tar0 will remove support for this functionality.gz#sha256=9feb068e822be7b3a116324e01fb6028eb1d66412bf98595ae72698965cb1caeBest match: paho-mqtt 1.5.1Collecting ujsonProcessing paho Downloading ujson-mqtt-13.52.10.tar.gz(7.1 MB)Writing |################################| 7.1 MB 21 kB/tmp/easy_install-vkarrpqi/paho-mqtt-1s Installing build dependencies .5.1/setup.cfgdoneRunning paho-mqtt-1 Getting requirements to build wheel ..5.1/setupdone Preparing wheel metadata .py -q bdist_egg --dist-dir /tmp/easy_install-vkarrpqi/paho-mqtt-1.5.1/egg-dist-tmp-tt8lku70donecreating /usr/lib/python3.5/site-Building wheels for collected packages/paho_mqtt-1.5: ujson Building wheel for ujson (PEP 517) .1-py3.5.eggdoneExtracting paho_mqtt Created wheel for ujson: filename=ujson-13.52.10-cp35-cp35m-py3linux_armv7l.5.egg to whl size=168783 sha256=69ee66de3fdd504505c0b3bd0e6e9b54cc322a93374c50eec92b18077523b3d3 Stored in directory: /usrhome/libroot/python3.5cache/pip/site-packagesAdding paho-mqtt 1.5.1 to easy-install.pth file Installed wheels/usrd7/libf5/python3.5ae/site-ca9a177378cfd568da6585bf3f10a79d3d577332ef1e3278dbSuccessfully built ujsonInstalling collected packages/paho_mqtt-1.5.1: ujsonSuccessfully installed ujson-py33.52.eggProcessing dependencies for paho-mqttFinished processing dependencies for paho-mqtt0
root@desk-mx6ul-axelulite:~#
</pre>
8,221
edits