Skip to content

Document how to debug a Briefcase app with popular IDEs #1393

@freakboy3742

Description

@freakboy3742

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 with briefcase dev is to set a breakpoint() 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:

  1. Add every directory mentioned in sources to the PYTHONPATH
  2. Set the working directory to the user's home directory
  3. Remove the project directory (the directory that contains pyproject.tomlfrom the PYTHONPATH (it's usually the first entry insys.path`)
  4. Run the app name as a module (i.e., the equivalent of 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 to tests.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 and breakpoint().

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationAn improvement required in the project's documentation.enhancementNew features, or improvements to existing features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions