2

How to configure Azure function project in Intellij/Pycharm run/debug configurations on Mac because I've tried to set it by my own but it doesnt work.

I would like to replace shell command: func start with run config

The image below from Pycharm

pycharm-azure config


UPDATE

I've added path to Azure-CLI and imported my app-settings

enter image description here

I'm trying to configure the run configs but it asks to select the module but there is no any module in dropdown (see pic)

intellij-azure config


UPDATE-UPDATE: Here is what azure-tools-for-intellij team me answered:

enter image description here They dont support pure python functions run yet

Alexey Nikonov
  • 4,958
  • 5
  • 39
  • 66

3 Answers3

1

I think you shouldn't use row shell scrip with IntelliJ/PyCharm instead of this you should use Azure Toolkit for IntelliJ and run/debug your functions like in this guide.

Also when you install Azure Toolkit for IntelliJ you will have the opportunity to create run/debug configuration with predefined Azure Function ready template.

Just example:

enter image description here

Anton Komyshan
  • 1,377
  • 10
  • 21
  • thanks, probably at that moment they havent been downloaded yet in Intellij. But in PyCharm there is no such Azure templates – Alexey Nikonov Dec 06 '20 at 18:26
  • @AlexNikonov are you still having problems with this, or did everything work out? – Anton Komyshan Dec 07 '20 at 11:19
  • I've searched the toolkit manual for Python in ***https://learn.microsoft.com/en-us/azure/developer/python/*** but there is toolkit examples of *Java*. Could you see updated part of my question because I still have no idea what to set there as Module and I'm not sure if other fields are correct. – Alexey Nikonov Dec 07 '20 at 18:36
0

I found the way to debug in Intellij Idea/PyCharm.

  1. add these lines at the top of your file/module:
import pydevd_pycharm
pydevd_pycharm.settrace('127.0.0.1', port=9091, stdoutToServer=True, stderrToServer=True)

enter image description here

  1. set Python Debug Server with host and port in Run/Debug Configs Screenshot at Feb 22 20-29-45

  2. run your azure functions as used to (func host start) and press debugging button.

Alexey Nikonov
  • 4,958
  • 5
  • 39
  • 66
0

The way I do it in PyCharm is to define a shell script configuration (Edit Configurations > Shell Script) and set:

  • Execute: Script set
  • Script text: func start
  • Working directory: should be to project directory where host.json etc. is located
  • Environment variables: leave empty
  • Execute in the terminal: checked

Run this configuration, which will start the test server in terminal. Then go to Run > Attach to Process... and select the process (usually it's the one without any path after the number).

Neits
  • 319
  • 3
  • 10