我可以使用 PTVS (Visual Studio的Python工具)直接使用我的模块创建“Python发布”吗?我在使用命令行但不使用PTVS之前已经这样做了。如果有,怎么样? 谢谢!
答案 0 :(得分:1)
目前没有。我认为您要投票的功能是Feature: build package。如果您以前使用py2exe或其他软件包完成此操作,那么您可以使用我们的2.1版本将其直接连接到PTVS。这将为您提供项目的上下文菜单,您可以从IDE中运行该命令。
要执行此操作,您需要修改.pyproj文件并添加以下内容:
<PropertyGroup>
<PythonCommands>$(PythonCommands);PythonRunPyLintCommand</PythonCommands>
<PyLintWarningRegex>
<![CDATA[^(?<filename>.+?)\((?<line>\d+),(?<column>\d+)\): warning (?<msg_id>.+?): (?<message>.+?)$]]>
</PyLintWarningRegex>
</PropertyGroup>
<Target Name="PythonRunPyLintCommand"
Label="Run PyLint"
DependsOnTargets="ResolveStartupPath"
Returns="@(Commands)">
<CreatePythonCommandItem Target="pylint.lint"
TargetType="module"
Arguments=""--msg-template={abspath}({line},{column}): warning {msg_id}: {msg}" -r n @(Compile, ' ')"
WorkingDirectory="$(WorkingDirectory)"
ExecuteIn="output"
RequiredPackages="pylint>=1.0.0"
WarningRegex="$(PyLintWarningRegex)">
<Output TaskParameter="Command" ItemName="Commands" />
</CreatePythonCommandItem>
</Target>
此示例正在向PyLint发送shell,但您可以将TargetType更改为executable / script / code或pip以执行不同的操作。您可以将ExecuteIn更改为console,output或repl,以使输出显示在不同的位置。