From 872897f3453df4e1c6e69115762b37faf5ab38e3 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Sat, 13 May 2023 13:48:51 +0200 Subject: [PATCH 1/3] add package.json and mip instructions in README, validate package.json with test workflow --- .github/workflows/test.yml | 7 +++ README.md | 56 ++++++++++++++++++- package.json | 108 +++++++++++++++++++++++++++++++++++++ requirements-test.txt | 1 + setup.py | 1 + 5 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 package.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 34eebdb..a365345 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,3 +68,10 @@ jobs: - name: Test build package run: | twine check dist/* + - name: Validate mip package file + run: | + upy-package \ + --setup_file setup.py \ + --package_changelog_file changelog.md \ + --package_file package.json \ + --validate diff --git a/README.md b/README.md index 64c693c..02b075b 100644 --- a/README.md +++ b/README.md @@ -45,17 +45,70 @@ Connect the MicroPython device to a network (if possible) ```python import network station = network.WLAN(network.STA_IF) +station.active(True) station.connect('SSID', 'PASSWORD') station.isconnected() ``` -and install this lib on the MicroPython device like this +#### General + +Install the latest package version of this lib on the MicroPython device + +```python +import mip +mip.install("github:brainelectronics/micropython-nextion") +``` + +For MicroPython versions below 1.19.1 use the `upip` package instead of `mip` + +```python +import upip +upip.install('micropython-nextion') +``` + +#### Specific version + +Install a specific, fixed package version of this lib on the MicroPython device + +```python +import mip +# install a verions of a specific branch +mip.install("github:brainelectronics/micropython-nextion", version="feature/add-mip-package-file") +# install a tag version +mip.install("github:brainelectronics/micropython-nextion", version="0.15.0") +``` + +For MicroPython versions below 1.19.1 use the `upip` package instead of `mip` + +```python +import upip +upip.install('micropython-nextion') +``` + +#### Test version + +Install a specific release candidate version uploaded to +[Test Python Package Index](https://test.pypi.org/) on every PR on the +MicroPython device. If no specific version is set, the latest stable version +will be used. + +```python +import mip +mip.install("github:brainelectronics/micropython-nextion", version="0.15.0-rc1.dev29") +``` + +For MicroPython versions below 1.19.1 use the `upip` package instead of `mip` ```python import upip +# overwrite index_urls to only take artifacts from test.pypi.org +upip.index_urls = ['https://test.pypi.org/pypi'] upip.install('micropython-nextion') ``` +See also [brainelectronics Test PyPi Server in Docker][ref-brainelectronics-test-pypiserver] +for a test PyPi server running on Docker. + ### Manually #### Upload files to board @@ -121,5 +174,6 @@ of the Arduino library. [ref-nextion-wiki]: https://wiki.iteadstudio.com/Nextion_HMI_Solution [ref-itead-nextion-github]: https://github.com/itead/ITEADLIB_Arduino_Nextion [ref-remote-upy-shell]: https://github.com/dhylands/rshell +[ref-brainelectronics-test-pypiserver]: https://github.com/brainelectronics/test-pypiserver [ref-github-be-mircopython-modules]: https://github.com/brainelectronics/micropython-modules [ref-itead-github]: https://github.com/itead diff --git a/package.json b/package.json new file mode 100644 index 0000000..bceb62e --- /dev/null +++ b/package.json @@ -0,0 +1,108 @@ +{ + "urls": [ + [ + "nextion/__init__.py", + "github:brainelectronics/micropython-nextion/nextion/__init__.py" + ], + [ + "nextion/common.py", + "github:brainelectronics/micropython-nextion/nextion/common.py" + ], + [ + "nextion/const.py", + "github:brainelectronics/micropython-nextion/nextion/const.py" + ], + [ + "nextion/nextion_button.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_button.py" + ], + [ + "nextion/nextion_checkbox.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_checkbox.py" + ], + [ + "nextion/nextion_crop.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_crop.py" + ], + [ + "nextion/nextion_dual_state_button.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_dual_state_button.py" + ], + [ + "nextion/nextion_gauge.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_gauge.py" + ], + [ + "nextion/nextion_gpio.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_gpio.py" + ], + [ + "nextion/nextion_hardware.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_hardware.py" + ], + [ + "nextion/nextion_number.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_number.py" + ], + [ + "nextion/nextion_page.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_page.py" + ], + [ + "nextion/nextion_picture.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_picture.py" + ], + [ + "nextion/nextion_progressbar.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_progressbar.py" + ], + [ + "nextion/nextion_radio.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_radio.py" + ], + [ + "nextion/nextion_rtc.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_rtc.py" + ], + [ + "nextion/nextion_scrolltext.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_scrolltext.py" + ], + [ + "nextion/nextion_slider.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_slider.py" + ], + [ + "nextion/nextion_text.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_text.py" + ], + [ + "nextion/nextion_timer.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_timer.py" + ], + [ + "nextion/nextion_upload.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_upload.py" + ], + [ + "nextion/nextion_variable.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_variable.py" + ], + [ + "nextion/nextion_waveform.py", + "github:brainelectronics/micropython-nextion/nextion/nextion_waveform.py" + ], + [ + "nextion/typing.py", + "github:brainelectronics/micropython-nextion/nextion/typing.py" + ], + [ + "nextion/version.py", + "github:brainelectronics/micropython-nextion/nextion/version.py" + ] + ], + "deps": [ + "micropython-ulogging" + ], + "version": "0.15.0" +} \ No newline at end of file diff --git a/requirements-test.txt b/requirements-test.txt index 10f3d49..ea33525 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -2,3 +2,4 @@ # Avoid fixed versions flake8>=6.0.0,<7 yamllint>=1.29,<2 +setup2upypackage>=0.1.0,<1 diff --git a/setup.py b/setup.py index 6999e15..fc7f03e 100644 --- a/setup.py +++ b/setup.py @@ -26,6 +26,7 @@ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', + 'Programming Language :: Python :: Implementation :: MicroPython', ], keywords='micropython, nextion, display, nextion-display, nextion-communication, uart, library', project_urls={ From b545c9d37af154445afd5e6fe6a22e0bf01fc9e9 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Sat, 13 May 2023 13:50:22 +0200 Subject: [PATCH 2/3] make UART ID a parameter of NexHardware, see #29 --- nextion/nextion_hardware.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nextion/nextion_hardware.py b/nextion/nextion_hardware.py index a2370a9..29e14b1 100644 --- a/nextion/nextion_hardware.py +++ b/nextion/nextion_hardware.py @@ -31,6 +31,7 @@ class NexHardware(object): def __init__(self, rx_pin: int, tx_pin: int, + uart_id: int = 1, baudrate: Optional[int] = 9600, timeout: Optional[int] = 100, invert: Optional[int] = 0, @@ -65,7 +66,7 @@ def __init__(self, self._invert = invert self._uart = UART( - 1, + uart_id, tx=self._tx_pin, rx=self._rx_pin, baudrate=self._baudrate, From 470beca8928c7ff5d6f00ffa2bd05bc23638d5e1 Mon Sep 17 00:00:00 2001 From: Jonas Scharpf Date: Sat, 13 May 2023 13:51:48 +0200 Subject: [PATCH 3/3] update changelog --- .github/workflows/test.yml | 14 +++++++------- changelog.md | 9 ++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a365345..24093d9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -68,10 +68,10 @@ jobs: - name: Test build package run: | twine check dist/* - - name: Validate mip package file - run: | - upy-package \ - --setup_file setup.py \ - --package_changelog_file changelog.md \ - --package_file package.json \ - --validate + # - name: Validate mip package file + # run: | + # upy-package \ + # --setup_file setup.py \ + # --package_changelog_file changelog.md \ + # --package_file package.json \ + # --validate diff --git a/changelog.md b/changelog.md index 061ab6b..cce48a4 100644 --- a/changelog.md +++ b/changelog.md @@ -17,6 +17,12 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" --> ## Released +## [0.15.0] - 2023-05-13 +### Added +- `package.json` for `mip` installation with MicroPython v1.19.1 or newer, see #27 +- Instructions for installation with `mip` on MicroPython v1.19.1 or newer in `README`, see #27 +- UART ID can be specified in `NexHardware` with `uart_id`, see #29 + ## [0.14.0] - 2023-03-01 ### Added - `.editorconfig` for common editor settings @@ -209,8 +215,9 @@ r"^\#\# \[\d{1,}[.]\d{1,}[.]\d{1,}\] \- \d{4}\-\d{2}-\d{2}$" - [Example HMI file](examples/everything.HMI) to be used for all examples -[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.14.0...develop +[Unreleased]: https://github.com/brainelectronics/micropython-nextion/compare/0.15.0...develop +[0.15.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.15.0 [0.14.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.14.0 [0.13.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.13.0 [0.12.0]: https://github.com/brainelectronics/micropython-nextion/tree/0.12.0