-
Hi all, I want the installation process to run some code to generate some data for the package, but I find my solutions show different behavior for from setuptools.command.install import install
class MyInstallCMD(install):
def run(self):
my_func()
super().run()
setup(
...,
package_data={'': ['GENERATED_DATA']},
cmdclass={
'install': MyInstallCMD
},
) This works for from wheel.bdist_wheel import bdist_wheel
class MyInstallCMD(bdist_wheel):
def run(self):
my_func()
super().run()
setup(
...,
package_data={'': ['GENERATED_DATA']},
cmdclass={
'bdist_wheel': MyInstallCMD
},
) Combining both, and a global flag to avoid running I also tried Any comments would be very appreciate! P.S. I also have used
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@CareF For non-editable installs, And so I believe you're looking to redefine those. I saw you attempted to change |
Beta Was this translation helpful? Give feedback.
@CareF
pip install
only falls back tosetup.py install
internally if it fails to build a wheel. And I think, this workaround will probably be deprecated at some point now that PEP 517 is a thing. Also, I wouldn't recommend usingsetup.py install
without a compelling reason when you are already usingpip
.For non-editable installs,
pip
will use PEP 517, ifpyproject.toml
is present. It will import and invoke thebuild-backend
you set after pre-provisioningrequires
in an isolated (by default) env. From that point, it'll call hooks defined byPEP 517
to build sdist (a tarball) followed by a wheel (since you havewheel
in requires, hence in that isolated env). Then, it'll cache the wheel if …