setup.py 在安装时访问文件

发布于 2025-01-14 01:15:54 字数 474 浏览 3 评论 0原文

TL;DR

我正在寻找一种在安装期间读取 setup.py 中的文件内容的方法,该文件内容不是包的一部分

描述

我有一个看起来像的项目像这样:

my_project
|--- src
      |--- my_package
               |--- ...
|--- resources
         |--- ...
|--- setup.py

resources 目录包含 toml 文件列表,需要在安装过程中将这些文件复制到主目录以使我的代码正常工作。

此外,我不希望将这些文件保存为包的一部分,以避免我的包太大。

将此目录包含在 MANIFEST.ini 中并在 setup.py 中读取它就足够了,还是需要其他操作?

任何帮助将不胜感激。

TL;DR

I'm looking for a way to read a file content in setup.py that is not part of the package during installation time

Description

I have a project that looks like this:

my_project
|--- src
      |--- my_package
               |--- ...
|--- resources
         |--- ...
|--- setup.py

The resources dir containing a list of toml files that need to be copied to the home directory during installation in order to make my code work.

Moreover, I don't want those files to be saved as part of the package in order to avoid my package from being too large.

Is including this directory in MANIFEST.ini and read it in setup.py is enough, or other actions are needed?

Any help would be much appriciated.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文