azure-functions-python-library icon indicating copy to clipboard operation
azure-functions-python-library copied to clipboard

Enforcing unique function names

Open hallvictoria opened this issue 9 months ago • 0 comments

Currently, functions with the same function name can be created and deployed. For example:

  • 2 or more functions with the same method name
@app.schedule(arg_name="name", schedule="10****")
def hello(name: str):
      return name

@app.schedule(arg_name="name", schedule="10****")
def hello(name: str):
      return name
  • 2 or more functions with the same function name 
@app.function_name("hello")
@app.schedule(arg_name="name", schedule="10****")
def function1(name: str):
      return name

@app.function_name("hello")
@app.schedule(arg_name="name", schedule="10****")
def function2(name: str):
      return name

This PR changes this so that the following scenarios are no longer supported. The same applies to blueprints (ie. function names must be distinct between all blueprints).

When creating an Asgi/Wsgi Function App, an integrated http function is automatically created and added. The function name here is hard-coded. In order to allow customization, the Asgi and Wsgi Function App constructors now also take in a function name. The default value is the previous value.

Fixes: https://github.com/Azure/azure-functions-python-worker/issues/1489 Fixes: https://github.com/Azure/azure-functions-pyfx-planning/issues/313

hallvictoria avatar May 02 '24 21:05 hallvictoria