-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Config settings support in PEP 517 #5771
Comments
The |
I'm just going to go ahead and pin this, because we should really remember that this has to be done still. |
I still don't think this is urgent. There's been little or no movement on backends making use of the config settings options, and essentially no demand from pip's end users. I'm inclined to think that it might have been better if PEP 517 hadn't included |
If implemented this would give us a route to deprecate and remove the special cases we have for |
Perhaps, but we've crossed that bridge now. :( TBH, I don't think most users would discover that unimplemented functionality that is "only documented in a PEP", which could be the reason for the lack of end-user demand -- I don't know that I want something, if I don't know that thing exists. |
What about:
and we can accept it multiple times. This gives us a few nice properties:
There are also a few downsides:
This could be mitigated by only supporting A few other things to consider, in general:
|
I just stumbled upon this issue when I tried to pass some extra arguments to the setuptools backend.
Is there a specific reason why Potentially, the documentation could be expanded as well. It still reads as if On a related note, the new config UI should probably be designed to still allow installing wheels of PEP 518 build dependencies (?). As for my use case: I have a Cython project and have implemented an extra command to transpile the |
@pskopnik I think it's a matter of designing + implementing the behavior in pip's implementation. |
I'm looking at (finally) implementing this functionality, at least in part in anticipation of the setuptools PEP 660 support having two modes which the user could select via a config option. Reviewing the discussion here, what I propose is as follows:
In general, behaviour will follow I'd appreciate comments on the design, and on the feasibility of the proposal. However if anyone wants to propose something more complex (such as per-call settings as per item 6, or per-package settings as per 7) then please be prepared to suggest a modified syntax that covers it. The reason I'm keeping things simple is precisely because I don't know how to make a good UI for more complicated possibilities, so saying "you need to cover X" without explaining how, will probably just result in this getting stalled. Also, if backend developers want to suggest constraints or features that they need, I'd appreciate such suggestions coming with a proposed syntax (same reason). /cc @abravalheri for views on whether this will work for setuptools. |
I prefer interpreting The rest of the points all sound good to me in general.
Does One point to the semantic. Does setting |
That makes sense to me. I'm happy to do this in place of my original proposal, and treat unsetting a key as YAGNI (for now at least).
As far as I can tell,
I don't intend that it does. I would expect that the settings would be used if a PEP 517 hook is called, but would not change the decision as to whether to call one. If you want to ensure building from source, you should use This means that specifying config settings might do nothing, and could end up using a wheel built with different settings. My view is that's a rare enough situation that I don't want to worry about it for now. After all, there's nothing in a built wheel to say what config settings were used, so there's nothing we could do about it anyway1. On the same principle, I don't intend to try to warn if config settings get ignored (that is possible, but would require adding checks to a bunch of code paths that don't currently need to care about config settings). Basically, if you want to be sure, use Footnotes
|
Sounds good to me. The problem that a wheel may have mismatching config settings can probably be better resolved if we could record the config settings in wheel metadata, which would also help with other wheel-tagging problems such as GPU information. For now, we can perhaps rely on documentation. |
Thank you very much @pfmoore for looking into this. As discussed in https://discuss.python.org/t/pep-660-and-setuptools/14855/18, I also agree with expecting backends to ignore the values of Is there any plans to include a handy alias like Just one clarification: Would python3 test.py arg="with multiple words"
# sys.argv => ['test.py', 'arg=with multiple words']
python3 test.py arg='with multiple words'
# sys.argv => ['test.py', 'arg=with multiple words'] |
It's not hard to add an alias, but I'm reluctant to use up a 1-character option for something this uncommon. I suggest not doing so initially, and if users complain that it's too verbose, we can add an abbreviation later.
That's essentially down to your shell's (plus the C runtime's on Windows), quoting rules, but basically yes:
should work pretty well everywhere. Single quotes, or just quoting the value rather than the whole Footnotes
|
Draft PR now available as #11059 |
That aforementioned PR has landed. :) |
This option to build the C extension is only used in the wheel building process. cibuildwheel does not appear to support an ability to pass options to setuptools, and even if it did there appears to be no support for pip installing wheels with flags like '--build-option' (see pypa/pip#5771). This commit also updates our build-wheels script to use this env var, even though those scripts are more or less deprecated.
* pyproject.toml updates to support cibuildwheel * drop '--build-ext' option in setup.py for env var This option to build the C extension is only used in the wheel building process. cibuildwheel does not appear to support an ability to pass options to setuptools, and even if it did there appears to be no support for pip installing wheels with flags like '--build-option' (see pypa/pip#5771). This commit also updates our build-wheels script to use this env var, even though those scripts are more or less deprecated. * add first cut at build_wheels github action * tell build_wheels action about pydarshan directory * checkout autoperf submodule before building wheels * pin matplotlib<3.5 for cibuildwheel test phase see gh-479 for more details * avoid macos builds for now * move cibuildwheel linux specific bits * only build cpython, re-enable macos builds * install automake on macos * bug fix in specifying cibuildwheel before-all * debug pypy 3.9 builds * add more brew dependencies for macos * skip pypy builds, as well as ppc/s390x * explicitly specicy repair wheel commands * restrict when wheels are built for now, just runs manually via GitHub actions, or by appending a message to the commit message * add dummy file to test commit message wheel hooks [wheel build] * forgot part of the github workflow config [wheel build] * actually add the get commit message job [wheel build] * let's try one more time... [wheel build] * allow manual running of wheels workflow * update release checklist to reflect wheel changes
PEP 517 provides a method, config settings, for supplying arbitrary configuration to a build backend. There are no defined semantics for this argument, although there is an example in the PEP showing how pip "might" map command line arguments onto
config_settings
.The setuptools backend appears to implement a part of this suggested interface (it processes a
--global-option
key in essentially the way the PEP implies). The flit backend completely ignoresconfig_settings
.Pip needs a user interface (command line options) to allow users to supply config settings to a backend - but without any agreed semantics, there's probably not much we can do beyond allowing users to specify key/value pairs. It's possible that PEP 518 (or some similar standard) should be extended to allow projects to specify
config_settings
in the project build metadata?Finally, there's pip's
--python-tag
option. This currently maps directly to a specific setuptools command line option. Due to the lack of common semantics, there's currently no way to support this under PEP 517 in a backend-neutral way. It may be worth (for the fallback use of the setuptools backend only? as a "better than nothing" approach for all backends?) mapping it toSo, actions to consider:
config_settings
(my view: out of scope for pip)config_settings
(my view: a minimal--build-settings key:value
for now)requirements.txt
(my view: allow--build-settings
in there)--python-tag
(my view: translate to--global-option
for now, review later)Also, apart from the short-term approach for
--python-tag
, I propose not implementing any of this until after base PEP 517 support is released. Without more comprehensive buy in from backends, it's hard to see what formconfig_settings
usage will ultimately take, and it's backends that should drive this, not frontends.The text was updated successfully, but these errors were encountered: