在平坦的层中发现的多个顶级软件包

发布于 2025-01-30 03:59:38 字数 722 浏览 4 评论 0 原文

我正在尝试从来源使用诗歌的来源安装图书馆,但是我得到了这个错误,

error: Multiple top-level packages discovered in a flat-layout: ['tulips', 'fixtures'].
        
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
        
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
        
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
        
To find more information, look for "package discovery" on setuptools docs

我需要做什么来解决它?

I am trying to install a library from the source that makes use of Poetry, but I get this error

error: Multiple top-level packages discovered in a flat-layout: ['tulips', 'fixtures'].
        
To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.
        
If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:
        
1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names
        
To find more information, look for "package discovery" on setuptools docs

What do I need to do to fix it?

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

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

发布评论

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

评论(3

梦忆晨望 2025-02-06 03:59:38

基于此评论在Github问题上 pyproject.toml 可能会解决您的问题:(

[tool.setuptools]
py-modules = []

对于我的情况,该评论中提供的其他解决方法,即添加 py_modules = [] 作为ketup() setup.py 工作中的函数)

请参见有关其他信息。

Based on this comment on a GitHub issue, adding the following lines to your pyproject.toml might solve your problem:

[tool.setuptools]
py-modules = []

(For my case, the other workaround provided in that comment, i.e. adding py_modules=[] as a keyword argument to the setup() function in setup.py worked)

See Package Discovery and Namespace Packages for additional information.

陈年往事 2025-02-06 03:59:38

pyproject.toml 中添加以下内容为我工作。这是一个带有许多文件夹的存储夹,但只有一个文件夹具有包装代码:

[tool.setuptools.packages.find]
where = ["."]  # list of folders that contain the packages (["."] by default)
include = ["<package name>"]  # package names should match these glob patterns (["*"] by default)
exclude = []  # exclude packages matching these glob patterns (empty by default)
namespaces = false  # to disable scanning PEP 420 namespaces (true by default)

请参阅有关更多信息。

Adding the following in pyproject.toml worked for me. It was a repo with many folders but just one folder had the package code:

[tool.setuptools.packages.find]
where = ["."]  # list of folders that contain the packages (["."] by default)
include = ["<package name>"]  # package names should match these glob patterns (["*"] by default)
exclude = []  # exclude packages matching these glob patterns (empty by default)
namespaces = false  # to disable scanning PEP 420 namespaces (true by default)

See Package Discovery and Namespace Packages for more information.

眼眸 2025-02-06 03:59:38

我在安装模块 demo.py 时遇到了问题

python -c "import setuptools; setuptools.setup(name='demo')" develop --user

当目录中只有一个*。py 脚本时, 。但是有几个*。py 脚本。
它在包含参数 py_modules = ['demo'] 中之后再次工作, setup()呼叫。

I got the problem when installing a module demo.py with

python -c "import setuptools; setuptools.setup(name='demo')" develop --user

It works when there is only one *.py script in the directory. But there were several *.py scripts.
It works again after including also the argument py_modules=['demo'] in the setup() call.

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