diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3a07aae11dc1b..dca1a84867e72 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -110,7 +110,7 @@ repos: entry: python scripts/generate_pip_deps_from_conda.py files: ^(environment.yml|requirements-dev.txt)$ pass_filenames: false - additional_dependencies: [pyyaml] + additional_dependencies: [pyyaml, toml] - id: sync-flake8-versions name: Check flake8 version is synced across flake8, yesqa, and environment.yml language: python diff --git a/doc/source/development/contributing_environment.rst b/doc/source/development/contributing_environment.rst index f3e6f6129f5d7..1f9b34c7a784e 100644 --- a/doc/source/development/contributing_environment.rst +++ b/doc/source/development/contributing_environment.rst @@ -189,11 +189,8 @@ Creating a Python environment (pip) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you aren't using conda for your development environment, follow these instructions. -You'll need to have at least the :ref:`minimum Python version ` that pandas supports. If your Python version -is 3.8.0 (or later), you might need to update your ``setuptools`` to version 42.0.0 (or later) -in your development environment before installing the build dependencies:: - - pip install --upgrade setuptools +You'll need to have at least the :ref:`minimum Python version ` that pandas supports. +You also need to have ``setuptools`` 51.0.0 or later to build pandas. **Unix**/**macOS with virtualenv** diff --git a/pyproject.toml b/pyproject.toml index bb9b0e5517872..03c1485bd4e35 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ # Minimum requirements for the build system to execute. # See https://github.com/scipy/scipy/pull/12940 for the AIX issue. requires = [ - "setuptools>=38.6.0", + "setuptools>=51.0.0", "wheel", "Cython>=0.29.21,<3", # Note: sync with setup.py # Numpy requirements for different OS/architectures diff --git a/requirements-dev.txt b/requirements-dev.txt index efab43279aba6..49e966cc3a1cf 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -84,3 +84,4 @@ types-python-dateutil types-PyMySQL types-pytz types-setuptools +setuptools>=51.0.0 diff --git a/scripts/generate_pip_deps_from_conda.py b/scripts/generate_pip_deps_from_conda.py index 5117150be67c3..2ea50fa3ac8d4 100755 --- a/scripts/generate_pip_deps_from_conda.py +++ b/scripts/generate_pip_deps_from_conda.py @@ -17,6 +17,7 @@ import re import sys +import toml import yaml EXCLUDE = {"python", "c-compiler", "cxx-compiler"} @@ -96,6 +97,13 @@ def generate_pip_from_conda( ) pip_content = header + "\n".join(pip_deps) + "\n" + # add setuptools to requirements-dev.txt + meta = toml.load(pathlib.Path(conda_path.parent, "pyproject.toml")) + for requirement in meta["build-system"]["requires"]: + if "setuptools" in requirement: + pip_content += requirement + pip_content += "\n" + if compare: with pip_path.open() as file: return pip_content != file.read()