Skip to content

Modernize build/install to pyproject.toml#457

Open
facundobatista wants to merge 2 commits into
masterfrom
modernize-install
Open

Modernize build/install to pyproject.toml#457
facundobatista wants to merge 2 commits into
masterfrom
modernize-install

Conversation

@facundobatista

Copy link
Copy Markdown
Member

The setup.py was over a decade old and carried a lot of legacy cruft:
distutils.core.setup (removed from the stdlib in 3.12), a hand-rolled regex
version parser, and a CustomInstall class doing platform-specific script
selection plus manual man-page copying. This migrates everything to a
declarative pyproject.toml (PEP 621, setuptools backend).

What changed

Packaging

  • New pyproject.toml replaces setup.py for all metadata.
  • Version is now read dynamically from fades/_version.py:__version__
    (no more regex parsing).
  • The fades command is now a console-scripts entry point
    (fades.main:console_entry_point) instead of the shipped bin/fades /
    bin/fades.cmd scripts. setuptools generates the right launcher per platform
    (including fades.exe on Windows), so the whole CustomInstall /
    platform-selection logic is gone.
  • Added console_entry_point() in fades/main.py (handles FadesError);
    python -m fades now reuses it, so there is a single entry path.

Dependency fixes

  • Dropped setuptools from the runtime dependencies — fades never imports it,
    and it's irrelevant to the child venvs it builds.
  • Promoted packaging from an optional extra to a hard dependency: it is
    imported unconditionally at module top level (parsing.py, helpers.py), so
    pip install fades previously produced a broken install unless packaging
    happened to already be present. pyxdg stays an extra (imported lazily, with
    a fallback).

The one remaining setup.py

  • A 3-line shim survives, solely to install the man page under
    share/man/man1 via data_files. PEP 621 has no equivalent, and modern
    setuptools rejects data_files in pyproject.toml. It's consumed by
    pip --prefix, the Debian pybuild flow and the snap build.

Callers updated

  • test, testdev, testdev.bat, build_readmepython -m fades
    (build_readme no longer relies on setup.py --long-description).
  • .github/workflows/integtests.yaml → runs via -m fades; the minimum
    supported Python is now read from requires-python in pyproject.toml.
  • HOWTO_RELEASE.txtpython -m build instead of ./setup.py clean sdist.

Verification

  • python -m build produces a valid sdist + wheel; sdist includes man/,
    COPYING, AUTHORS, README.rst.
  • Fresh pip install of the wheel pulls packaging automatically and does
    not install setuptools.
  • fades -V and python -m fades -V both work; a usage error exits non-zero
    (FadesError handled).
  • Man page installed to <prefix>/share/man/man1/fades.1.
  • flake8 + pydocstyle clean; full unit suite passes (291 tests).

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

Successfully merging this pull request may close these issues.

1 participant