-
-
Notifications
You must be signed in to change notification settings - Fork 414
Document how to debug a Briefcase app with popular IDEs #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Notes on PyCharm: PyCharm has built in options for adding the content root (the "project" directory. . . usually) and the sources root to the path as part of its run function. Oddly, I cannot seem to disable the content root if I'm using the sources root. This might be a bug in pycharm. The setting the working directory to the user's home is simple there's a field for it. This also runs in the debugger without issue. Testing configuration: This was actually easier, I started with the default test runner configuration for pytest, and filled in the relevant fields. Here, the content root and sources root are actually separate check boxes and seem to work more reliably. |
Anleitung für das Debugging einer BeeWare-Anwendung in Visual Studio Code:
|
Hi:) I tried to use the solution for debugging My briefcase version is: 0.3.18 Visual Studio Code version is: 1.89.1 I tried to use this launch.json {
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Attach using Process Id",
"type": "python",
"request": "attach",
"processId": "${command:pickProcess}",
"justMyCode": true
}
]
} I run
The problem is: - None of my breakpoints is working Can anybody validate if this solution actually works and give feedback? |
@eltoro0815 If you're on Windows, the issue is almost certainly the threading approach used by Windows apps. A Toga windows app immediately starts a subthread which is where the app actually runs. I have no idea if VSCode needs special handling to catch breakpoints in that subthread, but given that we're using the Windows threading API to start that thread, not the Python API, it wouldn't surprise me if VSCode isn't able to "see" the child thread. |
Here's what I found out about debugging briefcases with VSCode: My Setup:
Debugging
|
I haven't tried it for years, but I made some notes about debugging Python code on Android with PyCharm here. |
What is the problem or limitation you are having?
briefcase dev
is the documented way to run a Briefcase app; however, the only way to debug an app withbriefcase dev
is to set abreakpoint()
and use pdb. This is less than ideal, as modern IDEs provide built-in debuggers and test runners.Describe the solution you'd like
Add documentation how to configure VSCode, PyCharm, and other common IDEs so that their native "run" and "test" mechanisms reproduce what
briefcase dev
does.The tl;dr is that you need to:
sources
to the PYTHONPATHfrom the PYTHONPATH (it's usually the first entry in
sys.path`)python -m myapp
)To run in test mode, you also need to add all the directories mentioned in
test_sources
, plus change the runtime module totests.myapp
.Specifics can be found by reverse engineering
src/briefcase/commands/dev.py
.We should document the specific instructions for configuring common IDEs (at present, I'd say that means VSCode and PyCharm); but we should also document the generic requirements so that any other IDE user knows what is needed.
Describe alternatives you've considered
Continue to encourage
briefcase dev
andbreakpoint()
.Additional context
Documenting manual configuration is a stop-gap measure. Longer term, it would be desirable to capture these instructions as a Briefcase plugin for VSCode and PyCharm.
The text was updated successfully, but these errors were encountered: