blueloveTH 6 mesi fa
parent
commit
8598b44bee
5 ha cambiato i file con 30 aggiunte e 17 eliminazioni
  1. 2 0
      README.md
  2. 4 17
      docs/features/debugging.md
  3. 23 0
      docs/features/profiling.md
  4. 1 0
      docs/index.md
  5. BIN
      docs/static/profiler_demo.png

+ 2 - 0
README.md

@@ -32,6 +32,8 @@ Please see https://pocketpy.dev for details and try the following resources.
 + [Live Python Demo](https://pocketpy.dev/static/web/): Run Python code in your browser
 + [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
 + [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
++ [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
++ [Flutter Plugin](https://pub.dev/packages/pocketpy): Use pocketpy in Flutter apps
 
 ## Supported Platforms
 

+ 4 - 17
docs/features/debugging.md

@@ -1,24 +1,11 @@
 ---
 icon: dot
 title: Debugging
+order: 80
 ---
 
-!!!
-This feature is not available in `v2.0` yet.
-!!!
+## VSCode Extension
 
-You can invoke `breakpoint()` in your python code to start a PDB-like session.
+You can install our VSCode extension to debug pocketpy scripts.
 
-The following commands are supported:
-
-+ `h, help`: show this help message
-+ `q, quit`: exit the debugger
-+ `n, next`: execute next line
-+ `s, step`: step into
-+ `w, where`: show current stack frame
-+ `c, continue`: continue execution
-+ `a, args`: show local variables
-+ `l, list`: show lines around current line
-+ `ll, longlist`: show all lines
-+ `p, print <expr>`: evaluate expression
-+ `!, execute statement`: execute statement
+https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy

+ 23 - 0
docs/features/profiling.md

@@ -0,0 +1,23 @@
+---
+icon: dot
+title: Profiling
+order: 79
+---
+
+To profile your pocketpy scripts, you can run `main.exe` with `--profile` flag.
+
+For example, to profile `test/test_math.py`, run
+
+```
+main.exe --profile test/test_math.py
+```
+
+This will output a JSON report file named `profile_report.json` in the current directory,
+which records the time spent for each line. To visualize the report, please install our VSCode extension.
+
+https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy
+
+With pocketpy VSCode extension, press `F1` and type `pocketpy: Load Line Profiler Report`,
+select `profile_report.json` and you will see a nice visualization of the profiling result.
+
+![lp](../static/profiler_demo.png)

+ 1 - 0
docs/index.md

@@ -13,6 +13,7 @@ Developers are able to write Python bindings via C-API or pybind11 compatible in
 + [Live Python Demo](https://pocketpy.dev/static/web/): Run Python code in your browser
 + [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
 + [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
++ [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
 + [Flutter Plugin](https://pub.dev/packages/pocketpy): Use pocketpy in Flutter apps
 
 ## What it looks like

BIN
docs/static/profiler_demo.png