{{{
[build-system]
requires = ['setuptools>=40.8.0', 'wheel']
build-backend = 'setuptools.build_meta:__legacy__'
}}}
The wheel dependency is redundant and discouraged here. Setuptools adds
this dependency via the backend automatically since day one. It was
historically included in the documentation but it was a mistake. See:
https://github.com/pypa/setuptools/commit/f7d30a9529378cf69054b5176249e5457aaf640a
The legacy backend was never supposed to be used in pyproject.toml. It is
only an "internal" fallback that is used by tools like pip when
pyproject.toml is not present at all. The regular backend must always be
used in pyproject.toml. See:
https://github.com/pypa/setuptools/issues/1689
--
Ticket URL: <https://code.djangoproject.com/ticket/33778>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Florian Apolloner, Nick Pope (added)
* component: Uncategorized => Packaging
* stage: Unreviewed => Accepted
Comment:
Thanks for the report.
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:1>
Comment (by Florian Apolloner):
> The wheel dependency is redundant and discouraged here. Setuptools adds
this dependency via the backend automatically since day one. It was
historically included in the documentation but it was a mistake. See:
https://github.com/pypa/setuptools/commit/f7d30a9529378cf69054b5176249e5457aaf640a
Mhm, I can remember that some frontends did need it, not 100% sure though
nowadays
> The legacy backend was never supposed to be used in pyproject.toml. It
is only an "internal" fallback that is used by tools like pip when
pyproject.toml is not present at all. The regular backend must always be
used in pyproject.toml. See:
https://github.com/pypa/setuptools/issues/1689
This is a little bit more tricky. The problem here is that the presence of
`pyproject.toml` changes behavior. Hence our fix was using the
`__legacy__` backend. Most importantly `pip install -e` wouldn't work
otherwise.
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:2>
Comment (by Carlton Gibson):
[https://github.com/django/django/pull/13994#issuecomment-776727097 Not
explicitly declaring this was raised and rejected on the original PR].
Unless something has changed this would be `wontfix`? 🤔
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:3>
Comment (by Michał Górny):
Well, unless I'm testing wrong, after changing pyproject.toml to:
{{{
[build-system]
requires = ['setuptools>=40.8.0']
build-backend = 'setuptools.build_meta'
[tool.black]
target-version = ['py38']
extend-exclude = 'tests/test_runner_apps/tagged/tests_syntax_error.py'
}}}
editable install just works™:
{{{
$ pip install -e .
Obtaining file:///tmp/django
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.2-py3-none-any.whl (42 kB)
Collecting asgiref<4,>=3.4.1
Using cached asgiref-3.5.2-py3-none-any.whl (22 kB)
Installing collected packages: sqlparse, asgiref, Django
Running setup.py develop for Django
Successfully installed Django-4.0.6.dev20220613071132 asgiref-3.5.2
sqlparse-0.4.2
}}}
This is with pip-22.0.4 (as injected into venv by Python).
Note that [https://peps.python.org/pep-0660/ PEP 660] explicitly
provisions for editable installs.
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:4>
Comment (by Florian Apolloner):
Hi, it is great to hear that this works nowadays. What happens with an
older pip like on ubuntu 18.04 or 20.04? Though I guess it would be okay
to say that editable installs are not supported there.
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:5>
Comment (by Michał Górny):
I've tested a bunch of old pip version with these changes (and the hack
from `setup.py` removed) and FWICS:
- pip 10.0.1 (Apr 2018) complains about the missing `wheel` dependency
because it "does not implement PEP 517 so it cannot build a wheel without
'setuptools' and 'wheel'" but I don't think that's very relevant
- I was able to `pip install -e .` correctly with all versions down to 9.0
(Nov 2016); older versions seem to be broken with Python 3.9
Just in case, I've also tried downgrading setuptools and managed to get
`pip install -e .` working down to setuptools 41.1.0 (Aug 2019); older
versions seem to be broken with Python 3.9.
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:6>
Comment (by Rui):
Replying to [ticket:33778 Michał Górny]:
hello,I'm new to package program, what means to used incorrect legacy
backend?how to fix it? Besides,just need to remove duplicated 'wheel'
requires?
> The pyproject.toml file lists the following:
>
> {{{
> [build-system]
> requires = ['setuptools>=40.8.0', 'wheel']
> build-backend = 'setuptools.build_meta:__legacy__'
> }}}
>
> The wheel dependency is redundant and discouraged here. Setuptools adds
this dependency via the backend automatically since day one. It was
historically included in the documentation but it was a mistake. See:
https://github.com/pypa/setuptools/commit/f7d30a9529378cf69054b5176249e5457aaf640a
>
> The legacy backend was never supposed to be used in pyproject.toml. It
is only an "internal" fallback that is used by tools like pip when
pyproject.toml is not present at all. The regular backend must always be
used in pyproject.toml. See:
https://github.com/pypa/setuptools/issues/1689
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:7>
Comment (by Florian Apolloner):
Replying to [comment:6 Michał Górny]:
> I've tested a bunch of old pip version with these changes (and the hack
from `setup.py` removed) and FWICS …
Ok, that sounds good, I guess we can really change that for the main
branch then. After all we require rather new pythons nowadays :)
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:8>
* owner: nobody => Adit Krishnan
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:9>
Comment (by Adam Johnson):
Thank you for reporting this, I've updated [https://adamj.eu/projects/ my
maintained packages] as a result.
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:10>
* owner: nobody => badziyoussef
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:11>
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/15954 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:12>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"247e25897b1682a1c15f240d780eb81ca01e0a5a" 247e2589]:
{{{
#!CommitTicketReference repository=""
revision="247e25897b1682a1c15f240d780eb81ca01e0a5a"
Fixed #33778 -- Updated build-system configuration.
This removes unnecessary wheel dependency and __legacy__ fallback.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33778#comment:13>