Skip to content

Adopt distutils #417

Closed
Closed

Description

Originally reported by: jaraco (Bitbucket: jaraco, GitHub: jaraco)


Setuptools builds on the distutils framework of the Python Stdlib. Doing so has benefits of depending on a standard, extensible framework, but also has downsides, such as limiting the advancement of distutils (across many Python versions) but simultaneously adding monkey patches to patch bugs in distutils.

I'd like to consider if Setuptools should adopt distutils (or a version of it). Doing so would decouple Setuptools from distutils, freeing Setuptools from the constraints of distutils and freeing distutils from the expectations of Setuptools.

Doing so would allow distutils to adapt at the same pace as Setuptools, addressing issues and vetting patches that could be ported back to distutils in CPython.

I've once proposed this idea and it was promptly dismissed by @RonnyPfannschmidt. Why is vendoring distutils in Setuptools not an option?


Activity

  1. jaraco commented on Oct 25, 2017

    @jaraco
    Member

    @xoviat : To answer your question from the other ticket, I'd very much appreciate a PR.

  2. jaraco commented on Nov 12, 2017

    @jaraco
    Member

    Distutils branch now exists, created against the latest master. Is that what you had in mind?

  3. 15 remaining items

  4. ncoghlan commented on May 27, 2018

    @ncoghlan
    Member

    While CPython as a whole has many contributors, we don't have many folks contributing to distutils any more - folks need build tools that let them target currently deployed versions of Python, which setuptools provides, but distutils really doesn't.

    So the challenge for pypa/packaging-problems#127 is as follows:

    • assume that in some future version of Python (3.9? 3.10? 4.0? We dunno yet) distutils is no longer in the standard library per se, but is instead bundled the way we bundle pip (i.e. by installing it from a wheel at Python installation time).
    • eventually, for new Python versions (where distutils isn't in the standard library), we'd like the "real" distutils code to live in setuptools, and the code you get when you do import distutils to just be a backward compatibility shim that aliases the setuptools components into the right place
    • however, for old Python versions (where distutils is still in the standard library), then setuptools will still need to do its monkeypatching magic to allow plain distutils projects to emit the installation database metadata and to be built as wheel archives

    The scope of the eventual distutils-compat shim probably wouldn't need to be the full distutils API, but it wouldn't be the empty set either.

    So @jaraco's suggestion sounds like a reasonable starting point to me: give setuptools its own pre-patched copy of distutils so it can work on a distutils-free copy of Python, without providing an importable distutils facade.

    Building a suitable facade (with a setuptools dependency) would then be part of removing distutils from the standard library.

  5. pganssle commented on May 27, 2018

    @pganssle
    Member

    As an aside about implementing this, I could be way over-estimating the abilities of the average student, but this feel like approximately the right size project for a GSoC student. Too late for this year I'm sure, but if this isn't done by next year we might want to consider applying.

  6. RonnyPfannschmidt commented on May 27, 2018

    @RonnyPfannschmidt
    Contributor

    @pganssle while you consider the abilities of a student right, i believe there is an underestimation on the complexity of legacy not so nice apis and their interaction in setuptools - unfortunately both codebases are already hard to navigate, and their interaction makes things even more tricky

  7. added
    Needs TriageIssues that need to be evaluated for severity and status.
    Needs ImplementationIssues that are ready to be implemented.
    and removed
    Needs TriageIssues that need to be evaluated for severity and status.
    on Oct 19, 2018
  8. pradyunsg commented on Dec 6, 2019

    @pradyunsg
    Member

    unfortunately both codebases are already hard to navigate

    As a past GSoC student, the thing that hits hard "right in the face" is the technical debt -- working with and around it, is very much not something that formal education prepares students for.

    Anyway, now would be a good time to get started on figuring out GSoC-sized projects within the PyPA and identifying mentors for them, if we're interested in having projects under PSF's GSoC umbrella for 2020 with decent amount of preparation/planning.

  9. jaraco commented on May 31, 2020

    @jaraco
    Member

    In #2143, I've drafted a PR that adopts Setuptools from CPython master, retaining history and attribution. This is essentially the second step outlined in pypa/packaging-problems#127. I've asked a few key contributors to review, but I welcome review or comments or questions from anyone.

  10. hugovk commented on May 31, 2020

    @hugovk
    Contributor

    This is essentially the second step outlined in pypa/packaging-problems#217.

    Typo, it's really: pypa/packaging-problems#127 :)

  11. jaraco commented on Jul 3, 2020

    @jaraco
    Member

    The Setuptools 48 release incorporates the fix and closes this issue, although there is still a lot of work to do to actually merge the functionality and remove the monkey patching.

  12. 77FN7 commented on Oct 16, 2022

    @77FN7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions