Automatic find using pyproject.toml broken? #3944
Replies: 4 comments
-
Hi @penguinpee, please find my comments about the 2 questions below:
Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your explanation. I tried without any setuptools table at all. That gave me the following:
Somehow the automatic discovery determines
Okay. So I add the following to
Now the package builds, but, of course, previously excluded stuff is once again included. I don't think that approach works (well). I gave an If this were my package, I'd go for a src layout. Much cleaner. Just keep everything that's not module related outside Anyway, for the time being I will have to deal with the current layout. The documentation mentions 'New in 61.0.0'. On F37 we are currently having I meanwhile switched to using:
I have dropped the However, I find the current behavior of setuptools with PS: I will be afk for some time. I will read and reply to any follow up when I get a chance. But I don't know when that will be exactly. |
Beta Was this translation helpful? Give feedback.
-
Hi @penguinpee, my suggestion in the previous post for your case my suggestion would be: [tool.setuptools.packages.find]
include = ["palettable*"]
exclude = ["*.test"] This is probably the most robust method. In theory, just listing
In Python any folder is a valid package. If you start a Python REPL in the project root and try to run
If users want to do something custom, it is only fair that they have complete control over the include/exclude list. Some projects may use names that are excluded by default, so keeping the default exclude list creates a different problem. My personal opinion is that |
Beta Was this translation helpful? Give feedback.
-
First of all, my apologies for getting back to you only now. I didn't find the time to pick this up again after my vacation until now. Let's hope I can still put together all the pieces...
I'm using that now. And it seems to work. I forgot to use the asterisk previously. It's a bit obnoxious. Why would I want to exclude submodules? If I do, I could achieve that using an explicit
Not sure I can provide you with a minimal reproducer. But the builds I ran and their output is still available. Build 6017925 is the build that failed in F37, but succeeded with deprecation warnings in F38 and rawhide (the Fedora development / next release branch).
Yeah. Meanwhile I learned that even empty directories are considered (sub)modules wrt to package discovery.
My suggestion would improve on that, I think. As I explained before, it doesn't make much sense defining an exclude list, just to discover that it entails an include of previously automagically excluded modules. So, adding a bool enhances the level of control users have, instead of discovering setuptools quirks the hard way, like I had to.
👍
How about reducing the number of configuration options? I know this will potentially break packages. But the current situation doesn't sound very maintainable either. Maybe something for the long run. Just my $0.02. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
TL;DR
How does one configure setuptools in
pyproject.toml
using automatic discovery, that honors the described exclude list? What has changed making the givenpyproject.toml
work on newer Python tools (with deprecation warning), but silently fail in older versions of the tool?I'm a Fedora packager and one of the packages I maintain has recently changed to using pyproject.toml for setuptools. The've dropped setup.cfg completely. This lead to a number of issues trying to build in the Fedora build environment, which builds a wheel from the sources, installs it and runs tests.
There's a couple of issues I saw. Let me describe them one by one.
Setuptools find exclusion of directories (flat layout) not working
The upstream
pyproject.toml
uses:That lead to all directories being included in the module. That is
docs/
,scripts/
andtest
are included, even though according to the documentation they should be filtered out.So, I added an explicit
include = ["palettable"]
to make this work. Upstream merged that into master. However, it only partially solved the issue.Deprecation warning and build failure
Running the build with the patched
pyproject.toml
succeeded in F38 and rawhide (Fedora development branch), but failed in F37. In F38 and rawhide a deprecation warning was shown:This repeats for every submodule. But they are being added to the wheel in the end.
In F37 all the submodules are left out without any warning or error:
The versions of the involved packages only differ in minor / patch versions between F37 and F38, if at all. With python-setuptools-wheel being the only package with a different major version.
Beta Was this translation helpful? Give feedback.
All reactions