Dynamic
setup.cfg vs pyproject.toml
Developers should use setup meets developers should use pyproject. Here's our take.
🧊Nice Pick
setup.cfg
Developers should use setup
setup.cfg
Nice PickDevelopers should use setup
Pros
- +cfg when building Python packages to ensure consistent and reproducible builds, as it separates configuration from executable code, reducing errors and improving maintainability
- +Related to: python, setuptools
Cons
- -Specific tradeoffs depend on your use case
pyproject.toml
Developers should use pyproject
Pros
- +toml when working on Python projects that require consistent build and dependency management, especially for packaging and distribution with tools like pip, Poetry, or Flit
- +Related to: python, poetry
Cons
- -Specific tradeoffs depend on your use case
The Verdict
Use setup.cfg if: You want cfg when building python packages to ensure consistent and reproducible builds, as it separates configuration from executable code, reducing errors and improving maintainability and can live with specific tradeoffs depend on your use case.
Use pyproject.toml if: You prioritize toml when working on python projects that require consistent build and dependency management, especially for packaging and distribution with tools like pip, poetry, or flit over what setup.cfg offers.
🧊
The Bottom Line
setup.cfg wins
Developers should use setup
Disagree with our pick? nice@nicepick.dev