-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] #3197
Comments
I am a maintainer of kiwisolver. I guess that setuptools is confused because kiwisolver is a pure C extensions without any python source. Currently it does not specify a value for py_modules nor for packages. I would appreciate any advice on how to keep things working with the latest setuptools. |
Thank you very much for reporting this. My understanding is that unfortunately there is a clash of 2 behaviours: To make these changes as backwards compatible as possible, I added a condition that only works for packages not using But, going forward my assumption was that it is very common for packages to mix both regular Python code with extensions. So if a project is using I did not foresee that @MatthieuDartiailh, one way to disable auto discovery is to explicitly set If that is a viable alternative, it would help a lot! I was hopping to keep the auto-discovery always on for packages using |
It would work, but actually my setup is broken since in its current state it does not distribute type annotations which I recently added. So I will need to rework the overall structure. I had hoped to get rid of everything but the C extension building in setup.py however this _ExperimentalProjectMetadata warning is a bit frightening. Do you really think you may roll back support for PEP 621 ? |
I hope not, but it is very early to say. It was just released yesterday, and if it break too many projects I might have to roll back before re-working on it again. Given that we are not forced to roll back, usage the
Is this also caused by the latest release? |
No I added those in the last release and apparently I did not properly test apparently. |
Here you mean "[project] table should not change", right ?
|
We observe a similar error (but with different warnings) with
|
Hi @tobni, thank you very much for reporting this. |
Yes sorry @MatthieuDartiailh, I typed that too fast without checking 😅 |
@abravalheri Not in the pyproject.toml, no. I don't know exactly where to look in the setup.py file, the scikit-fmm package uses |
My question was more in the direction of |
Experiment a bit I found another undesirable behavior. Kiwisolver uses setuptools-scm and after modifying the setup.py to include the following directives (which silences the previously reported error for setuptools 61) the installed package in site-packages includes all the C source files and the tests even though they are not requested. With Setuptools <= 60, the install contains just an package_dir={"kiwisolver": "py"},
packages=["kiwisolver"],
install_requires=["typing_extensions;python_version<'3.8'"],
ext_modules=ext_modules,
cmdclass={"build_ext": CppyBuildExt},
package_data={"kiwisolver": ["py.typed", "*.pyi"]}, |
Thanks @MatthieuDartiailh, I will have a look on that too. This is likely related to the fact that the presence of This should have been added to the CHANGELOG. Sorry I forgot that. |
I tried setting |
It appears that through some re-organization of kiwi I managed to circumvent the issue (see the PR). But it may not apply to other packages out there. |
Not sure if this is the same issue, but building scipy with --no-build-isolation fails as well since the setuptools 61.0 update. |
Note that even though it does not break the build the issue of unwanted files being included can also be seen with https://github.com/nucleic/atom |
Hi @TimoRoth and @MatthieuDartiailh, thank you for reporting that. I will add those to my list today. @MatthieuDartiailh, can you give some examples of those unwanted files so I can have a look? Is this related to the fact that the default value of |
Basically all C source files found under atom/src end being installed. What I find confusing with the include_package_data explanation is that even if I set it to False manually in setup.py I still see the same weird behavior. Do you expect that ? |
I will work on that. The current code expects |
I can confirm that settings |
I'm encountering this issue on packages that act solely as a meta package for distributing a collection of related packages via dependencies. The package does not have any source packages or modules. I can confirm that explicitly setting I do still find it strange that what you call an experimental feature in the docs is enabled by default. |
To be fair, I see this behavior is mentioned in your changelog under "breaking changes". That's my bad for not checking there in the first place. |
Hi @sanderr, I am terribly sorry for the trouble and thank you very much for the understanding. |
https://opendev.org/openstack/tripleo-ci/src/branch/master/zuul.d/base-upstream.yaml#L92 adds ^setup.*$ under irrelevant-files and content-provider is parent from tripleo-ci-base-standalone-standard and which parents from tripleo-ci-base-standard. Since setup.* files under irrelevant files so content provider will not run and undercloud, upgrade and standalone job depends on that. It leads to job freeze issue. Putting setup files under irrelevant files fixes the issue. Disable auto discovery as a workaround to fix setuptools 61.0 issue[1] [1]. pypa/setuptools#3197 Related-Bug: #1966382 Signed-off-by: Chandan Kumar (raukadah) <[email protected]> Change-Id: I43b88e356e1f6823f9febe47e9753cf3e5b176c6
- Disable auto discovery in setuptools This is to avoid issues with latest setuptools after version 61.0 For more info see [1] - add bash script to allowlist in tox.ini - use default size for vm memory [1] pypa/setuptools#3197 Change-Id: Iae24917add1aae6b1ed46dba0d2c270b39c5698c
See: pypa/setuptools#3197 (This was preventing builds in binder)
Added fix for 'Multiple top-level modules discovered in a flat-layout' error. Error of Multiple top-level packages occur due to the recent compatibility issue in setuptools. Detailed bug is reported here: pypa/setuptools#3197 The issue also provides a fix. Added py_modules=[], to the setup() argument in setup.py file.
- Use pip-tools' pip-compile command via '.venv/bin/pip-compile' - Note: For pip-compile to work for this project we have to add: ``` [tool.setuptools] py-modules = [] ``` Details here: - jazzband/pip-tools#1711 (comment) - pypa/setuptools#3197 (comment)
- Use pip-tools' pip-compile command via '.venv/bin/pip-compile' - Note: For pip-compile to work for this project we have to add: ``` [tool.setuptools] py-modules = [] ``` Details here: - jazzband/pip-tools#1711 (comment) - pypa/setuptools#3197 (comment)
- Use pip-tools' pip-compile command via '.venv/bin/pip-compile' - Note: For pip-compile to work for this project we have to add: ``` [tool.setuptools] py-modules = [] ``` Details here: - jazzband/pip-tools#1711 (comment) - pypa/setuptools#3197 (comment)
pypa/setuptools#3197 latest release of setuptools 61.0 broke pip install
pypa/setuptools#3197 latest release of setuptools 61.0 broke pip install Signed-off-by: Sagi Shnaidman <[email protected]>
pypa/setuptools#3197 latest release of setuptools 61.0 broke pip install Signed-off-by: Sagi Shnaidman <[email protected]>
With the latest setuptools release (61.0.0) ansible-role-atos-hsm's package build command (python3 setup.py sdist bdist_wheel) started to fail: error: Multiple top-level packages discovered in a flat-layout: ['defaults', 'handlers', 'templates', 'releasenotes']. This issue is mentioned in setuptools bug 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. ansible-lint also released a new version (6.0.0), which has new rules that blocks the gate. As a workaround, this patch caps ansible-lint version <6.0.0 to unblock the gate. [1] pypa/setuptools#3197 Change-Id: I3f827b3ed855ff46292dee7b21b74a622adc472d (cherry picked from commit f5c86df)
With setuptools release 61.0.0 ansible-role-thales-hsm's package build command (python3 setup.py sdist bdist_wheel) started to fail: error: Multiple top-level packages discovered in a flat-layout: ['files', 'defaults', 'handlers', 'templates', 'releasenotes']. This bug is mentioned in setuptools issue 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. ansible-lint also released a new version (6.0.0), which has new rules that blocks the gate. As a workaround, this patch caps ansible-lint version <6.0.0 to unblock the gate. [1] pypa/setuptools#3197 Change-Id: Idb765d09f9498bc13f952c055026e29a46cab8d3 (cherry picked from commit 49970b3)
With the latest setuptools release (61.0.0) ansible-role-atos-hsm's package build command (python3 setup.py sdist bdist_wheel) started to fail: error: Multiple top-level packages discovered in a flat-layout: ['defaults', 'handlers', 'templates', 'releasenotes']. This issue is mentioned in setuptools bug 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. ansible-lint also released a new version (6.0.0), which has new rules that blocks the gate. As a workaround, this patch caps ansible-lint version <6.0.0 to unblock the gate. [1] pypa/setuptools#3197 Change-Id: I3f827b3ed855ff46292dee7b21b74a622adc472d (cherry picked from commit f5c86df) (cherry picked from commit 6a02873)
With setuptools release 61.0.0 ansible-role-thales-hsm's package build command (python3 setup.py sdist bdist_wheel) started to fail: error: Multiple top-level packages discovered in a flat-layout: ['files', 'defaults', 'handlers', 'templates', 'releasenotes']. This bug is mentioned in setuptools issue 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. ansible-lint also released a new version (6.0.0), which has new rules that blocks the gate. As a workaround, this patch caps ansible-lint version <6.0.0 to unblock the gate. [1] pypa/setuptools#3197 Change-Id: Idb765d09f9498bc13f952c055026e29a46cab8d3 (cherry picked from commit 49970b3) (cherry picked from commit 3f88a20)
With setuptools release 61.0.0 ansible-role-thales-hsm's package build command (python3 setup.py sdist bdist_wheel) started to fail: error: Multiple top-level packages discovered in a flat-layout: ['files', 'defaults', 'handlers', 'templates', 'releasenotes']. This bug is mentioned in setuptools issue 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. ansible-lint also released a new version (6.0.0), which has new rules that blocks the gate. As a workaround, this patch caps ansible-lint version <6.0.0 to unblock the gate. [1] pypa/setuptools#3197 Change-Id: Idb765d09f9498bc13f952c055026e29a46cab8d3 (cherry picked from commit 49970b3) (cherry picked from commit 3f88a20) (cherry picked from commit 1a8c645)
With the latest setuptools release (61.0.0) ansible-role-atos-hsm's package build command (python3 setup.py sdist bdist_wheel) started to fail: error: Multiple top-level packages discovered in a flat-layout: ['defaults', 'handlers', 'templates', 'releasenotes']. This issue is mentioned in setuptools bug 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. ansible-lint also released a new version (6.0.0), which has new rules that blocks the gate. As a workaround, this patch caps ansible-lint version <6.0.0 to unblock the gate. [1] pypa/setuptools#3197 Change-Id: I3f827b3ed855ff46292dee7b21b74a622adc472d (cherry picked from commit f5c86df) (cherry picked from commit 6a02873) (cherry picked from commit ebd5421)
I may have misunderstood that workaround - @abravalheri, do you mean to literally write an empty list for Or was your recommended workaround to populate |
@bersbersbers the context for that is a distribution that does not contain any Python packages or modules (so there is nothing really to be imported). If your project contains those, probably the best advice is to follow one of the suggestions in the error message. |
python has some weird autodiscovery mechanisms and it gets rid of the extra files unless it is within the directory. I followed a combination of: - https://setuptools.pypa.io/en/latest/userguide/datafiles.html - https://stackoverflow.com/questions/24347450/how-do-you-add-additional-files-to-a-wheel - https://setuptools.pypa.io/en/stable/userguide/package_discovery.html - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#custom-discovery - pypa/setuptools#3197 (comment) - https://stackoverflow.com/questions/72294299/multiple-top-level-packages-discovered-in-a-flat-layout Failed miserably
Since setuptools release (61.0.0) ansible-collection-openstack's package build command (python3 setup.py sdist bdist_wheel) is finding multiple top-level packages in a flat-layout automatically. This issue is mentioned in setuptools bug 3197 [1], and the suggested workaround is to disable auto-discovery by adding 'py_modules=[]' in setup.py. [1] pypa/setuptools#3197 Change-Id: I4aef1fd59375c4a3bc9e362e7949fa153e4cbcb0
setuptools version
61.0.0
Python version
3.9
OS
Debian Unstable
Additional environment information
No response
Description
kiwisolver 1.4.0 (I haven't checked earlier versions, but kiwisolver 1.4.0 did modernise their build, so issues with earlier versions will likely be to different code) can no build from source. I filed nucleic/kiwi#130 with the kiwisolver developers, but it appears that setuptools 60.10.0 does work. Based on looking at v60.10.0...v61.0.0 and the error message that appears (see output), I think this is related to the new(?) package discovery mechanism. I'm not a kiwisolver developer, so I can't answer questions about their build system (other than link you to the repository), but I'm filing this as it appears to be a regression (give setuptools 61 came out 10 hours ago when I wrote this).
Expected behavior
I expect
pip install kiwisolver
would build a wheel and install it.How to Reproduce
pip install kiwisolver
(given kiwisolver has wheels, you may need to disable using wheels to not download a pre-built wheel).Output
The text was updated successfully, but these errors were encountered: