In somewhat complex Python setup.py configurations, one typically needs other libraries already present in order to execute setuptools.setup. In my case, this would be setuptools>=45.0 and cython>=0.29. Now, I have two options to declare these build-time requirements (not to confuse with standard package installation requirements typically found in a requirements.txt file) in order to ship this project to PyPI:
- Manually write the requirements as part of
setup.pyin thesetup_requiresargument:
#setup.py
from setuptools import setup
#...
setup(
name='bla',
#...
setup_requires = ['setuptools>=45.0', 'cython>=0.29'],
)
- Write these requirements into a separate
pyproject.tomlfile following PEP518:
#pyproject.toml
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools>=45.0", "cython>=0.29"]
Are they exchangeable? Which one should be used and why?