-
Notifications
You must be signed in to change notification settings - Fork 281
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
build: Migrate from setup.py to pyproject.toml #566
Conversation
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by yamllint, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. An alternative could have been to use Poetry, see the dedicated pull request and discussion [^3]. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. Closes #509. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: #557
@DimitriPapadopoulos @staticdev @ssbarnea @barrelful following your remarks from #509 and #557, could you test this pull request (at least |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must remove setup.py
or you really fail to implement PEP-621 which is what the title claims. Still, if you want to make the switch in several PRs, it is ok.
No feedback on this after one week, so I'll merge now. |
@adrienverge as commented by @ssbarnea, you need to delete setup.py to get it working properly. |
Have a look at the new # This is only kept for backward-compatibility with older versions that don't
# support new packaging standards (e.g. PEP 517 or PEP 660):
setup() If you know another way to build / install the package with setuptools < 61 and without Also it's not too late if you want to try and answer #566 (comment) 👍 |
@adrienverge I don't have a solution using setuptools, maybe why I don't use it. But I know this is not compliant with PEP-517. To be compliant with all packaging peps, I would say only solution I know is hatch (a middle ground between poetry and setuptools-scm). It was just merged on a lib I am also maintainer: sigmavirus24/github3.py#1142 |
I didn't find anything stating this in PEP 517, could you give more details? My reading of the PEP suggests that it's OK to keep
|
My mistake then, but I remember I actually had problems having both when I was packaging. You might have unintended behaviour since it can use |
But |
Yes, best thing now since it is merged is observe if there is any problem. The alternative solution in this case could be hatch. I am playing with it right now, looks good. |
Wait, also this shouldn't be needed by those distros to install the package, just to build. What do you need to build yamllint in them since Github Actions can do it with latest setuptools? |
You're right about it @staticdev. A recent version of Lines 43 to 45 in 98f2281
The compatibility |
Actually it's not that simple; for example for CentOS 8/9 packages (which I maintain), the only setuptools versions available are 50/53 (and obviously you cannot use pip nor anything from the internet to update anything), so we need a |
The |
Yes 👍 I already spent some hours on this legacy/stable Linux distro packaging. Please share if you have a fully working .spec file to build the .rpm package for CentOS 8 (for example) where only setuptools == 50 is available (you'll probably have to use the old macros |
Indeed, The following paragraph from the Python Packaging User Guide is about installing from sources, but clearly it has to apply to building as well:
Unless you manage to update to a newer |
Agreed 👍 For info, the latest setuptools documentation about
|
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using `setup.py` is deprecated and the new recommanded way is to declare a `pyproject.toml` file (see PEP 517 [^1]). This commit proposes to use setuptools to achieve that, because setuptools is already used by localstripe, is standard and referenced by the official Python packaging documentation [^2], and seems to be the most lightweight solution. For some period, the `setup.py` file will be kept (although almost empty), to allow old tools versions to keep working. I have done the same migration for yamllint 7 months ago [^3] and it appeared to work well. [^1]: https://peps.python.org/pep-0517/ [^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/ [^3]: adrienverge/yamllint#566
Using
setup.py
is deprecated and the new recommanded way is to declare apyproject.toml
file (see PEP 517 1).This commit proposes to use setuptools to achieve that, because setuptools is already used by yamllint, is standard and referenced by the official Python packaging documentation 2, and seems to be the most lightweight solution. An alternative could have been to use Poetry, see the dedicated pull request and discussion 3.
For some period, the
setup.py
file will be kept (although almost empty), to allow old tools versions to keep working.Closes #509.
Changes to RPM package
Footnotes
https://peps.python.org/pep-0517/ ↩
https://packaging.python.org/en/latest/tutorials/installing-packages/ ↩
https://github.com/adrienverge/yamllint/pull/557 ↩