Skip to content

Commit 5422716

Browse files
BLD: Move options to pyproject.toml (#49917)
* BLD: Move options to pyproject.toml * Fix the rest of the checks? * Fix min versions script * Update pyproject.toml Co-authored-by: Eli Schwartz <[email protected]> * update dep * Bad merge Co-authored-by: Eli Schwartz <[email protected]>
1 parent 48e7b6e commit 5422716

File tree

5 files changed

+142
-186
lines changed

5 files changed

+142
-186
lines changed

Diff for: .pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ repos:
276276
entry: python scripts/validate_min_versions_in_sync.py
277277
language: python
278278
files: ^(ci/deps/actions-.*-minimum_versions\.yaml|pandas/compat/_optional\.py)$
279+
additional_dependencies: [tomli]
279280
- id: validate-errors-locations
280281
name: Validate errors locations
281282
description: Validate errors are in appropriate locations.

Diff for: pyproject.toml

+123-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,136 @@
22
# Minimum requirements for the build system to execute.
33
# See https://github.com/scipy/scipy/pull/12940 for the AIX issue.
44
requires = [
5-
"setuptools>=51.0.0",
5+
"setuptools>=61.0.0",
66
"wheel",
77
"Cython>=0.29.32,<3", # Note: sync with setup.py, environment.yml and asv.conf.json
88
"oldest-supported-numpy>=2022.8.16",
99
"versioneer[toml]"
1010
]
1111
# build-backend = "setuptools.build_meta"
1212

13+
[project]
14+
name = 'pandas'
15+
dynamic = [
16+
'version'
17+
]
18+
description = 'Powerful data structures for data analysis, time series, and statistics'
19+
readme = 'README.md'
20+
authors = [
21+
{ name = 'The Pandas Development Team', email='[email protected]' },
22+
]
23+
license = {file = 'LICENSE'}
24+
requires-python = '>=3.8'
25+
dependencies = [
26+
"numpy>=1.20.3; python_version<'3.10'",
27+
"numpy>=1.21.0; python_version>='3.10'",
28+
"numpy>=1.23.2; python_version>='3.11'",
29+
"python-dateutil>=2.8.2",
30+
"pytz>=2020.1"
31+
]
32+
classifiers = [
33+
'Development Status :: 5 - Production/Stable',
34+
'Environment :: Console',
35+
'Intended Audience :: Science/Research',
36+
'License :: OSI Approved :: BSD License',
37+
'Operating System :: OS Independent',
38+
'Programming Language :: Cython',
39+
'Programming Language :: Python',
40+
'Programming Language :: Python :: 3',
41+
'Programming Language :: Python :: 3 :: Only',
42+
'Programming Language :: Python :: 3.8',
43+
'Programming Language :: Python :: 3.9',
44+
'Programming Language :: Python :: 3.10',
45+
'Programming Language :: Python :: 3.11',
46+
'Topic :: Scientific/Engineering'
47+
]
48+
49+
[project.urls]
50+
homepage = 'https://pandas.pydata.org'
51+
documentation = 'https://pandas.pydata.org/pandas-docs/stable'
52+
repository = 'https://github.com/pandas-dev/pandas'
53+
54+
[project.entry-points."pandas_plotting_backends"]
55+
matplotlib = "pandas:plotting._matplotlib"
56+
57+
[project.optional-dependencies]
58+
test = ['hypothesis>=5.5.3', 'pytest>=6.0', 'pytest-xdist>=1.31', 'pytest-asyncio>=0.17.0']
59+
performance = ['bottleneck>=1.3.2', 'numba>=0.53.1', 'numexpr>=2.7.1']
60+
timezone = ['tzdata>=2022.1']
61+
computation = ['scipy>=1.7.1', 'xarray>=0.19.0']
62+
fss = ['fsspec>=2021.07.0']
63+
aws = ['s3fs>=2021.08.0']
64+
gcp = ['gcsfs>=2021.07.0', 'pandas-gbq>=0.15.0']
65+
excel = ['odfpy>=1.4.1', 'openpyxl>=3.0.7', 'pyxlsb>=1.0.8', 'xlrd>=2.0.1', 'xlsxwriter>=1.4.3']
66+
parquet = ['pyarrow>=6.0.0']
67+
feather = ['pyarrow>=6.0.0']
68+
hdf5 = [# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
69+
#'blosc>=1.20.1',
70+
'tables>=3.6.1']
71+
spss = ['pyreadstat>=1.1.2']
72+
postgresql = ['SQLAlchemy>=1.4.16', 'psycopg2>=2.8.6']
73+
mysql = ['SQLAlchemy>=1.4.16', 'pymysql>=1.0.2']
74+
sql-other = ['SQLAlchemy>=1.4.16']
75+
html = ['beautifulsoup4>=4.9.3', 'html5lib>=1.1', 'lxml>=4.6.3']
76+
xml = ['lxml>=4.6.3']
77+
plot = ['matplotlib>=3.6.1']
78+
output_formatting = ['jinja2>=3.0.0', 'tabulate>=0.8.9']
79+
clipboard = ['PyQt5>=5.15.1', 'qtpy>=2.2.0']
80+
compression = ['brotlipy>=0.7.0', 'python-snappy>=0.6.0', 'zstandard>=0.15.2']
81+
all = ['beautifulsoup4>=4.9.3',
82+
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
83+
#'blosc>=1.21.0',
84+
'bottleneck>=1.3.2',
85+
'brotlipy>=0.7.0',
86+
'fastparquet>=0.6.3',
87+
'fsspec>=2021.07.0',
88+
'gcsfs>=2021.07.0',
89+
'html5lib>=1.1',
90+
'hypothesis>=6.13.0',
91+
'jinja2>=3.0.0',
92+
'lxml>=4.6.3',
93+
'matplotlib>=3.6.1',
94+
'numba>=0.53.1',
95+
'numexpr>=2.7.3',
96+
'odfpy>=1.4.1',
97+
'openpyxl>=3.0.7',
98+
'pandas-gbq>=0.15.0',
99+
'psycopg2>=2.8.6',
100+
'pyarrow>=6.0.0',
101+
'pymysql>=1.0.2',
102+
'PyQt5>=5.15.1',
103+
'pyreadstat>=1.1.2',
104+
'pytest>=6.0',
105+
'pytest-xdist>=1.31',
106+
'pytest-asyncio>=0.17.0',
107+
'python-snappy>=0.6.0',
108+
'pyxlsb>=1.0.8',
109+
'qtpy>=2.2.0',
110+
'scipy>=1.7.1',
111+
's3fs>=2021.08.0',
112+
'SQLAlchemy>=1.4.16',
113+
'tables>=3.6.1',
114+
'tabulate>=0.8.9',
115+
'tzdata>=2022.1',
116+
'xarray>=0.19.0',
117+
'xlrd>=2.0.1',
118+
'xlsxwriter>=1.4.3',
119+
'zstandard>=0.15.2']
120+
121+
# TODO: Remove after setuptools support is dropped.
122+
[tool.setuptools]
123+
include-package-data = true
124+
125+
[tool.setuptools.packages.find]
126+
include = ["pandas", "pandas.*"]
127+
namespaces = false
128+
129+
[tool.setuptools.exclude-package-data]
130+
"*" = ["*.c", "*.h"]
131+
132+
# See the docstring in versioneer.py for instructions. Note that you must
133+
# re-run 'versioneer.py setup' after changing this section, and commit the
134+
# resulting files.
13135
[tool.versioneer]
14136
VCS = "git"
15137
style = "pep440"

Diff for: requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@ feedparser
9898
pyyaml
9999
requests
100100
sphinx-toggleprompt
101-
setuptools>=51.0.0
101+
setuptools>=61.0.0

Diff for: scripts/validate_min_versions_in_sync.py

+17-15
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@
1414
"""
1515
from __future__ import annotations
1616

17-
import configparser
1817
import pathlib
1918
import sys
2019

20+
if sys.version_info >= (3, 11):
21+
import tomllib
22+
else:
23+
import tomli as tomllib
24+
2125
DOC_PATH = pathlib.Path("doc/source/getting_started/install.rst").resolve()
2226
CI_PATH = next(
2327
pathlib.Path("ci/deps").absolute().glob("actions-*-minimum_versions.yaml")
2428
)
2529
CODE_PATH = pathlib.Path("pandas/compat/_optional.py").resolve()
26-
SETUP_PATH = pathlib.Path("setup.cfg").resolve()
30+
SETUP_PATH = pathlib.Path("pyproject.toml").resolve()
2731
EXCLUDE_DEPS = {"tzdata", "blosc"}
2832
# pandas package is not available
2933
# in pre-commit environment
@@ -80,22 +84,20 @@ def get_versions_from_ci(content: list[str]) -> tuple[dict[str, str], dict[str,
8084
return required_deps, optional_deps
8185

8286

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

88-
parser = configparser.ConfigParser()
89-
parser.read(SETUP_PATH)
90-
setup_optional = parser["options.extras_require"]["all"]
91-
dependencies = setup_optional[1:].split("\n")
93+
with open(SETUP_PATH, "rb") as pyproject_f:
94+
pyproject_toml = tomllib.load(pyproject_f)
95+
opt_deps = pyproject_toml["project"]["optional-dependencies"]
96+
dependencies = set(opt_deps["all"])
9297

93-
# remove test dependencies
94-
test = parser["options.extras_require"]["test"]
95-
test_dependencies = set(test[1:].split("\n"))
96-
dependencies = [
97-
package for package in dependencies if package not in test_dependencies
98-
]
98+
# remove test dependencies
99+
test_deps = set(opt_deps["test"])
100+
dependencies = dependencies.difference(test_deps)
99101

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

116118
diff = (ci_optional.items() | code_optional.items() | setup_optional.items()) - (
117119
ci_optional.items() & code_optional.items() & setup_optional.items()

Diff for: setup.cfg

-169
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,3 @@
1-
[metadata]
2-
name = pandas
3-
description = Powerful data structures for data analysis, time series, and statistics
4-
long_description = file: README.md
5-
long_description_content_type = text/markdown
6-
url = https://pandas.pydata.org
7-
author = The Pandas Development Team
8-
author_email = [email protected]
9-
license = BSD-3-Clause
10-
license_files = LICENSE
11-
platforms = any
12-
classifiers =
13-
Development Status :: 5 - Production/Stable
14-
Environment :: Console
15-
Intended Audience :: Science/Research
16-
License :: OSI Approved :: BSD License
17-
Operating System :: OS Independent
18-
Programming Language :: Cython
19-
Programming Language :: Python
20-
Programming Language :: Python :: 3
21-
Programming Language :: Python :: 3 :: Only
22-
Programming Language :: Python :: 3.8
23-
Programming Language :: Python :: 3.9
24-
Programming Language :: Python :: 3.10
25-
Programming Language :: Python :: 3.11
26-
Topic :: Scientific/Engineering
27-
project_urls =
28-
Bug Tracker = https://github.com/pandas-dev/pandas/issues
29-
Documentation = https://pandas.pydata.org/pandas-docs/stable
30-
Source Code = https://github.com/pandas-dev/pandas
31-
32-
[options]
33-
packages = find:
34-
install_requires =
35-
numpy>=1.20.3; python_version<'3.10'
36-
numpy>=1.21.0; python_version>='3.10'
37-
numpy>=1.23.2; python_version>='3.11'
38-
python-dateutil>=2.8.2
39-
pytz>=2020.1
40-
python_requires = >=3.8
41-
include_package_data = True
42-
zip_safe = False
43-
44-
[options.entry_points]
45-
pandas_plotting_backends =
46-
matplotlib = pandas:plotting._matplotlib
47-
48-
[options.exclude_package_data]
49-
* =
50-
*.c
51-
*.h
52-
53-
[options.extras_require]
54-
test =
55-
hypothesis>=5.5.3
56-
pytest>=6.0
57-
pytest-xdist>=1.31
58-
pytest-asyncio>=0.17.0
59-
# optional extras for recommended dependencies
60-
# see: doc/source/getting_started/install.rst
61-
performance =
62-
bottleneck>=1.3.2
63-
numba>=0.53.1
64-
numexpr>=2.7.1
65-
timezone =
66-
tzdata>=2022.1
67-
computation =
68-
scipy>=1.7.1
69-
xarray>=0.19.0
70-
fss =
71-
fsspec>=2021.07.0
72-
aws =
73-
s3fs>=2021.08.0
74-
gcp =
75-
gcsfs>=2021.07.0
76-
pandas-gbq>=0.15.0
77-
excel =
78-
odfpy>=1.4.1
79-
openpyxl>=3.0.7
80-
pyxlsb>=1.0.8
81-
xlrd>=2.0.1
82-
xlsxwriter>=1.4.3
83-
parquet =
84-
pyarrow>=6.0.0
85-
feather =
86-
pyarrow>=6.0.0
87-
hdf5 =
88-
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
89-
# blosc>=1.20.1
90-
tables>=3.6.1
91-
spss =
92-
pyreadstat>=1.1.2
93-
postgresql =
94-
SQLAlchemy>=1.4.16
95-
psycopg2>=2.8.6
96-
mysql =
97-
SQLAlchemy>=1.4.16
98-
pymysql>=1.0.2
99-
sql-other =
100-
SQLAlchemy>=1.4.16
101-
html =
102-
beautifulsoup4>=4.9.3
103-
html5lib>=1.1
104-
lxml>=4.6.3
105-
xml =
106-
lxml>=4.6.3
107-
plot =
108-
matplotlib>=3.6.1
109-
output_formatting =
110-
jinja2>=3.0.0
111-
tabulate>=0.8.9
112-
clipboard=
113-
PyQt5>=5.15.1
114-
qtpy>=2.2.0
115-
compression =
116-
brotlipy>=0.7.0
117-
python-snappy>=0.6.0
118-
zstandard>=0.15.2
119-
# `all` supersets all the above options.
120-
# Also adds the following redundant, superseded packages that are listed as supported:
121-
# fastparquet (by pyarrow https://github.com/pandas-dev/pandas/issues/39164)
122-
# `all ` should be kept as the complete set of pandas optional dependencies for general use.
123-
all =
124-
beautifulsoup4>=4.9.3
125-
# blosc only available on conda (https://github.com/Blosc/python-blosc/issues/297)
126-
# blosc>=1.21.0
127-
bottleneck>=1.3.2
128-
brotlipy>=0.7.0
129-
fastparquet>=0.6.3
130-
fsspec>=2021.07.0
131-
gcsfs>=2021.07.0
132-
html5lib>=1.1
133-
hypothesis>=6.13.0
134-
jinja2>=3.0.0
135-
lxml>=4.6.3
136-
matplotlib>=3.6.1
137-
numba>=0.53.1
138-
numexpr>=2.7.3
139-
odfpy>=1.4.1
140-
openpyxl>=3.0.7
141-
pandas-gbq>=0.15.0
142-
psycopg2>=2.8.6
143-
pyarrow>=6.0.0
144-
pymysql>=1.0.2
145-
PyQt5>=5.15.1
146-
pyreadstat>=1.1.2
147-
pytest>=6.0
148-
pytest-xdist>=1.31
149-
pytest-asyncio>=0.17.0
150-
python-snappy>=0.6.0
151-
pyxlsb>=1.0.8
152-
qtpy>=2.2.0
153-
scipy>=1.7.1
154-
s3fs>=2021.08.0
155-
SQLAlchemy>=1.4.16
156-
tables>=3.6.1
157-
tabulate>=0.8.9
158-
tzdata>=2022.1
159-
xarray>=0.19.0
160-
xlrd>=2.0.1
161-
xlsxwriter>=1.4.3
162-
zstandard>=0.15.2
163-
164-
[build_ext]
165-
inplace = True
166-
167-
[options.packages.find]
168-
include = pandas, pandas.*
169-
1701
[flake8]
1712
max-line-length = 88
1723
ignore =

0 commit comments

Comments
 (0)