Integrating with distutils/setuptools
See original GitHub issueHello all,
Is there a clean and recommended way to integrate distutils/setuptools in a Visual Studio Python project?
I’m specifically looking at this from the context of a Python library developed under Visual Studio and distributed according to the Python Packaging Guidelines.
Ideally, any setup.py
command could be run from Visual Studio, including OTOH :
bdist_wheel
to generate a Wheel packagebdist_wininst
to generate a Windows installertest
for integrating unit/integration test frameworks (e.g. PyTest)
This is a hack, but adding this custom AfterBuild
target in the .pyproj
file generates a Windows installer when clicking on Rebuild project :
<Target Name="AfterBuild">
<RunPythonCommand Target="setup.py" TargetType="script" Arguments="bdist_wininst" />
</Target>
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Porting from Distutils - Setuptools - Python Packaging Authority
Setuptools and the PyPA have a stated goal to make Setuptools the reference API for distutils. Since the 60.0.0 release, Setuptools includes a...
Read more >6. Distutils Examples — Python 3.11.4 documentation
This chapter provides a number of basic examples to help get started with distutils. Additional information about using distutils can be found in...
Read more >2. Writing the Setup Script — Python 3.11.4 documentation
The setup script is the centre of all activity in building, distributing, and installing modules using the Distutils. The main purpose of the...
Read more >distutils/setuptools integration - python-for-android
This is functionality to run setup.py INSIDE `p4a apk`, as opposed to the other section below, which is about running p4a inside setup.py....
Read more >setuptools vs. distutils: why is distutils still a thing?
Secondly, setuptools provides enhancements to distutils. It is therefore modeled after the distutils tool set and takes all of it's structure ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@fxthomas Thanks. The article is on https://docs.microsoft.com/en-us/visualstudio/python/defining-custom-python-project-commands now; I’ll be adding your examples shortly.
The snippet above is missing a quote in
Outputs
, and should result in the project not being loadable due to being invalid XML. If it’s a copy/pasted snippet, then perhaps you were accidentally editing the wrong file?If that’s not the case, try setting MSBuild verbosity to diagnostic (Tools -> Options -> Projects and Solutions -> Build and Run) - build output should then be detailed enough to see when it was considering your target, and why exactly it wasn’t run.
@(Compile)
should be fine - it basically makes it depend on all project items that are defined as<Compile Include="...">
, which should include all .py files by default.