Skip to content

BLD: Move options to pyproject.toml #49917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ repos:
entry: python scripts/validate_min_versions_in_sync.py
language: python
files: ^(ci/deps/actions-.*-minimum_versions\.yaml|pandas/compat/_optional\.py)$
additional_dependencies: [tomli]
- id: validate-errors-locations
name: Validate errors locations
description: Validate errors are in appropriate locations.
Expand Down
124 changes: 123 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,136 @@
# Minimum requirements for the build system to execute.
# See https://github.com/scipy/scipy/pull/12940 for the AIX issue.
requires = [
"setuptools>=51.0.0",
"setuptools>=61.0.0",
"wheel",
"Cython>=0.29.32,<3", # Note: sync with setup.py, environment.yml and asv.conf.json
"oldest-supported-numpy>=2022.8.16",
"versioneer[toml]"
]
# build-backend = "setuptools.build_meta"

[project]
name = 'pandas'
dynamic = [
'version'
]
description = 'Powerful data structures for data analysis, time series, and statistics'
readme = 'README.md'
authors = [
{ name = 'The Pandas Development Team', email='[email protected]' },
]
license = {file = 'LICENSE'}
requires-python = '>=3.8'
dependencies = [
"numpy>=1.20.3; python_version<'3.10'",
"numpy>=1.21.0; python_version>='3.10'",
"numpy>=1.23.2; python_version>='3.11'",
"python-dateutil>=2.8.2",
"pytz>=2020.1"
]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Cython',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Topic :: Scientific/Engineering'
]

[project.urls]
homepage = 'https://pandas.pydata.org'
documentation = 'https://pandas.pydata.org/pandas-docs/stable'
repository = 'https://github.com/pandas-dev/pandas'

[project.entry-points."pandas_plotting_backends"]
matplotlib = "pandas:plotting._matplotlib"

[project.optional-dependencies]
test = ['hypothesis>=5.5.3', 'pytest>=6.0', 'pytest-xdist>=1.31', 'pytest-asyncio>=0.17.0']
performance = ['bottleneck>=1.3.2', 'numba>=0.53.1', 'numexpr>=2.7.1']
timezone = ['tzdata>=2022.1']
computation = ['scipy>=1.7.1', 'xarray>=0.19.0']
fss = ['fsspec>=2021.07.0']
aws = ['s3fs>=2021.08.0']
gcp = ['gcsfs>=2021.07.0', 'pandas-gbq>=0.15.0']
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
parquet = ['pyarrow>=6.0.0']
feather = ['pyarrow>=6.0.0']
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.20.1',
'tables>=3.6.1']
spss = ['pyreadstat>=1.1.2']
postgresql = ['SQLAlchemy>=1.4.16', 'psycopg2>=2.8.6']
mysql = ['SQLAlchemy>=1.4.16', 'pymysql>=1.0.2']
sql-other = ['SQLAlchemy>=1.4.16']
html = ['beautifulsoup4>=4.9.3', 'html5lib>=1.1', 'lxml>=4.6.3']
xml = ['lxml>=4.6.3']
plot = ['matplotlib>=3.6.1']
output_formatting = ['jinja2>=3.0.0', 'tabulate>=0.8.9']
clipboard = ['PyQt5>=5.15.1', 'qtpy>=2.2.0']
compression = ['brotlipy>=0.7.0', 'python-snappy>=0.6.0', 'zstandard>=0.15.2']
all = ['beautifulsoup4>=4.9.3',
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
#'blosc>=1.21.0',
'bottleneck>=1.3.2',
'brotlipy>=0.7.0',
'fastparquet>=0.6.3',
'fsspec>=2021.07.0',
'gcsfs>=2021.07.0',
'html5lib>=1.1',
'hypothesis>=6.13.0',
'jinja2>=3.0.0',
'lxml>=4.6.3',
'matplotlib>=3.6.1',
'numba>=0.53.1',
'numexpr>=2.7.3',
'odfpy>=1.4.1',
'openpyxl>=3.0.7',
'pandas-gbq>=0.15.0',
'psycopg2>=2.8.6',
'pyarrow>=6.0.0',
'pymysql>=1.0.2',
'PyQt5>=5.15.1',
'pyreadstat>=1.1.2',
'pytest>=6.0',
'pytest-xdist>=1.31',
'pytest-asyncio>=0.17.0',
'python-snappy>=0.6.0',
'pyxlsb>=1.0.8',
'qtpy>=2.2.0',
'scipy>=1.7.1',
's3fs>=2021.08.0',
'SQLAlchemy>=1.4.16',
'tables>=3.6.1',
'tabulate>=0.8.9',
'tzdata>=2022.1',
'xarray>=0.19.0',
'xlrd>=2.0.1',
'xlsxwriter>=1.4.3',
'zstandard>=0.15.2']

