Reputation: 1789
Can I create a 'Python Distribution' with my module directly using PTVS(Python Tools for Visual Studio) ? I have done this before using command line but not using PTVS. If yes, how ? Thanks!
Upvotes: 2
Views: 344
Reputation: 6486
Currently no. I think the feature you'd like to vote on is Feature: build package. If you've done this with py2exe or other packages in the past then you could wire this directly into PTVS with our 2.1 release. This will give you a context menu on your project which will let you run the command from within the IDE.
To do this you'd modify your .pyproj file and add something like:
<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>
This example is shelling out to PyLint but you can change TargetType to executable/script/code or pip to execute different things. And you can change ExecuteIn to console, output, or repl to have the output show up in various different locations.
Upvotes: 1