使用VS Code中的Azure Functions V2 Python编程模型。

huangapple go评论58阅读模式
英文:

Using V2 Python programming model for Azure Functions in VS Code

问题

我正在使用MacOS v13.4.1上的VS Code v1.79.2,并尝试创建一个Azure函数,使用Python编程模型v2,如此处所述。文章指出,在选择新项目的文件夹后,它将提示选择函数的编程语言,这是您选择Python V2模型的地方。然而,在我的情况下,它直接跳到选择Python环境,并创建了老的V1风格的存根代码。我已安装了Azure Functions扩展(v1.11.0),并尝试安装Azure Tools扩展,它似乎是包含与Azure相关的扩展的捆绑包,包括Functions的扩展,但我似乎被困在V1模型中。

我注意到的另一个区别是,尽管Microsoft文档中的截图如下所示:
Microsoft documentation,但我的IDE看起来像这样(没有'+'号):What I'm seeing

想知道我在设置中是否漏掉了什么或者我是否没有正确版本的某些东西?

更新:我通过使用"func" CLI工具来解决UI限制,如此处所述。这允许我在我的VS Code项目中创建了一个V2 Python函数的存根代码。

英文:

I'm using VS Code v1.79.2 on MacOS v13.4.1, and am trying to create an Azure Function using the Python programming model v2 as described here. The article indicates that after selecting the folder for the new project, it will prompts for the programming language for the Function, which is where you choose Python V2 model. However, in my case, it skips right to selecting the Python environment, and creates the stubbed out code in the older V1 style. I've installed the Azure Functions extension (v1.11.0) and had tried installing the Azure Tools extension which seems to be a bundle of Azure-related extensions including the one for Functions, but I seem to be stuck with the V1 model.

Another difference I noted is that while the screenshot in the Microsoft docs looks like this:
Microsoft documentation, my IDE looks like this (no '+' sign): What I'm seeing

Wondering if I missed something in the setup or if I don't have the correct version of something?

Update: I got around the UI limitation by using the "func" CLI tool as described here. This allowed me to create the stubbed out code for a V2 Python Function in my VS Code project.

答案1

得分: 0

我使用了VSCode V1.79.2和Azure Tools V1.2.0。

官方文档中的“+”按钮与您使用的图像中的闪电按钮具有相同的功能,都代表创建函数

您可以点击闪电按钮并按照文档操作:

使用VS Code中的Azure Functions V2 Python编程模型。

使用VS Code中的Azure Functions V2 Python编程模型。

英文:

I used VSCode V1.79.2 and Azure Tools V1.2.0.

The + button in the official document has the same function as the lightning button in the image you used, both representing Create Function.

You can click the lightning button and follow the document:

使用VS Code中的Azure Functions V2 Python编程模型。

使用VS Code中的Azure Functions V2 Python编程模型。

答案2

得分: 0

无法在VS Code中使其工作,但可以使用“func”命令行工具,例如:

func init <项目名称> --python -m V2
英文:

Could never get this working in VS Code but was able to use the "func" CLI tool, e.g.:

func init &lt;project name&gt; --python -m V2

huangapple
  • 本文由 发表于 2023年7月3日 21:31:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76605235.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定