setuptools pyproject.toml等于`
我正在从 setup.py
迁移到 pyproject.toml
。安装我的软件包的命令似乎是相同的,但是我找不到 pyproject.toml
命令清理构建工件的命令。等效于 python setup.py clean -all
是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
distutils命令清洁
pyproject.toml
基于构建。现代工具调用 pep517 / pep518 钩子,例如 build subdirectory乱扔垃圾。无论如何,它是并不是真正令人兴奋的命令首先,
rm -RF构建
执行相同的工作。The distutils command clean is not needed for a
pyproject.toml
based build. Modern tools invoking PEP517/PEP518 hooks, such as build, create a temporary directory or a cache directory to store intermediate files while building, rather than littering the project directory with abuild
subdirectory.Anyway, it was not really an exciting command in the first place and
rm -rf build
does the same job.迁移时,我遇到了同样的问题。 WIM回答的似乎主要是正确的。
如果您以
setuptools
文档说并使用python -m构建
,则不会创建build
目录会。但是,如果您进行
PIP安装。
a构建
目录即使使用pyproject.toml
file。如果您更改软件包结构或重命名文件,这可能会导致问题,因为有时将安装build> build
目录中的旧版本,而不是当前更改。我个人运行
pip安装。 && RM -RF构建
或pip安装。 &amp;&amp; Windows的RMDIR /S /Q构建< /code>。可以扩展以消除其他任何不需要的人工制品。
I ran into this same issue when I was migrating. What wim answered seems to be mostly true.
If you do as the
setuptools
documentation says and usepython -m build
then thebuild
directory will not be created, but adist
will.However if you do
pip install .
abuild
directory will be left behind even if you are using apyproject.toml
file. This can cause issues if you change your package structure or rename files as sometimes the old version that is in thebuild
directory will be installed instead of your current changes.Personally I run
pip install . && rm -rf build
orpip install . && rmdir /s /q build
for Windows. This could be expanded to remove any other unwanted artifacts.