Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Commit

Permalink
Adding debugger communication (#113)
Browse files Browse the repository at this point in the history
[PBI:32522 - TASK : 32641]
[BUG FIX : 32634]

* Adding communication with the simulator for debugging session

* Adding an activate play buton sent from the extension when code is running (bug fix)

* Removing "I'm connected" message from client socket connection event

* Updating doc

* Updating requirements.txt

* Addinfg @types/socketio to fix build pipeline

* Updating doc to install python package requests

* Moving constants to constants files

* Renaming communication handlers and removing todos

* Cleaning debug_user_code.py to remove threading and adding connection attempts limits

* Addressing PR comments
  • Loading branch information
Christellah authored Aug 15, 2019
1 parent 3bceb79 commit 5cc4658
Show file tree
Hide file tree
Showing 20 changed files with 698 additions and 61 deletions.
47 changes: 47 additions & 0 deletions ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ This project incorporates components from the projects listed below. The origina
14. Python for Win32 (https://github.com/mhammond/pywin32)
15. Playsound (https://github.com/TaylorSMarks/playsound)
16. pytest (https://docs.pytest.org/en/latest/)
17. Python-Socketio (https://github.com/miguelgrinberg/python-socketio/)
18. Requests (https://github.com/psf/requests)


%% Files from the Python Project NOTICES, INFORMATION, AND LICENSE BEGIN HERE
Expand Down Expand Up @@ -2345,3 +2347,48 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
=============================================
END OF pytest NOTICES, INFORMATION, AND LICENSE


%% Python-Socketio NOTICES, INFORMATION, AND LICENSE BEGIN HERE
=============================================
The MIT License (MIT)

Copyright (c) 2015 Miguel Grinberg

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
=============================================
END OF Python-Socketio NOTICES, INFORMATION, AND LICENSE


%% Requests NOTICES, INFORMATION, AND LICENSE BEGIN HERE
=============================================
Copyright 2018 Kenneth Reitz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================
END OF Requests NOTICES, INFORMATION, AND LICENSE
8 changes: 8 additions & 0 deletions docs/developers-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@

- Run the command in a console : `pip install pywin32`

- Python-Socketio

- Run the command in a console : `pip install python-socketio`

- Requests

- Run the command in a console : `pip install requests`

- VS Code

- Python extension for VS Code (download from VS Code market place)
Expand Down
5 changes: 3 additions & 2 deletions docs/how-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Commands are accessible through :
- Access to auto-completion and Python error flagging
- Output panel for the simulator
- Deploy to the physical device (if correctly formatted)
- Debugger for the simulator
- Device's features :
- NeoPixels
- Buttons (A & B)
Expand All @@ -42,7 +43,6 @@ Commands are accessible through :

- Auto-detect/format the device
- Serial monitor for the device
- Debugger for the simulator
- Device's features
- Sound sensor
- Tones
Expand All @@ -61,4 +61,5 @@ Commands are accessible through :

### Note

\* Sensors currently not supported by the official adafruit_circuit_playground Express library (v2.1.2).
\* Sensors currently not supported by the official adafruit_circuit_playground Express library (v2.1.2).
\** The regular communication is using the stdout and stdin of the Pyhton process. But when you debug your code, it will use a communication over sockets on the port 5678.
2 changes: 2 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ _Note: You need to install all the dependencies in order to use the extension._
- `python -m pip install --upgrade pip`
- `pip install playsound`
- Pywin32 : `pip install pywin32`
- Python-Socketio : `pip install python-socketio`
- Requests : `pip install requests`

## How to use the Extension

Expand Down
4 changes: 3 additions & 1 deletion locales/en/out/constants.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"dialogResponses.help": "I need help",
"dialogResponses.installPython": "Install from python.org",
"dialogResponses.tutorials": "Tutorials on Adafruit",
" error.incorrectFileNameForDevice": "[ERROR] Can\\'t deploy to your Circuit Playground Express device, please rename your file to \"code.py\" or \"main.py\". \n",
"error.debuggingSessionInProgress": "[ERROR] A debugging session is currently in progress, please stop it before running your code. \n",
"error.incorrectFileNameForDevice": "[ERROR] Can\\'t deploy to your Circuit Playground Express device, please rename your file to \"code.py\" or \"main.py\". \n",
"error.incorrectFileNameForDevicePopup": "Seems like you have a different file name than what the CPX requires, please rename it to \"code.py\" or \"main.py\".",
"error.incorrectFileNameForSimulatorPopup": "We want your code to work on your actual board as well. Make sure you name your file \"code.py\" or \"main.py\" to be able to run your code on an actual physical device.",
"error.invalidFileNameDebug": "The file you tried to debug isn\\'t named \"code.py\" or \"main.py\\. Rename your file if you want your code to work on your actual device.",
"error.noDevice": "No plugged in boards detected. Please double check if your board is connected and/or properly formatted",
"error.noFileToRun": "\n[ERROR] We can't find the .py file to run on simulator. Open up a new .py file, or browse through some examples\n",
"error.noProgramFoundDebug": "Cannot find a program to debug.",
"error.noPythonPath": "We found that you don't have Python 3 installed on your computer, please install the latest version, add it to your PATH and try again.",
"error.stderr": "\n[ERROR] {0} \n",
"error.unexpectedMessage": "Webview sent an unexpected message",
Expand Down
Loading

0 comments on commit 5cc4658

Please sign in to comment.