-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
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:
- Add main function to the
cli.py
:if __name__ == '__main__': cli(sys.argv[1:])
- Create PyCharm Python config and choose
functions_framework\cli.py
as a script. - Pass required params as
Parameters
in the configuration, e.g.--port 8088 --signature-type http
, etc. - Make sure to set the working directory to the project root (so that the functions framework is able to load the entry point function).
- Run the created configurations and use PyCharm debugger.
What we can to make life easier:
- Create
__main__.py
in the functions_framework module and allow running the module as the CLI. Or, add the main function to thecli.py
itself, maybe worth having both. - Create well-structured documentation about debugging functions locally with popular IDEs (PyCharm, VSCode, others?)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request