PEP 517 构建系统的流行度

  • PEP 517 Impact: In 2017, PEP 517 changed Python packaging. Before it, setuptools had a monopoly. PEP 517 enabled a 'black box' build approach with only two mandatory and up to five optional functions. Many new build systems were created.
  • Methodology: Investigated most popular PyPI packages. Downloaded source dists, unpacked relevant files. Wrote scripts to analyze dists and process results.
  • Popular Build Systems:

    • Setuptools: Used by almost 79% of tested packages. 7 out of 10 using it don't declare a build backend.
    • Poetry: 8.4% of packages.
    • Hatchling: 6.5% of packages.
    • Flit: 3.8% of packages.
    • Others: 2.6% of packages, including Maturin, scikit-build-core, meson-python.
  • Setuptools Config Formats: Setuptools supports setup.py, setup.cfg, and pyproject.toml. setup.py is the oldest and most flexible but can lead to mistakes. setup.cfg supports common options. pyproject.toml is based on PEP 621.
  • Build System Dependencies: PEP 517 specifies two sources for build deps: build-system.requires in pyproject.toml and those returned by the build backend function. Many packages had issues with dependencies or file missing.
  • Plugins Popularity: Plugins for different build systems were analyzed. Versioning plugins like setuptools-scm were popular. Extensions build plugins like Cython were also used. Many plugins were only used by a few packages.
  • Conclusion: Analyzed popularity using data from 8000 most popular PyPI packages. Many packages don't provide source dists or have bugs. Setuptools is still the most used. People often choose build systems based on tools they use. Many packages use multiple config formats. Some plugins are superseded. Overall, the ecosystem is not moving fast, and more discussion with maintainers is needed.
阅读 7
0 条评论