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 3 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
2 changes: 1 addition & 1 deletion .github/workflows/package-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: Install required dependencies
run: |
python -m pip install --upgrade pip setuptools wheel python-dateutil pytz numpy cython
python -m pip install --upgrade pip setuptools wheel python-dateutil pytz numpy cython tomli
shell: bash -el {0}

- name: Pip install with extra
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade pip setuptools wheel tomli

# GH 39416
pip install numpy
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,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
135 changes: 134 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,145 @@ requires = [
"setuptools>=51.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"
"oldest-supported-numpy>=2022.8.16",
"tomli; python_version < '3.11'" # Versioneer needs this
]
# uncomment to enable pep517 after versioneer problem is fixed.
# https://github.com/python-versioneer/python-versioneer/issues/193
# 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"]


# Consider removing.
# 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"
versionfile_source = "pandas/_version.py"
versionfile_build = "pandas/_version.py"
tag_prefix = "v"
parentdir_prefix = "pandas-"

[tool.cibuildwheel]
skip = "cp36-* cp37-* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux*"
build-verbosity = "3"
Expand Down
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
Loading