setuptools pyproject.toml等于`

发布于 2025-02-04 02:55:51 字数 179 浏览 3 评论 0 原文

我正在从 setup.py 迁移到 pyproject.toml 。安装我的软件包的命令似乎是相同的,但是我找不到 pyproject.toml 命令清理构建工件的命令。等效于 python setup.py clean -all 是什么?

I'm migrating from setup.py to pyproject.toml. The commands to install my package appear to be the same, but I can't find what the pyproject.toml command for cleaning up build artifacts is. What is the equivalent to python setup.py clean --all?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白衬杉格子梦 2025-02-11 02:55:51

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 a build subdirectory.

Anyway, it was not really an exciting command in the first place and rm -rf build does the same job.

滴情不沾 2025-02-11 02:55:51

迁移时,我遇到了同样的问题。 WIM回答的似乎主要是正确的。

如果您以 setuptools 文档说并使用 python -m构建,则不会创建 build 目录会。

但是,如果您进行 PIP安装。 a 构建目录即使使用 pyproject.toml file。如果您更改软件包结构或重命名文件,这可能会导致问题,因为有时将安装 build> build 目录中的旧版本,而不是当前更改。

我个人运行 pip安装。 &amp;&amp; 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 use python -m build then the build directory will not be created, but a dist will.

However if you do pip install . a build directory will be left behind even if you are using a pyproject.toml file. This can cause issues if you change your package structure or rename files as sometimes the old version that is in the build directory will be installed instead of your current changes.

Personally I run pip install . && rm -rf build or pip install . && rmdir /s /q build for Windows. This could be expanded to remove any other unwanted artifacts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文