[英]How to remove unwanted top-level packages in setup.cfg?
I'm working on a setup.cfg
for my first Python package following this guide .我正在按照本指南为我的第一个
setup.cfg
package 编写 setup.cfg。 It mostly works, but the problem is it includes subfolders of my package as top-level packages.它主要工作,但问题是它包含我的 package 的子文件夹作为顶级包。 Source tree:
源树:
setup.cfg
src
Accentizer2
__init__.py
Accentizer.py
Annotation.py
DawgSharp
YaleDawg.py
Russian
Stress.py
Syllable.py
Vowels.py
(I know, the capitalisation is non-conventional. I'm fixing that soon.) (我知道,大写是非常规的。我很快就会解决这个问题。)
setup.cfg:设置.cfg:
[options]
package_dir =
= src
packages = find:
[options.packages.find]
where = src
exclude =
Accentizer2/DawgSharp
Accentizer2/Russian
Here is partial output of py -m build
:这是
py -m build
的部分 output :
adding 'Accentizer2/Accentizer.py'
adding 'Accentizer2/Annotation.py'
adding 'Accentizer2/__init__.py'
adding 'Accentizer2/DawgSharp/YaleDawg.py'
adding 'Accentizer2/DawgSharp/__init__.py'
adding 'Accentizer2/Russian/Stress.py'
adding 'Accentizer2/Russian/Syllable.py'
adding 'Accentizer2/Russian/Vowels.py'
adding 'Accentizer2/Russian/__init__.py'
adding 'DawgSharp/YaleDawg.py'
adding 'DawgSharp/__init__.py'
adding 'Russian/Stress.py'
adding 'Russian/Syllable.py'
adding 'Russian/Vowels.py'
adding 'Russian/__init__.py'
As you can see, it's adding DawgSharp
and Russian
twice: inside Accentizer2 and at the top level.如您所见,它两次添加了
DawgSharp
和Russian
:在 Accentizer2 内部和顶层。 Why?为什么? It's also adding
DawgSharp/__init__.py
and Russian/__init__.py
which are not part of the src tree.它还添加了不属于 src 树的
DawgSharp/__init__.py
和Russian/__init__.py
。
How do I change my setup.cfg
so that the resulting package only contains DawgSharp
and Russian
as subfolders and not top-level modules?如何更改我的
setup.cfg
以使生成的 package 仅包含DawgSharp
和Russian
作为子文件夹,而不包含顶级模块? They are implementation details which the users of my package should not worry about.它们是我的 package 的用户不必担心的实现细节。
I just needed to clean my build folder.我只需要清理我的构建文件夹。 It was picking up old versions of the files (before they were moved).
它正在拾取旧版本的文件(在它们被移动之前)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.