python / python/cpython

Move vendored modules into a `vendor` directory

Ouverte
#129,222 32 commentaires 5 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

build type-feature
Langage dominant
Python
Étoiles
77.2k
Forks
36k
Métriques de merge des PR
Métriques de PR en attente

Description

Feature or enhancement

Proposal:

In CPython, we have some vendored libraries namely libmpdec, hacl, and expat. Those libraries are meant to be clone of their upstream (think of them as git submodules) and many times have I been exluding them from code search as they usually have non-CPython code involved.

We have a plan to remove vendored libmpdec (#115119) and we're almost here. In the long term, we could also try to unvendor expat (probably not hacl as it's used to implement hash functions fallbacks when OpenSSL is not present).

Affected modules:

  • libmpdec
  • expat
  • _hacl

Some advantages:

  • Easy exclusion of vendored modules from code search.
  • Easy addition and deletion of vendored modules.
  • We don't expect redistributors to edit vendored code (especially not hacl).
  • Hopefully less work than the Python/Programs split
  • Could be using git submodules (though this requires an internet connection, so maybe not)

Some inconvenients:

  • Quite painful refactoring since it would affect existing PRs.
  • Quite painful refactoring since it would affect distributors editing those files.

We can start with some modules that should be kept untouched such as HACL* sources and progressively move the others to reduce the work and conflicts. It doesn't need to happen in one go (for instance, we may well ignore the libmpdec case if we manage to make it unvendored before). I don't think we have much open PRs with expat (by the way, we could have a refresh script for expat to ease maintenance like https://github.com/python/cpython/issues/126623).

Now, the question is how this could affect downstream redistributors. I'm asking first on Github since I don't know whether they are active on Discourse or not. If everyone tells "it's fine", then I'll ask on Discourse to see if there are more redistributors that could be concerned.

cc

  • @zooba (Windows)
  • @mhsmith (Android) ✅
  • @doko42 / @stefanor (Ubuntu/Debian)
  • @mitya57 (Debian)
  • @hroncok / @vstinner (Fedora/RHEL) ✅
  • @mgorny (Gentoo) ✅
  • @danigm / @mcepl (openSUSE) ✅
  • @freakboy3742 / @ned-deily (macOS / iOS) ✅
  • @zanieb (relocatable builds)
  • @hugovk / @erlend-aasland (CPython)
  • @mweinelt (NixOS) ✅
  • @gpshead / @ncoghlan / @brettcannon / @zware (involved through Discord messages or reactions)

I don't know how moving mimalloc related stuff would affect the free-threaded build in particular, so I'm also going to ask @kumaraditya303 and @colesbury about it. EDIT: Turns out it's a no go for mimalloc as there is some CPython dedicated stuff, so we can put it out of the list (see https://github.com/python/cpython/issues/129222#issuecomment-2610160032).

For the hacl includes, I can take care of it.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par examiner comment les modules vendored concernés—libmpdec, expat et _hacl—sont organisés et référencés dans CPython, puis évaluez les préoccupations des redistributeurs en aval soulevées dans la discussion. Le travail est considéré comme terminé lorsqu’une organisation des répertoires et un plan de migration prenant en compte les utilisateurs du build, les distributeurs et les modules susceptibles de rester vendored ont été convenus.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
build-system
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.