Commit Graph
17 Commits
Author SHA1 Message Date
David Lechner 5330821a96 pybricksMicropython: use new PythonError type property
This was introduced in Pyodide 0.22 and saves us from having to parse
the message for the type.

Could also affect https://github.com/pybricks/support/issues/772 (but
there is no known reproducible case to check it).
2023-01-04 11:20:52 -06:00
David Lechner e153ffe295 pybricksMicropython: fix import completion for user module
The pybricks_jedi package was filtering on only pybricks modules but
now has a feature to amend the filter to include user modules.

Fixes: https://github.com/pybricks/support/issues/759
2022-12-28 17:04:23 -06:00
David Lechner bb2fa3ae1d package: switch to @pybricks/python-program-analysis
The package we were using was only for Python 3.4 and didn't include
async/await which broke imports in any script that used async/await.

Fixes: https://github.com/pybricks/support/issues/873
2022-12-22 13:21:02 -06:00
David Lechner f083ad84ef pybricksMicropython/lib: log parser errors
This makes it easier for users to diagnose errors.

Issue: https://github.com/pybricks/support/issues/873
2022-12-22 13:21:02 -06:00
David Lechner d8b8672793 pybricksMicropython/python-worker: consolidate loadPackage
The pyodide.loadPackage() method can take an array arg, so we don't
have to call it multiple times.
2022-11-08 13:56:38 -06:00
David Lechner ed8394bf84 pybricksMicropython/lib: handle exceptions when parsing
The new code parsing library raises exceptions when there are syntax
errors, so this needs to be handled.

Fixes: https://github.com/pybricks/support/issues/755
2022-10-25 11:50:06 -05:00
David Lechner cc37548e36 pybricksMicropython/lib: replace parser
This replaces the Python parsing library. The python-ast package has
really poor performance (many seconds to parse a 500 line file). The
new package can parse a file about 100 times faster.
2022-10-24 15:29:17 -05:00
David Lechner be9272ca9c pybricksMicropython: implement appending imports
This implements appending compiled imported modules for the multi-mpy6
file format.
2022-10-19 18:26:37 -05:00
David Lechner 8b19ad5866 pybricksMicropython: don't allow files with dash
Since we are adding user imports, we need to make sure all file names
are valid module names, so this means we can't use a dash.
2022-10-19 18:26:37 -05:00
6c373c302c build(deps): bump pyodide from 0.21.2 to 0.21.3 (#1144)
* build(deps): bump pyodide from 0.21.2 to 0.21.3

Bumps [pyodide](https://github.com/pyodide/pyodide) from 0.21.2 to 0.21.3.
- [Release notes](https://github.com/pyodide/pyodide/releases)
- [Commits](https://github.com/pyodide/pyodide/compare/0.21.2...0.21.3)

---
updated-dependencies:
- dependency-name: pyodide
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* update patch for pyodide 0.21.3

* make use of new pyodide version export

* fix breaking change in loadPyodide indexURL

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-17 18:05:44 +00:00
David Lechner 7e2404d583 pybricksMicropython: add support for peer file code completion
This allows importing user-created files and getting code completion
for those imports. This is done by mirroring the dexie-based file
system used by the editor to the emscripten based file system used
by pyodide. In the future, ideally we would have some sort of shared
file system, but this works for now.

Note: completing `from ` doesn't list user files/modules because of
filters in the pybricks-jedi python package but completing
`from my_file import ` does work as expected.
2022-09-13 14:19:29 -05:00
David Lechner 76462a0f4a python-worker: enable offline use
This makes the required changes to use Pyodide and Python packages
offline and use a fixed version of the Python packages instead of
fetching the latest from PyPI.

There were a number of issues encountered with Pyodide webpack
compatibility that were fixed using `yarn patch`:
- https://github.com/pyodide/pyodide/pull/3080
- https://github.com/pyodide/pyodide/pull/3085
- https://github.com/pyodide/pyodide/issues/3086
- https://github.com/pyodide/pyodide/issues/3087

Issue: https://github.com/pybricks/pybricks-code/issues/932
2022-09-08 13:43:00 -05:00
David Lechner 096eea7077 editor: add basic intellisense
This adds basic intellisense for code completion and function signatures
using the Python `jedi` package running in a Pyodide environment.
2022-06-24 19:15:32 -05:00
David Lechner 1802bcf796 explorer: push file name validation to parents
This gets rid of the weird unknown state and other problems of trying
to push state from a child back to a parent.
2022-03-19 18:21:00 -05:00
David Lechner d8f958d18e explorer: implement file renaming 2022-03-12 14:45:06 -06:00
David Lechner 7b095765ac pybricksMicropython/lib: add pythonFileExtensionRegex
This can be reused in code to work with file names.
2022-03-11 15:41:16 -06:00
David Lechner e36a30de4c pybricksMicropython/lib: add module
This creates a new module for dealing with stuff specific to Pybricks
MicroPython.
2022-03-11 15:41:16 -06:00