RandomWords icon indicating copy to clipboard operation
RandomWords copied to clipboard

Migrate to pep517

Open zahlman opened this issue 1 year ago • 1 comments

This changeset migrates the project to the new standard for building projects, described in PEP 517 – A build-system independent format for source trees, and makes the implementation of the PyTest class and invocation of setup conditional upon successful import of setuptools.command.test.

This Setuptools functionality has been deprecated for many years - and so has the general use of Setuptools as a general "project manager" with extensible functionality for testing/development/etc. Currently, Setuptools is only intended for use to build wheels from sdists, either explicitly via a frontend such as build or implicitly when installing a project with Pip.

The work is split into several commits and the log offers a detailed rationale for each change, with citations of the relevant standards.

This fixes #15 , even for users who get stuck with setuptools==72.0.0.

In addition to making this change, I strongly recommend building and distributing a wheel for the project. Pip also exposes this functionality directly: it's as easy as python -m pip wheel . in the root directory, which produces a .whl file that can be uploaded to PyPI exactly like the sdist (e.g., by using twine). Distributing the project this way is much more convenient for end users, as it skips a completely unnecessary "build" step for this pure-Python project. (Pip cannot install the files directly from an sdist tarball, because it can't know whether setup.py will demand doing something else important.) This way, building is done only once locally, and not repeatedly for/by each user.

zahlman avatar Jul 31 '24 00:07 zahlman

Forgot to mention, it should also be possible to configure pyproject.toml to tell Setuptools what to put in the sdist, too (i.e., so that MANIFEST.in is no longer necessary. I didn't attempt this change locally, but here is the relevant documentation. Note that in particular, the license, readme etc. are included automatically, so the only real concern is the .dat files.

zahlman avatar Jul 31 '24 00:07 zahlman