python setup.py 创建wheel文件以包含来自另一个目录的文件
当前的 setup.py 使用 for 循环创建 2 个不同的 whl 文件,我们可以在 AWS Glue 中使用它们,并且可以使用附加 python 模块进行配置。
但在 AWS EMR 中,我们无法对 --py-files 使用多个whl文件(已由AWS支持团队确认),因此,我尝试将所有文件捆绑到一个whl文件中。
我的文件夹结构如下,由于客户端限制,我无法更改 setup.py 位置,因为这是某些 AWS 服务的通用代码。
main_dir
|
|
|_________>sub_dir_1
| test1.py
| test2.py
|
|_________>sub_dir_2
| |
| |_________>__init__.py
| file1.py
| file2.py
| setup.py
|
|_________>tests
|
|_________>sub_dir_3
|
|_________>others
我的 setup.py 在 sub_dir_2 中可用,并且我希望 Wheel 文件也包含 sub_dir_1?我尝试了以下操作,但出现错误,感谢您的帮助。
from setuptools import find_packages, setup
setup(
name="whl_test",
version="1.0",
description="Wheel file",
author="MyName",
packages=(find_packages(
where="main_dir",
include=["sub_dir_1", "sub_dir_2"],
exclude=["*.tests","*.sub_dir_3","*.others"])),
install_requires=[],
namespace_packages=["test"],
)
我需要这个,因为 test1、test2 被认为是一些辅助 util 文件,我需要从 file1、file2 等引用。谢谢。我对设置工具、轮子包装等很陌生。请。
The current setup.py creates 2 different whl files using a for loop, which we are able to use in AWS Glue and we are able to configure using additional-python-modules.
But in AWS EMR, we cannot use multiple whl files (confirmed by AWS Support team) for --py-files, and for this reason, I am trying to bundle all files to one whl file.
My folder structure is as follows, and due to client restrictions, I cannot change the setup.py location, since this is common code for some AWS Services.
main_dir
|
|
|_________>sub_dir_1
| test1.py
| test2.py
|
|_________>sub_dir_2
| |
| |_________>__init__.py
| file1.py
| file2.py
| setup.py
|
|_________>tests
|
|_________>sub_dir_3
|
|_________>others
I have my setup.py available in sub_dir_2, and I want the wheel file to include sub_dir_1 also? I tried the following but am getting errors, appreciate any help please.
from setuptools import find_packages, setup
setup(
name="whl_test",
version="1.0",
description="Wheel file",
author="MyName",
packages=(find_packages(
where="main_dir",
include=["sub_dir_1", "sub_dir_2"],
exclude=["*.tests","*.sub_dir_3","*.others"])),
install_requires=[],
namespace_packages=["test"],
)
I need this because, test1, test2 are considered some helper util files, and I need to reference from file1, file2, etc. Thanks. Am new to setuptools,wheel packaging,etc. please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论