diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0ae745257cb..d44462236b2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,6 +22,8 @@ repos: # project can specify its own first/third-party packages. args: ["--config-root=python/", "--resolve-all-configs"] files: python/.* + exclude: | + (?x)^(^python/cudf_polars/.*) types_or: [python, cython, pyi] - repo: https://github.com/MarcoGorelli/cython-lint rev: v0.16.2 @@ -36,6 +38,7 @@ repos: "python/cudf/cudf", "python/custreamz/custreamz", "python/cudf_kafka/cudf_kafka", + "python/cudf_polars/cudf_polars", "python/dask_cudf/dask_cudf"] pass_filenames: false - repo: https://github.com/nbQA-dev/nbQA diff --git a/dependencies.yaml b/dependencies.yaml index 7fe67817f73..687b56f6260 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -119,6 +119,30 @@ files: key: cudf-pandas-tests includes: - test_python_cudf_pandas + py_build_cudf_polars: + output: pyproject + pyproject_dir: python/cudf_polars + extras: + table: build-system + includes: + - build_wheels + py_run_cudf_polars: + output: pyproject + pyproject_dir: python/cudf_polars + extras: + table: project + includes: + - run_common + - run_cudf_polars + - depends_on_cudf + py_test_cudf_polars: + output: pyproject + pyproject_dir: python/cudf_polars + extras: + table: project.optional-dependencies + key: test + includes: + - test_python_common py_build_dask_cudf: output: pyproject pyproject_dir: python/dask_cudf @@ -559,6 +583,11 @@ dependencies: - output_types: pyproject matrices: - {matrix: null, packages: [cubinlinker, ptxcompiler, *rmm_conda] } + run_cudf_polars: + common: + - output_types: [conda, requirements, pyproject] + packages: + - polars>=0.20.24 run_dask_cudf: common: - output_types: [conda, requirements, pyproject] diff --git a/python/cudf_polars/LICENSE b/python/cudf_polars/LICENSE new file mode 120000 index 00000000000..30cff7403da --- /dev/null +++ b/python/cudf_polars/LICENSE @@ -0,0 +1 @@ +../../LICENSE \ No newline at end of file diff --git a/python/cudf_polars/README.md b/python/cudf_polars/README.md new file mode 120000 index 00000000000..fe840054137 --- /dev/null +++ b/python/cudf_polars/README.md @@ -0,0 +1 @@ +../../README.md \ No newline at end of file diff --git a/python/cudf_polars/cudf_polars/VERSION b/python/cudf_polars/cudf_polars/VERSION new file mode 120000 index 00000000000..d62dc733efd --- /dev/null +++ b/python/cudf_polars/cudf_polars/VERSION @@ -0,0 +1 @@ +../../../VERSION \ No newline at end of file diff --git a/python/cudf_polars/cudf_polars/__init__.py b/python/cudf_polars/cudf_polars/__init__.py new file mode 100644 index 00000000000..74547fe2448 --- /dev/null +++ b/python/cudf_polars/cudf_polars/__init__.py @@ -0,0 +1,13 @@ +# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. +# SPDX-License-Identifier: Apache-2.0 + +""" +An executor for polars logical plans. + +This package implements an executor for polars logical plans using +pylibcudf to execute the plans on device. +""" + +from __future__ import annotations + +__all__: list[str] = [] diff --git a/python/cudf_polars/pyproject.toml b/python/cudf_polars/pyproject.toml new file mode 100644 index 00000000000..4b149ce954e --- /dev/null +++ b/python/cudf_polars/pyproject.toml @@ -0,0 +1,141 @@ +# Copyright (c) 2024, NVIDIA CORPORATION. + +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "setuptools", + "wheel", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[project] +name = "cudf-polars" +dynamic = ["version"] +description = "Executor for polars using cudf" +readme = { file = "README.md", content-type = "text/markdown" } +authors = [ + { name = "NVIDIA Corporation" }, +] +license = { text = "Apache 2.0" } +requires-python = ">=3.9" +dependencies = [ + "cudf==24.6.*", + "fsspec>=0.6.0", + "numpy>=1.23,<2.0a0", + "pandas>=2.0,<2.2.3dev0", + "polars>=0.20.24", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Database", + "Topic :: Scientific/Engineering", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] + +[project.optional-dependencies] +test = [ + "pytest-cov", + "pytest-xdist", + "pytest<8", +] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. + +[project.urls] +Homepage = "https://github.com/rapidsai/cudf" + +[tool.setuptools] +license-files = ["LICENSE"] + +[tool.setuptools.dynamic] +version = {file = "cudf_polars/VERSION"} + +[tool.setuptools.packages.find] +exclude = ["*tests*"] + +[tool.ruff] +line-length = 88 +indent-width = 4 +target-version = "py39" +fix = true + +[tool.ruff.lint] +# __init__.py must re-export everything it imports +ignore-init-module-imports = false +select = [ + "E", # pycodestyle + "W", # pycodestyle + "F", # Pyflakes + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "D", # flake8-docstrings + "D213", # Augment NumPy docstring convention: Multi-line docstring summary should start at the second line + "D417", # Augment NumPy docstring convention: Missing argument descriptions + "I", # isort + "SIM", # flake8-simplify + "TCH", # flake8-type-checking + "TID", # flake8-tidy-imports + "UP", # pyupgrade + "PT", # flake8-pytest-style + "RUF", # Ruff-specific rules + "PTH", # flake8-use-pathlib + "FA", # flake8-future-annotations + "PIE", # flake8-pie + "TD", # flake8-todos + "TRY", # tryceratops + "FBT001", # flake8-boolean-trap +] + +ignore = [ + # Line length regulated by formatter + "E501", + # pydocstyle: http://www.pydocstyle.org/en/stable/error_codes.html + "D401", # Relax NumPy docstring convention: First line should be in imperative mood + # flake8-pytest-style: + "PT011", # pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception + # flake8-simplify + "SIM108", # Use ternary operator + # flake8-todos + "TD002", # Missing author in TODO + "TD003", # Missing issue link on the line following this TODO + # tryceratops + "TRY003", # Avoid specifying long messages outside the exception class + # Lints below are turned off because of conflicts with the ruff formatter + "D206", + "W191", +] +fixable = ["ALL"] + +[tool.ruff.lint.pydocstyle] +convention = "numpy" + +[tool.ruff.lint.flake8-tidy-imports] +ban-relative-imports = "all" + +[tool.ruff.lint.flake8-type-checking] +strict = true + +[tool.ruff.lint.isort] +case-sensitive = true +combine-as-imports = true +order-by-type = true +known-first-party = ["cudf_polars"] +default-section = "third-party" +section-order = [ + "future", + "standard-library", + "third-party", + "polars", + "rapids", + "first-party", + "local-folder" +] +required-imports = ["from __future__ import annotations"] + +[tool.ruff.lint.isort.sections] +polars = ["polars"] +rapids = ["rmm", "cudf"] + +[tool.ruff.format] +docstring-code-format = true