Outils pour utilisateurs

Outils du site


lang:python:wheel

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
lang:python:wheel [2024/10/08 15:23] – Création premier jet rootlang:python:wheel [2025/11/10 12:17] (Version actuelle) – Ajout de "abi3audit" root
Ligne 1: Ligne 1:
-====Création d'un paquet====+=====Création d'un paquet=====
  
   * Génération du paquet   * Génération du paquet
Ligne 21: Ligne 21:
 </code> </code>
  
 +=====cibuildwheel=====
 +
 +[[https://cibuildwheel.pypa.io/en/stable/|Site web]] [[https://cibuildwheel.pypa.io/en/stable/options/#build-skip|Options]]
 +
 +Il permet de compiler le projet pour n'importe quelle version de Python.
 +
 +Ce n'est intéressant que si le module python contient du code compilé et doit être compilé pour toutes les versions de Python compatibles.
 +
 +Uniquement testé sous Windows pour générer des versions pour Windows.
 +
 +Il va télécharger toutes les versions de Python nécessaires et exécuter ''wheel'' pour générer le paquet pour chaque version.
 +
 +<code bash>
 +python.exe -m pip install cibuildwheel
 +python.exe -m cibuildwheel --output-dir wheelhouse --platform windows
 +</code>
 +
 +Il se configure avec le fichier ''pyproject.toml''.
 +
 +<code ini>
 +[tool.cibuildwheel]
 +build-verbosity = 1
 +build-frontend = { name = "pip", args = ["--no-clean"] }
 +test-command = "python -m unittest discover {project}/test/python"
 +
 +[tool.cibuildwheel.windows]
 +build = [
 +    "*-win_amd64"
 +]
 +skip = [
 +    "cp37-win_amd64"
 +]
 +
 +enable = ["pypy", "pypy-eol"]
 +
 +# Devrait être dans build-system.requires mais cela n'a pas fonctionné pour moi. https://cibuildwheel.pypa.io/en/stable/options/#before-build
 +before-build = "pip install cmake==4.0.3"
 +# N'est pas encore officiellement automatique. https://cibuildwheel.pypa.io/en/stable/options/#repair-wheel-command
 +repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"
 +</code>
 +
 +=====manylinux=====
 +
 +[[https://github.com/pypa/manylinux|Site web]]
 +
 +Fournit des images Docker avec toutes les versions de Python pour générer les wheel pour Linux avec la glibc et musl.
 +
 +Rien n'est automatisé. Les installations de Python sont dans ''/opt/python/*/bin/python'' au format ''cp38-cp38'' / ''cp314-cp314t'' / ''pp311-pypy311_pp73''.
 +
 +''cibuildwheel'' supporte ''manylinux'' mais je ne l'ai pas testé.
 +
 +=====abi3audit=====
 +
 +[[https://github.com/pypa/abi3audit/|Site web]]
 +
 +Vérifie que le fichier wheel généré est compatible ''abi3'' stable. ''free-threading'' n'est pas ''abi3''.
 +
 +Un wheel indique via son nom la version minimale de Python et s'il est ''abi'' stable. Le fichier ''nh3-0.3.2-cp38-abi3-win_arm64.whl'' est ''abi3'' stable avec une version minimale de Python de 3.8.
 +
 +Exemple :
 +
 +<code bash>
 + abi3audit toto-1.3.1-cp38-abi3-win32.whl --verbose
 +[11:38:42] 👎 toto-1.3.1-cp38-abi3-win32.whl: bindings.cp314t-win32.pyd has non-ABI3 symbols
 +           👎 toto-1.3.1-cp38-abi3-win32.whl: bindings.cp314t-win32.pyd uses the Python 3.13
 +           ABI, but is tagged for the Python 3.8 ABI
 +           ┌────────────────────────────┬──────────┐
 +           │ Symbol                     │ Version 
 +           ├────────────────────────────┼──────────┤
 +           │ PyUnstable_Module_SetGIL   │ not ABI3 │
 +           │ _Py_DecRefShared           │ not ABI3 │
 +           │ PyMutex_Lock               │ not ABI3 │
 +           │ PyFrame_GetBack            │ not ABI3 │
 +           │ PyMethod_Type              │ not ABI3 │
 +           │ PyInstanceMethod_New       │ not ABI3 │
 +           │ _PyObject_GetDictPtr       │ not ABI3 │
 +           │ PyThreadState_GetUnchecked │ not ABI3 │
 +           │ PyObject_ClearManagedDict  │ not ABI3 │
 +           │ _PyType_Lookup             │ not ABI3 │
 +           │ PyInstanceMethod_Type      │ not ABI3 │
 +           │ PyObject_LengthHint        │ not ABI3 │
 +           │ PyObject_VisitManagedDict  │ not ABI3 │
 +           │ PyMutex_Unlock             │ not ABI3 │
 +           │ _Py_MergeZeroLocalRefcount │ not ABI3 │
 +           │ PyFrame_GetLineNumber      │ 3.10     │
 +           │ PyUnicode_AsUTF8AndSize    │ 3.10     │
 +           │ PyObject_CheckBuffer       │ 3.11     │
 +           │ PyObject_GenericGetDict    │ 3.10     │
 +           │ PyDict_GetItemStringRef    │ 3.13     │
 +           │ PyObject_GetBuffer         │ 3.11     │
 +           │ PyBuffer_Release           │ 3.11     │
 +           │ PyFrame_GetCode            │ 3.10     │
 +           │ PyCMethod_New              │ 3.9      │
 +           │ PyInterpreterState_Get     │ 3.9      │
 +           └────────────────────────────┴──────────┘
 +           💁 toto-1.3.1-cp38-abi3-win32.whl: 1 extensions scanned; 1 ABI version mismatches and
 +           15 ABI violations found
 +</code>
lang/python/wheel.1728393805.txt.gz · Dernière modification : de root