Azure / azure-functions-templates

Azure functions templates for the azure portal, CLI, and VS
MIT License
350 stars 197 forks source link

Template Improvements for Python #869

Open asavaritayal opened 5 years ago

asavaritayal commented 5 years ago

In preparation for exiting the preview phase for Python support in Functions, we should improve the quality of out of box templates available. Following is the proposed list of improvements we can make:

  1. Complete the "TBDs" in the READMEs
  2. Provide more comprehensive code samples to better demonstrate the API surface. (HTTP template good but others like Blob and Queue are currently only single line logging statements.)
  3. Add comments for aka links to the binding reference articles.
  4. Add "scriptFile": "__init__.py", "entryPoint": "main" to function.json for all templates.

Priority order:

grayjeremy commented 5 years ago

What do you think about adding a dependency to the Azure SDK for Python? When I create a function in python with the servicebus trigger it references the azf_sbus object "ServiceBusMessage" instead of the Azure SDK object "Message". What I don't like about the ServiceBusMessage class is that it doesn't have any behaviors defined, only properties. I'd like to be able to act on the message as opposed to just seeing its properties.

The actual problem I am trying to solve is how to automatically dead letter a message based on some type of failed business logic. The customer doesn't want to try something 10 times before it goes to dead letter (consumption plan).

If this isn't feasible, especially in the short term, can we add an example that shows how to convert between the 2. This will likely involve a pip install azure-servicebus but I think thats OK.

Please note, this doesn't work image

asavaritayal commented 5 years ago

@grayjeremy makes sense and understand the request. This is being tracked as a larger work item here - https://github.com/Azure/azure-functions-python-worker/issues/414. The current issue is limited to making sure that the present templates are complete for GA.