I am developing a serverless app using Python and AWS-SAM-CLI. I am debugging my functions using ptvsd
library. In order to attach a debugger, the following snippet has to be in the function code.
ptvsd.enable_attach(address=('0.0.0.0', 5890), redirect_output=True)
ptvsd.wait_for_attach()
Obviously, this code has to be removed before deploying the function to stage or production environment.
Is there a way to automate this during package/deploy step to not have to manually remove this snippet of code from each function before a deployment?