From b1b12b915e17886c9a0be66aedc0065104febf2a Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Tue, 3 Aug 2021 14:33:58 -0500 Subject: [PATCH] Backport PR #42304: DEPS: update setuptools min version --- .pre-commit-config.yaml | 2 +- doc/source/development/contributing_environment.rst | 7 ++----- pyproject.toml | 2 +- requirements-dev.txt | 1 + scripts/generate_pip_deps_from_conda.py | 8 ++++++++ 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d580fcf4fc545..e2e6fe51b5f8b 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 bc0a3556b9ac1..7b52bf760b601 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 86b255ab6bf58..0d1aefb9d4b55 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 ba78dd33fbae1..25ec5e1904d18 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -81,3 +81,4 @@ natsort git+https://github.com/pydata/pydata-sphinx-theme.git@master numpydoc < 1.2 pandas-dev-flaker==0.2.0 +setuptools>=51.0.0 diff --git a/scripts/generate_pip_deps_from_conda.py b/scripts/generate_pip_deps_from_conda.py index 1ad9ec03925a0..5b7b56f64c6e4 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"} @@ -99,6 +100,13 @@ def main(conda_fname, pip_fname, compare=False): ) 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 open(pip_fname) as pip_fd: return pip_content != pip_fd.read()