From 49a531f24d55eae78df948adbf40f38bb1d9392c Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 2 Dec 2023 16:50:53 -0600 Subject: [PATCH 1/7] pyproject(ruff): Add pydocstyle rule selector w/ numpy convention --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c3cc902..cfd07ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -109,8 +109,12 @@ select = [ "TRY", # Trycertatops "PERF", # Perflint "RUF", # Ruff-specific rules + "D", # pydocstyle ] +[tool.ruff.pydocstyle] +convention = "numpy" + [tool.ruff.isort] known-first-party = [ "g", From 6da90d78f22006469d326a30788a9d438e7f074d Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 9 Dec 2023 05:13:09 -0600 Subject: [PATCH 2/7] ruff(pydocstyle): Run automated fixes (unsafe ones) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ruff --show-fixes --fix-only --unsafe-fixes .` Fixed 1 error: - docs/conf.py: 1 × D400 (ends-in-period) Fixed 1 error. --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index c8ee4a0..444dbcb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -128,7 +128,7 @@ def linkcode_resolve(domain: str, info: t.Dict[str, str]) -> t.Union[None, str]: """ - Determine the URL corresponding to Python object + Determine the URL corresponding to Python object. Notes ----- From 4026ceebce8884d34efd29ed9b0b0f2918f7950f Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 9 Dec 2023 05:21:42 -0600 Subject: [PATCH 3/7] docs(conf): pydocstyle manual fixes --- docs/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/conf.py b/docs/conf.py index 444dbcb..cd9a0fe 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,5 @@ # flake8: noqa: E501 +"""Sphinx configuration for g.""" import contextlib import inspect import pathlib @@ -198,6 +199,7 @@ def linkcode_resolve(domain: str, info: t.Dict[str, str]) -> t.Union[None, str]: def remove_tabs_js(app: "Sphinx", exc: Exception) -> None: + """Remove tabs.js from _static after build.""" # Fix for sphinx-inline-tabs#18 if app.builder.format == "html" and not exc: tabs_js = pathlib.Path(app.builder.outdir) / "_static" / "tabs.js" @@ -206,4 +208,5 @@ def remove_tabs_js(app: "Sphinx", exc: Exception) -> None: def setup(app: "Sphinx") -> None: + """Configure Sphinx app hooks.""" app.connect("build-finished", remove_tabs_js) From d3d8cce3134e66672fc2b10d185a329e89d26b30 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 9 Dec 2023 05:22:00 -0600 Subject: [PATCH 4/7] __about__: pydocstyle manual fixes --- src/g/__about__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/g/__about__.py b/src/g/__about__.py index a387568..d74cbef 100644 --- a/src/g/__about__.py +++ b/src/g/__about__.py @@ -1,3 +1,4 @@ +"""Metadata package for g.""" __title__ = "g" __package_name__ = "g" __description__ = "cli shortcut for directory's vcs command: git, svn, hg" From b88f2b0a96b5da6a52aeac1dcf975d50c3410601 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 9 Dec 2023 05:22:39 -0600 Subject: [PATCH 5/7] __init__: pydocstyle manual fixes --- src/g/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/g/__init__.py b/src/g/__init__.py index d913f76..fdd902a 100755 --- a/src/g/__init__.py +++ b/src/g/__init__.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +"""Package for g.""" import pathlib import subprocess import sys @@ -28,6 +29,7 @@ def run( *args: object, **kwargs: t.Any, ) -> t.Optional["subprocess.Popen[str]"]: + """CLI Entrypoint for g, overlay for current directory's VCS utility.""" # Interpret default kwargs lazily for mockability of argv if cmd is DEFAULT: cmd = find_repo_type(pathlib.Path.cwd()) From eb633a79393c7763f5e0435127f83503d092de63 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 9 Dec 2023 05:25:30 -0600 Subject: [PATCH 6/7] tests(cli): pydocstyle manual fixes --- tests/test_cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 858edf7..9e3c61c 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,3 +1,4 @@ +"""Tests for g's CLI package.""" import subprocess import typing as t from unittest.mock import patch @@ -10,6 +11,7 @@ def get_output( *args: t.Any, **kwargs: t.Any ) -> t.Union[subprocess.CalledProcessError, t.Any]: + """Retrieve output from CLI subprocess, whether success or error.""" try: return subprocess.check_output(*args, **kwargs) except subprocess.CalledProcessError as exc: @@ -28,6 +30,7 @@ def test_command_line( argv_args: t.List[str], expect_cmd: str, ) -> None: + """Basic CLI usage.""" from g import sys as gsys with patch.object(gsys, "argv", argv_args): From 6baa4b3b2d1553502d1cde6d481d14f25185a030 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 9 Dec 2023 05:27:08 -0600 Subject: [PATCH 7/7] docs(CHANGES): Note pydocstyle updates --- CHANGES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index d39f592..1850de2 100644 --- a/CHANGES +++ b/CHANGES @@ -73,6 +73,7 @@ $ pipx install --suffix=@next g --pip-args '\--pre' --force - Split out release to separate job so the PyPI Upload docker image isn't pulled on normal runs - Clean up CodeQL +- ci: Add pydocstyle rule to ruff (#18) - Poetry: Bump 1.1.x to 1.2.x ### Packaging @@ -80,6 +81,10 @@ $ pipx install --suffix=@next g --pip-args '\--pre' --force - Remove `.tmuxp-before-script.sh` (was used in `tmuxp.yaml`'s `before_script`) - Drop Python 3.7 (#13) +### Documentation + +- Add docstrings to functions, methods, classes, and packages (#18) + ## g 0.0.2 (2022-09-11) **Maintenance only release, no bug fixes or features**