Skip to content
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

Move metadata from setup.py / setup.cfg to pyproject.toml #1012

Closed
danigm opened this issue Mar 2, 2023 · 13 comments
Closed

Move metadata from setup.py / setup.cfg to pyproject.toml #1012

danigm opened this issue Mar 2, 2023 · 13 comments

Comments

@danigm
Copy link
Member

danigm commented Mar 2, 2023

In the setuptools documentation we can read:

We also recommend users to expose as much as possible configuration in a more declarative way via the pyproject.toml or setup.cfg, and keep the setup.py minimal with only the dynamic parts (or even omit it completely if applicable).

Right now we don't have anything special in the setup.py, just metadata, so it's possible to migrate all to the existing pyproject.toml file.

@fabiobarkoski
Copy link
Contributor

I will try to work on this issue. Do I need to assign myself?

@danigm
Copy link
Member Author

danigm commented Mar 2, 2023

Do I need to assign myself to work on this issue?

Just the comment that you're working on it is okay.

@fabiobarkoski
Copy link
Contributor

Ok, so I'm working on this issue.

@fabiobarkoski
Copy link
Contributor

It's better to reference the license like license = {text = "GPL-2.0-or-later"} or like license = {file = "COPYING"}?
And it's not a good idea to write on README.md to instead of installing the test dependencies separately, install like:

pip install "rpmlint[test]"

or

pip install -e ".[test]"

Since the pyproject.toml allow us to do this.

@Conan-Kudo
Copy link
Member

We haven't moved to pyproject.toml because it doesn't work properly on SUSE distributions. PEP-517 compliance for Python packaging doesn't work there.

@fabiobarkoski
Copy link
Contributor

According to the setuptools docs, the tests_require is deprecated. Can the metadata be migrated to the setup.cfg? Another possibility is to use tox, even nox or just use extras_require instead.

@danigm
Copy link
Member Author

danigm commented Mar 4, 2023

We haven't moved to pyproject.toml because it doesn't work properly on SUSE distributions. PEP-517 compliance for Python packaging doesn't work there.

There's a %pyproject_wheel, to build, and %pyproject_install, to install, macros in python-rpm-macros, and it's even possible to have a simple setup.py and setuptools will use the information in pyproject.toml.

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#configuring-setuptools-using-pyproject-toml-files

So I don't think that packaging is a limitation in this regard anymore.

@danigm
Copy link
Member Author

danigm commented Mar 4, 2023

According to the setuptools docs, the tests_require is deprecated. Can the metadata be migrated to the setup.cfg? Another possibility is to use tox, even nox or just use extras_require instead.

I think that the best idea right now is to just use extras_require with a test extra.

It's better to reference the license like license = {text = "GPL-2.0-or-later"} or like license = {file = "COPYING"}?
And it's not a good idea to write on README.md to instead of installing the test dependencies separately, install like:

We've the COPYING file, so I think it's better to use that instead of just the text version, but I don't have a strong opinion here, so I think anything could be okay.

@Conan-Kudo
Copy link
Member

We haven't moved to pyproject.toml because it doesn't work properly on SUSE distributions. PEP-517 compliance for Python packaging doesn't work there.

There's a %pyproject_wheel, to build, and %pyproject_install, to install, macros in python-rpm-macros, and it's even possible to have a simple setup.py and setuptools will use the information in pyproject.toml.

https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html#configuring-setuptools-using-pyproject-toml-files

So I don't think that packaging is a limitation in this regard anymore.

Ugh, it looks like the interface for packaging differs from Fedora/Mageia...

https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_example_spec_file

That'll make updating the spec file used for CI a bit of a pain. ☹️

@fabiobarkoski
Copy link
Contributor

I think that the best idea right now is to just use extras_require with a test extra.

Alright, I'll make this change. A doubt about the tests: there's a test for installing the package or something similar that will test my change?

@danigm
Copy link
Member Author

danigm commented Mar 6, 2023

I think that the best idea right now is to just use extras_require with a test extra.

Alright, I'll make this change. A doubt about the tests: there's a test for installing the package or something similar that will test my change?

No test needed for the package metadata or dependencies, that's something too basic to test and doesn't involve any code. We just need to make sure that the CI continue working and we should also update the documentation in the README.md file.

I think that the best thing to do is to move all the metadata to the pyproject.toml, but keep the setup.py file in the project for compatibility, but just with

from setuptools import setup

setup()

@fabiobarkoski
Copy link
Contributor

Sure. Seems like the CI installs the majority of packages by zypper/dnf not like pip install -e ., so I'll make my PR with the changes.

@fabiobarkoski
Copy link
Contributor

Currently, the flake8 doesn't support pyproject.toml, so make just the migration of the pytest from setup.cfg?

fabiobarkoski added a commit to fabiobarkoski/rpmlint that referenced this issue Mar 10, 2023
migrated the metadata from setup.py to pyproject.toml
following the recommendation from setuptools docs.

resolve: rpm-software-management#1012
fabiobarkoski added a commit to fabiobarkoski/rpmlint that referenced this issue Apr 4, 2023
migrated the metadata from setup.py to pyproject.toml
following the recommendation from setuptools docs.

resolve: rpm-software-management#1012
fabiobarkoski added a commit to fabiobarkoski/rpmlint that referenced this issue May 22, 2023
migrated the metadata from setup.py to pyproject.toml
following the recommendation from setuptools docs.

resolve: rpm-software-management#1012
@danigm danigm closed this as completed in 9fb2641 Jul 5, 2023
afrid18 pushed a commit to afrid18/rpmlint that referenced this issue Jul 6, 2023
migrated the metadata from setup.py to pyproject.toml
following the recommendation from setuptools docs.

resolve: rpm-software-management#1012
afrid18 pushed a commit to afrid18/rpmlint that referenced this issue Aug 8, 2023
migrated the metadata from setup.py to pyproject.toml
following the recommendation from setuptools docs.

resolve: rpm-software-management#1012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants