From bf6831e3c9052f40864c7fdf14f39befa95107b7 Mon Sep 17 00:00:00 2001 From: Stefan Wehr Date: Mon, 4 Nov 2024 19:11:36 +0100 Subject: [PATCH 1/6] version bump and changelog for 1.2.0 --- ChangeLog.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 57e7708c..d423a46b 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,9 @@ # Write Your Python Program - CHANGELOG +* 1.2.0 (2024-11-04) + * Support for visualization + * Fix handling of lazy annotations in records + * Fix output of execution fails but some tests were successful * 1.1.0 (2024-10-02) * Improve invocation on windows, always use cmd.exe * Fixed bugs #132, #133, #134, and #135 diff --git a/package.json b/package.json index 8acd7be4..c93bd42e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Write Your Python Program!", "description": "A user friendly python environment for beginners", "license": "See license in LICENSE", - "version": "1.1.0", + "version": "1.2.0", "publisher": "StefanWehr", "icon": "icon.png", "engines": { From be6fabc0a73121ab3dfb158f7cb1cad53f0c7055 Mon Sep 17 00:00:00 2001 From: Hannes Braun Date: Mon, 4 Nov 2024 19:14:09 +0100 Subject: [PATCH 2/6] Remove min-height from visualization containers --- src/programflow-visualization/frontend/resources/webview.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/programflow-visualization/frontend/resources/webview.css b/src/programflow-visualization/frontend/resources/webview.css index 4f8046f5..fa729591 100644 --- a/src/programflow-visualization/frontend/resources/webview.css +++ b/src/programflow-visualization/frontend/resources/webview.css @@ -18,7 +18,6 @@ body { .floating-right-content { width: 65%; padding: 10px; - min-height: 450px; max-height: 90%; } @@ -31,7 +30,6 @@ body { width: 35%; padding: 10px; max-height: 90%; - min-height: 450px; margin-right: 100px; } From a5d0399e1b947acdacd14218b3b2a862e8ce7362 Mon Sep 17 00:00:00 2001 From: Hannes Braun Date: Mon, 4 Nov 2024 20:13:54 +0100 Subject: [PATCH 3/6] Fix bundling of visualization assets --- .../programflow-visualization}/leader-line.min.js | 0 .../programflow-visualization}/webview.css | 0 .../programflow-visualization}/webview.js | 0 package-lock.json | 7 ------- package.json | 1 - .../frontend/visualization_panel.ts | 2 +- 6 files changed, 1 insertion(+), 9 deletions(-) rename {src/programflow-visualization/frontend/resources => media/programflow-visualization}/leader-line.min.js (100%) rename {src/programflow-visualization/frontend/resources => media/programflow-visualization}/webview.css (100%) rename {src/programflow-visualization/frontend/resources => media/programflow-visualization}/webview.js (100%) diff --git a/src/programflow-visualization/frontend/resources/leader-line.min.js b/media/programflow-visualization/leader-line.min.js similarity index 100% rename from src/programflow-visualization/frontend/resources/leader-line.min.js rename to media/programflow-visualization/leader-line.min.js diff --git a/src/programflow-visualization/frontend/resources/webview.css b/media/programflow-visualization/webview.css similarity index 100% rename from src/programflow-visualization/frontend/resources/webview.css rename to media/programflow-visualization/webview.css diff --git a/src/programflow-visualization/frontend/resources/webview.js b/media/programflow-visualization/webview.js similarity index 100% rename from src/programflow-visualization/frontend/resources/webview.js rename to media/programflow-visualization/webview.js diff --git a/package-lock.json b/package-lock.json index 5f77e805..50e2124e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "See license in LICENSE", "dependencies": { "@types/node": "^18.11.13", - "leader-line": "^1.0.7", "stringify-json": "^2.0.0", "tmp": "^0.2.3", "ts-md5": "^1.3.1" @@ -1836,12 +1835,6 @@ "json-buffer": "3.0.1" } }, - "node_modules/leader-line": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/leader-line/-/leader-line-1.0.7.tgz", - "integrity": "sha512-PhJpQLV7XychSIuGPD0TEqR9PgRYBbrhReaOcmHFOVtTw4dWKfUMAtOb7UP7xTsoib6sFzq2giQeOUHy7LCuJQ==", - "license": "MIT" - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", diff --git a/package.json b/package.json index 8acd7be4..7a001186 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,6 @@ }, "dependencies": { "@types/node": "^18.11.13", - "leader-line": "^1.0.7", "stringify-json": "^2.0.0", "tmp": "^0.2.3", "ts-md5": "^1.3.1" diff --git a/src/programflow-visualization/frontend/visualization_panel.ts b/src/programflow-visualization/frontend/visualization_panel.ts index 5d564fd9..f4a6c076 100644 --- a/src/programflow-visualization/frontend/visualization_panel.ts +++ b/src/programflow-visualization/frontend/visualization_panel.ts @@ -5,7 +5,7 @@ import { HTMLGenerator } from './HTMLGenerator'; import { MessagePort } from 'worker_threads'; import { cacheTrace } from '../trace_cache'; -const FRONTEND_RESOURCE_PATH = 'src/programflow-visualization/frontend/resources'; +const FRONTEND_RESOURCE_PATH = 'media/programflow-visualization'; export class VisualizationPanel { private _panel: vscode.WebviewPanel | undefined; From 730a3510ff16665140f84d224849c3a7d76b0bf5 Mon Sep 17 00:00:00 2001 From: Stefan Wehr Date: Fri, 15 Nov 2024 08:19:00 +0100 Subject: [PATCH 4/6] fix bug with union of union --- python/deps/untypy/untypy/impl/union.py | 2 +- python/fileTests | 1 + python/test-data/testUnionOfUnion.err | 0 python/test-data/testUnionOfUnion.out | 3 +++ python/test-data/testUnionOfUnion.py | 31 +++++++++++++++++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 python/test-data/testUnionOfUnion.err create mode 100644 python/test-data/testUnionOfUnion.out create mode 100644 python/test-data/testUnionOfUnion.py diff --git a/python/deps/untypy/untypy/impl/union.py b/python/deps/untypy/untypy/impl/union.py index ca1a1d26..b6c973e1 100644 --- a/python/deps/untypy/untypy/impl/union.py +++ b/python/deps/untypy/untypy/impl/union.py @@ -71,7 +71,7 @@ def describe(self) -> str: def base_type(self) -> list[Any]: out = [] for checker in self.inner: - out.append(checker.base_type()) + out.extend(checker.base_type()) return out diff --git a/python/fileTests b/python/fileTests index 4aeb3db8..3279f251 100755 --- a/python/fileTests +++ b/python/fileTests @@ -287,6 +287,7 @@ checkWithOutputAux yes 0 test-data/testUnion3.py checkWithOutputAux yes 1 test-data/testLiteral1.py checkWithOutputAux yes 0 test-data/testForwardTypeInRecord.py checkWithOutputAux yes 0 test-data/testForwardTypeInRecord2.py +checkWithOutputAux yes 0 test-data/testUnionOfUnion.py function is_min_version() { diff --git a/python/test-data/testUnionOfUnion.err b/python/test-data/testUnionOfUnion.err new file mode 100644 index 00000000..e69de29b diff --git a/python/test-data/testUnionOfUnion.out b/python/test-data/testUnionOfUnion.out new file mode 100644 index 00000000..9a696cf6 --- /dev/null +++ b/python/test-data/testUnionOfUnion.out @@ -0,0 +1,3 @@ +pizza: Napoli +noodles: Penne +beer: Export diff --git a/python/test-data/testUnionOfUnion.py b/python/test-data/testUnionOfUnion.py new file mode 100644 index 00000000..12fbc4c5 --- /dev/null +++ b/python/test-data/testUnionOfUnion.py @@ -0,0 +1,31 @@ +from wypp import * + +@record +class Pizza: + nameP: str + +@record +class Noodles: + nameN: str + +type Food = Union[Pizza, Noodles] + +@record +class Beer: + nameB: str + +type All = Union[Food, Beer] + +def foo(a: All): + if isinstance(a, Pizza): + print(f'pizza: {a.nameP}') + elif isinstance(a, Noodles): + print(f'noodles: {a.nameN}') + elif isinstance(a, Beer): + print(f'beer: {a.nameB}') + else: + impossible() + +foo(Pizza('Napoli')) +foo(Noodles('Penne')) +foo(Beer('Export')) From 746658bfbe7d86357db9a0ecd8610d65156505ad Mon Sep 17 00:00:00 2001 From: Stefan Wehr Date: Fri, 15 Nov 2024 08:20:10 +0100 Subject: [PATCH 5/6] version bump and changelog for 1.2.1 --- ChangeLog.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index d423a46b..0fa5d933 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,7 @@ # Write Your Python Program - CHANGELOG +* 1.2.1 (2024-11-05) + * Fix assets for visualization * 1.2.0 (2024-11-04) * Support for visualization * Fix handling of lazy annotations in records diff --git a/package.json b/package.json index ff506fe4..eb95456d 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Write Your Python Program!", "description": "A user friendly python environment for beginners", "license": "See license in LICENSE", - "version": "1.2.0", + "version": "1.2.1", "publisher": "StefanWehr", "icon": "icon.png", "engines": { From ea5f25a93c7f062a373fd43770b40cdecacdba2a Mon Sep 17 00:00:00 2001 From: Stefan Wehr Date: Fri, 15 Nov 2024 08:20:29 +0100 Subject: [PATCH 6/6] changelog --- ChangeLog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 0fa5d933..0fb7c6fe 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,7 @@ # Write Your Python Program - CHANGELOG +* ? (?) + * Fix bug with union of unions * 1.2.1 (2024-11-05) * Fix assets for visualization * 1.2.0 (2024-11-04)