Giter Club home page Giter Club logo

Comments (13)

yubozhao avatar yubozhao commented on August 15, 2024 1

@Hazhzeng Does this mean that we no longer need to base the image from mcr.microsoft.com/azure-functions/python:3.0.13901-python3.7?

from azure-functions-python-library.

Hazhzeng avatar Hazhzeng commented on August 15, 2024

Hi @cecilphillip,

  1. The azure functions core tools does not have the latest version of azure-functions library yet. If you want to test out this feature, please remove the azure folder in your core tools (rm -rf azure-functions-core-tools\bin\workers\python\3.8\OSX\X64\azure) and install azure-functions~=1.2.0 in your Python virtual environment.

  2. In your code, return WsgiMiddleware(web_application).main(req, context) should be return WsgiMiddleware(web_application).handle(req, context) as mentioned here

  3. Another nit is in your third line, HttpRequest should be HttpResponse.

Thanks for reporting this issue.

from azure-functions-python-library.

cecilphillip avatar cecilphillip commented on August 15, 2024

@Hazhzeng Thanks! I just assumed that it would use the version of the package that's specified in the requirements.txt file.

So does the core tools just ignore that package and install other dependencies? I'm just trying to understand how that works.

from azure-functions-python-library.

Hazhzeng avatar Hazhzeng commented on August 15, 2024

Hi @cecilphillip

Yes, so far we ignore the azure-functions library in requirements.txt in local dev and host runtime, and we bound a specific version of azure-functions library in every host release.

from azure-functions-python-library.

cecilphillip avatar cecilphillip commented on August 15, 2024

@Hazhzeng So how do devs consuming the library know what version of the they can depend on?

from azure-functions-python-library.

Hazhzeng avatar Hazhzeng commented on August 15, 2024

@cecilphillip we have a schedule for rolling out new library every 2 weeks.

We have a discussion with Maheer (who was the former developer on Python worker), if we bind the library version with customer's code, the customer needs to redeploy their function app when we release a new version of azure-functions library. These releases are backward compatible and include bug fixes on python worker and azure-functions library.

We made a decision to roll-out these libraries with the host so the customer's app can be run on the latest version automatically without manual intervention. If you have any doubts, feel free to let me know and suggestions are welcomed.

cc: @anirudhgarg

Thanks,

from azure-functions-python-library.

cecilphillip avatar cecilphillip commented on August 15, 2024

@Hazhzeng

I think most devs would have the expectation that whatever package versions they install should be the versions that ends up in their deployment, but I also understand your reasoning. I have 2 suggestions

  • We should document that behavior around azure-functions in the official docs. Maybe somewhere in this article
  • When the function runtime loads up locally, would it be possible to output the version of azure-functions that's getting loaded, or maybe have a static list somewhere that shows the mappings between the azure-functions versions and host runtime versions?

from azure-functions-python-library.

cecilphillip avatar cecilphillip commented on August 15, 2024

@Hazhzeng is 1.2.0 rolled out to functions-core-tools yet?

from azure-functions-python-library.

tvadim avatar tvadim commented on August 15, 2024

@Hazhzeng would you mind re-opening the issue as I cannot see a way it's resolved: for a local installation I can obviously remove the azure folder in the core tools directory. But how would I do that when my function is deployed to Azure?

Exception while executing function: Functions.impl Result: Failure
Exception: AttributeError: module 'azure.functions' has no attribute 'WsgiMiddleware'
Stack:   File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/dispatcher.py", line 242, in _handle__function_load_request
    func_request.metadata.entry_point)
  File "/azure-functions-host/workers/python/3.7/LINUX/X64/azure_functions_worker/loader.py", line 66, in load_function
    mod = importlib.import_module(fullmodname)
  File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/site/wwwroot/impl/main.py", line 124, in <module>
    main = func.WsgiMiddleware(my_skill).main

from azure-functions-python-library.

Hazhzeng avatar Hazhzeng commented on August 15, 2024

Oh sorry, I think the merge of the PR automatically closed this issue, I will reopen it again.

from azure-functions-python-library.

yubozhao avatar yubozhao commented on August 15, 2024

I ran into this issue today. Any update on this?

@tvadim did you find any workaround?

I looked into the Dockerfile that was provided for Azure function. It has 1.0.8 installed. I opened an issue about it over there. Azure/azure-functions-docker#281

My current workaround is created a custom Dockerfile that manually remove it and then install the latest one with pip

from azure-functions-python-library.

Hazhzeng avatar Hazhzeng commented on August 15, 2024

This one is already deployed on production. Closing the thread.

from azure-functions-python-library.

anirudhgarg avatar anirudhgarg commented on August 15, 2024

Yes now this is included in the Consumption plan and in the images we use in the Dedicated/Premium plan and in CoreTools.

from azure-functions-python-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.