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

Distutils / setup.py deprecation #146

Open
baldurmen opened this issue Jun 13, 2023 · 1 comment
Open

Distutils / setup.py deprecation #146

baldurmen opened this issue Jun 13, 2023 · 1 comment

Comments

@baldurmen
Copy link
Contributor

Hello,

This project uses the Python distutils module in setup.py.

In Python 3.10 and 3.11, distutils has been formally marked as deprecated. Code that imports distutils will no longer work from Python 3.12.

As such, it's very likely Debian (I'm the current maintainer for pius) won't be able to build this package when the 3.12 transition happens (sometime in late 2023 probably?).

It would probably be a good idea to migrate away from setup.py to a PEP517-compatible build system, using pyproject.toml. Here's the relevant documentation if you want to go with setuptools (there are a lot of other good options, I'm myself partial to flit...)

You can see an example of a migration to pyproject.toml with setuptools that I did here: jaseg/python-mpv#241

@baldurmen baldurmen changed the title Distutils / setup.py for building deprecation Distutils / setup.py deprecation Jun 13, 2023
@baldurmen
Copy link
Contributor Author

It's getting harder and harder to make the current build workflow work in Debian. I started working on a pyproject.toml file, but it seems like it needs more than just dumping a new file and removing setup.py to work:

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "pius"
dynamic = "version"
description = "PIUS: The PGP Individual UID Signer"
readme = "README.md"
authors = [{name = "Phil Dibowitz", email = "[email protected]"}]
license = {file = "COPYING"}
classifiers = [
    "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
]
[project.urls]
homepage = "https://github.com/jaymzh/pius"

[project.scripts]
pius = "pius:main"
pius-keyring-mgr = "pius-keyring-mgr:main"
pius-report = "pius-report:main"

[tool.setuptools.dynamic]
version = {attr = "libpius.constants.VERSION"}

A few things:

  1. This fails because of how the Python scripts are named. pius-keyring-mgr and pius-report should be renamed to pius_keyring_mgr and pius_report.
  2. Data files outside of the package are not supported anymore, so you'll have to drop including the doc and the man page in the Python wheel. See https://setuptools.pypa.io/en/latest/userguide/datafiles.html for more details
  3. Same goes for pius-party-worksheet. Since there's no Python entrypoint (it's a Perl script), it cannot be put in /usr/bin as it used to be.

Data files not being included anymore aren't really a problem in my opinion, since putting them at the right place on people's system is the work of Distros.

I don't use pius a lot anymore and renaming files in a Debian-specific patch is enough trouble that I stopped there. If someone else wants to pick this up and finish the work, it would be nice.

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

1 participant