mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
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
This commit is contained in:
committed by
David Lechner
parent
a77acc1001
commit
bb2fa3ae1d
@@ -10,7 +10,11 @@
|
||||
### Changed
|
||||
- Changed app display from "fullscreen" to "standalone" ([support#867]).
|
||||
|
||||
### Fixed
|
||||
- Fixed imports in scripts that use `async` or `await` keywords ([support#873]).
|
||||
|
||||
[support#867]: https://github.com/pybricks/support/issues/867
|
||||
[support#873]: https://github.com/pybricks/support/issues/873
|
||||
|
||||
## [2.0.1] - 2022-12-21
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
"@pybricks/jedi": "1.6.0",
|
||||
"@pybricks/mpy-cross-v5": "^2.0.0",
|
||||
"@pybricks/mpy-cross-v6": "^2.0.0",
|
||||
"@qoretechnologies/python-parser": "^0.4.10",
|
||||
"@pybricks/python-program-analysis": "^1.0.1",
|
||||
"@reduxjs/toolkit": "^1.9.1",
|
||||
"@shopify/react-i18n": "^7.5.1",
|
||||
"@svgr/webpack": "^6.5.1",
|
||||
|
||||
@@ -131,3 +131,18 @@ from q import q
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test('https://github.com/pybricks/support/issues/873 regression', () => {
|
||||
const script = `
|
||||
from my_module import data
|
||||
|
||||
async def hello():
|
||||
print("hello")
|
||||
|
||||
print(data)
|
||||
`;
|
||||
|
||||
const modules = findImportedModules(script);
|
||||
|
||||
expect(modules).toEqual(new Set(['my_module']));
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2022 The Pybricks Authors
|
||||
|
||||
import { parse, walk } from '@qoretechnologies/python-parser';
|
||||
import { parse, walk } from '@pybricks/python-program-analysis';
|
||||
import type { FileContents, FileStorageDb } from '../fileStorage';
|
||||
|
||||
/** The Python file extension ('.py') */
|
||||
@@ -99,7 +99,7 @@ export function findImportedModules(py: string): ReadonlySet<string> {
|
||||
});
|
||||
} catch (err) {
|
||||
// istanbul ignore if
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
|
||||
@@ -2418,7 +2418,7 @@ __metadata:
|
||||
"@pybricks/jedi": 1.6.0
|
||||
"@pybricks/mpy-cross-v5": ^2.0.0
|
||||
"@pybricks/mpy-cross-v6": ^2.0.0
|
||||
"@qoretechnologies/python-parser": ^0.4.10
|
||||
"@pybricks/python-program-analysis": ^1.0.1
|
||||
"@reduxjs/toolkit": ^1.9.1
|
||||
"@shopify/react-i18n": ^7.5.1
|
||||
"@svgr/webpack": ^6.5.1
|
||||
@@ -2541,12 +2541,12 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@qoretechnologies/python-parser@npm:^0.4.10":
|
||||
version: 0.4.10
|
||||
resolution: "@qoretechnologies/python-parser@npm:0.4.10"
|
||||
"@pybricks/python-program-analysis@npm:^1.0.1":
|
||||
version: 1.0.1
|
||||
resolution: "@pybricks/python-program-analysis@npm:1.0.1"
|
||||
dependencies:
|
||||
lodash: ^4.17.15
|
||||
checksum: ab0d91719a8301b64f9c7fb1a7711721d52d78325abbf0c7c75940a48fd4a3d2b07456c95f8507af19faa333bf87116dd62f18e6c8e76486a57673e3224ac3ee
|
||||
checksum: f34171e8b315b4f81c7f0768ce644c22965e3f9fc2c2514fa6256601e05f2e4c9df0518b2a591ac8455f4d54f48929cd8c741f8751dd6d6e792a2520339ca7bb
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user