# TODO: Remove after setuptools support is dropped.
[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
include = ["pandas", "pandas.*"]
namespaces = false

[tool.setuptools.exclude-package-data]
"*" = ["*.c", "*.h"]

# See the docstring in versioneer.py for instructions. Note that you must
# re-run 'versioneer.py setup' after changing this section, and commit the
# resulting files.
[tool.versioneer]
VCS = "git"
style = "pep440"
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ feedparser
pyyaml
requests
sphinx-toggleprompt
setuptools>=51.0.0
setuptools>=61.0.0
32 changes: 17 additions & 15 deletions scripts/validate_min_versions_in_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@
"""
from __future__ import annotations

import configparser
import pathlib
import sys

if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib

DOC_PATH = pathlib.Path("doc/source/getting_started/install.rst").resolve()
CI_PATH = next(
pathlib.Path("ci/deps").absolute().glob("actions-*-minimum_versions.yaml")
)
CODE_PATH = pathlib.Path("pandas/compat/_optional.py").resolve()
SETUP_PATH = pathlib.Path("setup.cfg").resolve()
SETUP_PATH = pathlib.Path("pyproject.toml").resolve()
EXCLUDE_DEPS = {"tzdata", "blosc"}
# pandas package is not available
# in pre-commit environment
Expand Down Expand Up @@ -80,22 +84,20 @@ def get_versions_from_ci(content: list[str]) -> tuple[dict[str, str], dict[str,
return required_deps, optional_deps


def get_versions_from_setup() -> dict[str, str]:
"""Min versions in setup.cfg for pip install pandas[extra]."""
def get_versions_from_toml() -> dict[str, str]:
"""Min versions in pyproject.toml for pip install pandas[extra]."""
install_map = _optional.INSTALL_MAPPING
dependencies = set()
optional_dependencies = {}

parser = configparser.ConfigParser()
parser.read(SETUP_PATH)
setup_optional = parser["options.extras_require"]["all"]
dependencies = setup_optional[1:].split("\n")
with open(SETUP_PATH, "rb") as pyproject_f:
pyproject_toml = tomllib.load(pyproject_f)
opt_deps = pyproject_toml["project"]["optional-dependencies"]
dependencies = set(opt_deps["all"])

# remove test dependencies
test = parser["options.extras_require"]["test"]
test_dependencies = set(test[1:].split("\n"))
dependencies = [
package for package in dependencies if package not in test_dependencies
]
# remove test dependencies
test_deps = set(opt_deps["test"])
dependencies = dependencies.difference(test_deps)

for dependency in dependencies:
package, version = dependency.strip().split(">=")
Expand All @@ -111,7 +113,7 @@ def main():
with open(CI_PATH, encoding="utf-8") as f:
_, ci_optional = get_versions_from_ci(f.readlines())
code_optional = get_versions_from_code()
setup_optional = get_versions_from_setup()
setup_optional = get_versions_from_toml()

diff = (ci_optional.items() | code_optional.items() | setup_optional.items()) - (
ci_optional.items() & code_optional.items() & setup_optional.items()
Expand Down
169 changes: 0 additions & 169 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,172 +1,3 @@
[metadata]
name = pandas
description = Powerful data structures for data analysis, time series, and statistics
long_description = file: README.md
long_description_content_type = text/markdown
url = https://pandas.pydata.org
author = The Pandas Development Team
author_email = [email protected]
license = BSD-3-Clause
license_files = LICENSE
platforms = any
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Operating System :: OS Independent
Programming Language :: Cython
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Scientific/Engineering
project_urls =
Bug Tracker = https://github.com/pandas-dev/pandas/issues
Documentation = https://pandas.pydata.org/pandas-docs/stable
Source Code = https://github.com/pandas-dev/pandas

[options]
packages = find:
install_requires =
numpy>=1.20.3; python_version<'3.10'
numpy>=1.21.0; python_version>='3.10'
numpy>=1.23.2; python_version>='3.11'
python-dateutil>=2.8.2
pytz>=2020.1
python_requires = >=3.8
include_package_data = True
zip_safe = False

[options.entry_points]
pandas_plotting_backends =
matplotlib = pandas:plotting._matplotlib

[options.exclude_package_data]
* =
*.c
*.h

[options.extras_require]
test =
hypothesis>=5.5.3
pytest>=6.0
pytest-xdist>=1.31
pytest-asyncio>=0.17.0
# optional extras for recommended dependencies
# see: doc/source/getting_started/install.rst
performance =
bottleneck>=1.3.2
numba>=0.53.1
numexpr>=2.7.1
timezone =
tzdata>=2022.1
computation =
scipy>=1.7.1
xarray>=0.19.0
fss =
fsspec>=2021.07.0
aws =
s3fs>=2021.08.0
gcp =
gcsfs>=2021.07.0
pandas-gbq>=0.15.0
excel =
odfpy>=1.4.1
openpyxl>=3.0.7
pyxlsb>=1.0.8
xlrd>=2.0.1
xlsxwriter>=1.4.3
parquet =
pyarrow>=6.0.0
feather =
pyarrow>=6.0.0
hdf5 =
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
# blosc>=1.20.1
tables>=3.6.1
spss =
pyreadstat>=1.1.2
postgresql =
SQLAlchemy>=1.4.16
psycopg2>=2.8.6
mysql =
SQLAlchemy>=1.4.16
pymysql>=1.0.2
sql-other =
SQLAlchemy>=1.4.16
html =
beautifulsoup4>=4.9.3
html5lib>=1.1
lxml>=4.6.3
xml =
lxml>=4.6.3
plot =
matplotlib>=3.6.1
output_formatting =
jinja2>=3.0.0
tabulate>=0.8.9
clipboard=
PyQt5>=5.15.1
qtpy>=2.2.0
compression =
brotlipy>=0.7.0
python-snappy>=0.6.0
zstandard>=0.15.2
# `all` supersets all the above options.
# Also adds the following redundant, superseded packages that are listed as supported:
# fastparquet (by pyarrow https://github.com/pandas-dev/pandas/issues/39164)
# `all ` should be kept as the complete set of pandas optional dependencies for general use.
all =
beautifulsoup4>=4.9.3
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
# blosc>=1.21.0
bottleneck>=1.3.2
brotlipy>=0.7.0
fastparquet>=0.6.3
fsspec>=2021.07.0
gcsfs>=2021.07.0
html5lib>=1.1
hypothesis>=6.13.0
jinja2>=3.0.0
lxml>=4.6.3
matplotlib>=3.6.1
numba>=0.53.1
numexpr>=2.7.3
odfpy>=1.4.1
openpyxl>=3.0.7
pandas-gbq>=0.15.0
psycopg2>=2.8.6
pyarrow>=6.0.0
pymysql>=1.0.2
PyQt5>=5.15.1
pyreadstat>=1.1.2
pytest>=6.0
pytest-xdist>=1.31
pytest-asyncio>=0.17.0
python-snappy>=0.6.0
pyxlsb>=1.0.8
qtpy>=2.2.0
scipy>=1.7.1
s3fs>=2021.08.0
SQLAlchemy>=1.4.16
tables>=3.6.1
tabulate>=0.8.9
tzdata>=2022.1
xarray>=0.19.0
xlrd>=2.0.1
xlsxwriter>=1.4.3
zstandard>=0.15.2

[build_ext]
inplace = True

[options.packages.find]
include = pandas, pandas.*

[flake8]
max-line-length = 88
ignore =
Expand Down