Skip to content

Make it easier to debug functions in IDEs #29

@yuri-sergiichuk

Description

@yuri-sergiichuk

Currently, it is super hard to configure the local debug of the functions in PyCharm, moreover, I found it impossible without hacking the cli.py.

Here is a way to do it in PyCharm now:

  1. Add main function to the cli.py:
    if __name__ == '__main__':
        cli(sys.argv[1:])
  2. Create PyCharm Python config and choose functions_framework\cli.py as a script.
  3. Pass required params as Parameters in the configuration, e.g. --port 8088 --signature-type http, etc.
  4. Make sure to set the working directory to the project root (so that the functions framework is able to load the entry point function).
  5. Run the created configurations and use PyCharm debugger.

What we can to make life easier:

  1. Create __main__.py in the functions_framework module and allow running the module as the CLI. Or, add the main function to the cli.py itself, maybe worth having both.
  2. Create well-structured documentation about debugging functions locally with popular IDEs (PyCharm, VSCode, others?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions