编程语言
首页 > 编程语言> > python-setup.py构建有什么作用?

python-setup.py构建有什么作用?

作者:互联网

我读了Python documentation

The build command is responsible for putting the files to install into a build directory.

我担心此文档可能不完整. python setup.py build是否还有其他作用?我希望这一步将生成具有Python字节码的目标文件,该文件将在执行时由Python VM解释.

另外,我正在源代码存储库中构建自动代码检查.我想知道运行setup.py build是否有好处(是否进行任何检查?)还是像Pylint这样的静态代码/ PEP8检查器足够好?

解决方法:

Does python setupy.py build do anything else?

如果您的程序包包含C扩展名(或定义了一些自定义编译任务),它们也将被编译.如果您的软件包中仅包含Python文件,则所有构建都将进行复制.

I expect this step to generate object files with Python bytecode, which will be interpreted at execution time by Python VM.

不,构建不会这样做.这发生在安装阶段.

I want to know if there is any benefit of running setup.py build (Does it do any checks?) or is a static code/PEP8 checker such as Pylint good enough?

一定要运行pylint. build甚至不检查语法.

标签:distutils,python
来源: https://codeday.me/bug/20191122/2061908.html