diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ce5d4f93444..06fdcb9f761 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,18 +38,6 @@ repos: "python/cudf_kafka/cudf_kafka", "python/dask_cudf/dask_cudf"] pass_filenames: false - - repo: https://github.com/PyCQA/pydocstyle - rev: 6.3.0 - hooks: - - id: pydocstyle - # https://github.com/PyCQA/pydocstyle/issues/603 - additional_dependencies: [tomli] - args: ["--config=pyproject.toml"] - exclude: | - (?x)^( - ^python/cudf/cudf/pandas/scripts/.*| - ^python/cudf/cudf_pandas_tests/.* - ) - repo: https://github.com/nbQA-dev/nbQA rev: 1.7.1 hooks: diff --git a/docs/cudf/source/developer_guide/contributing_guide.md b/docs/cudf/source/developer_guide/contributing_guide.md index 65b0e4e3f41..6fce268f309 100644 --- a/docs/cudf/source/developer_guide/contributing_guide.md +++ b/docs/cudf/source/developer_guide/contributing_guide.md @@ -16,12 +16,10 @@ The `.pre-commit-config.yaml` file at the root of the repo is the primary source Specifically, cuDF uses the following tools: - [`ruff`](https://beta.ruff.rs/) checks for general code formatting compliance. -- [`black`](https://github.com/psf/black) is an automatic code formatter. - [`isort`](https://pycqa.github.io/isort/) ensures imports are sorted consistently. - [`mypy`](http://mypy-lang.org/) performs static type checking. In conjunction with [type hints](https://docs.python.org/3/library/typing.html), `mypy` can help catch various bugs that are otherwise difficult to find. -- [`pydocstyle`](https://github.com/PyCQA/pydocstyle/) lints docstring style. - [`codespell`](https://github.com/codespell-project/codespell) finds spelling errors. Linter config data is stored in a number of files. diff --git a/docs/cudf/source/developer_guide/documentation.md b/docs/cudf/source/developer_guide/documentation.md index 26557de917a..c8da689479c 100644 --- a/docs/cudf/source/developer_guide/documentation.md +++ b/docs/cudf/source/developer_guide/documentation.md @@ -72,7 +72,7 @@ Our guidelines include one addition to the standard the `numpydoc` guide. Class properties, which are not explicitly covered, should be documented in the getter function. That choice makes `help` more useful as well as enabling docstring inheritance in subclasses. -All of our docstrings are validated using [`pydocstyle`](http://www.pydocstyle.org/en/stable/). +All of our docstrings are validated using [`ruff pydocstyle rules`](https://docs.astral.sh/ruff/rules/#pydocstyle-d). This ensures that docstring style is consistent and conformant across the codebase. ## Published documentation diff --git a/pyproject.toml b/pyproject.toml index c71394058df..28eac66c1d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,19 +1,5 @@ # Copyright (c) 2019-2024, NVIDIA CORPORATION. -[tool.pydocstyle] -# Due to https://github.com/PyCQA/pydocstyle/issues/363, we must exclude rather -# than include using match-dir. Note that as discussed in -# https://stackoverflow.com/questions/65478393/how-to-filter-directories-using-the-match-dir-flag-for-pydocstyle, -# unlike the match option above this match-dir will have no effect when -# pydocstyle is invoked from pre-commit. Therefore this exclusion list must -# also be maintained in the pre-commit config file. -match-dir = "^(?!(ci|cpp|conda|docs|java|notebooks|python/cudf/cudf/pandas/scripts|python/cudf/cudf_pandas_tests)).*$" -# Allow missing docstrings for docutils -ignore-decorators = ".*(docutils|doc_apply|copy_docstring).*" -select = "D201, D204, D206, D207, D208, D209, D210, D211, D214, D215, D300, D301, D302, D403, D405, D406, D407, D408, D409, D410, D411, D412, D414, D418" - # Would like to enable the following rules in the future: - # D200, D202, D205, D400 - [tool.mypy] ignore_missing_imports = true # If we don't specify this, then mypy will check excluded files if @@ -38,7 +24,7 @@ builtin = "clear" quiet-level = 3 [tool.ruff] -select = ["E", "F", "W"] +select = ["E", "F", "W", "D201", "D204", "D206", "D207", "D208", "D209", "D210", "D211", "D214", "D215", "D300", "D301", "D403", "D405", "D406", "D407", "D408", "D409", "D410", "D411", "D412", "D414", "D418"] ignore = [ # whitespace before : "E203", @@ -55,3 +41,5 @@ line-length = 79 [tool.ruff.per-file-ignores] # Lots of pytest implicitly injected attributes in conftest-patch.py "python/cudf/cudf/pandas/scripts/conftest-patch.py" = ["F821"] +"python/cudf/cudf/pandas/scripts/*" = ["D"] +"python/cudf/cudf_pandas_tests/*" = ["D"] diff --git a/python/cudf/cudf/core/column/column.py b/python/cudf/cudf/core/column/column.py index f13d8cf12f7..2541e076250 100644 --- a/python/cudf/cudf/core/column/column.py +++ b/python/cudf/cudf/core/column/column.py @@ -2382,10 +2382,12 @@ def serialize_columns(columns) -> Tuple[List[dict], List]: """ Return the headers and frames resulting from serializing a list of Column + Parameters ---------- columns : list list of Columns to serialize + Returns ------- headers : list diff --git a/python/cudf/cudf/core/dataframe.py b/python/cudf/cudf/core/dataframe.py index 35588725655..da0a969b70c 100644 --- a/python/cudf/cudf/core/dataframe.py +++ b/python/cudf/cudf/core/dataframe.py @@ -4798,7 +4798,6 @@ def apply_chunks( Examples -------- - For ``tpb > 1``, ``func`` is executed by ``tpb`` number of threads concurrently. To access the thread id and count, use ``numba.cuda.threadIdx.x`` and ``numba.cuda.blockDim.x``, @@ -4824,7 +4823,7 @@ def apply_chunks( ... z = in3[i] ... out1[i] = x * y + z - See also + See Also -------- DataFrame.apply_rows """ diff --git a/python/cudf/cudf/core/reshape.py b/python/cudf/cudf/core/reshape.py index 2ef39e9357d..9008d2f3a1b 100644 --- a/python/cudf/cudf/core/reshape.py +++ b/python/cudf/cudf/core/reshape.py @@ -23,7 +23,8 @@ def _align_objs(objs, how="outer", sort=None): - """Align a set of Series or Dataframe objects. + """ + Align a set of Series or Dataframe objects. Parameters ---------- @@ -31,6 +32,7 @@ def _align_objs(objs, how="outer", sort=None): how : How to handle indexes on other axis (or axes), similar to join in concat sort : Whether to sort the resulting Index + Returns ------- A list of reindexed and aligned objects diff --git a/python/cudf/cudf/utils/ioutils.py b/python/cudf/cudf/utils/ioutils.py index 85abf438efb..0a0ee4f592c 100644 --- a/python/cudf/cudf/utils/ioutils.py +++ b/python/cudf/cudf/utils/ioutils.py @@ -1844,6 +1844,7 @@ def stringify_pathlike(pathlike): """ Convert any object that implements the fspath protocol to a string. Leaves other objects unchanged + Parameters ---------- pathlike diff --git a/python/dask_cudf/dask_cudf/accessors.py b/python/dask_cudf/dask_cudf/accessors.py index 1c21fca51c8..47b22696415 100644 --- a/python/dask_cudf/dask_cudf/accessors.py +++ b/python/dask_cudf/dask_cudf/accessors.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. class StructMethods: @@ -9,14 +9,17 @@ def field(self, key): """ Extract children of the specified struct column in the Series + Parameters ---------- key: int or str index/position or field name of the respective struct column + Returns ------- Series + Examples -------- >>> s = cudf.Series([{'a': 1, 'b': 2}, {'a': 3, 'b': 4}])