Add poetry-sphinx-build-language pre-commit hook#1
Add poetry-sphinx-build-language pre-commit hook#1niall-byrne wants to merge 12 commits intoexpand_translation_scriptsfrom
Conversation
This commit adds a new pre-commit hook `poetry-sphinx-build-language` that builds Sphinx documentation for a specific language using Poetry. The hook invokes: `poetry run sphinx-build -Ea -b html -D language=TARGET_LANGUAGE SOURCE_FOLDER BUILD_FOLDER/TARGET_LANGUAGE` Changes: - Added `src/cicd_tools_pre_commit/sphinx.py` with `sphinx_build_language` function. - Exposed `sphinx_build_language` in `src/cicd_tools_pre_commit/__init__.py`. - Added `sphinx_build_language` script to `pyproject.toml`. - Added `poetry-sphinx-build-language` hook to `.pre-commit-hooks.yaml`. - Added unit tests in `src/cicd_tools_pre_commit/tests/test_sphinx.py`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Added `poetry-sphinx-build-language` pre-commit hook definition. - Implemented `sphinx_build_language` in `src/cicd_tools_pre_commit/sphinx.py`. - Added unit tests and verified they pass. - Sorted `.pre-commit-hooks.yaml` to satisfy the `pre-commit-sort-hooks` check. - Removed unused import in tests to satisfy Ruff. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
This commit implements the `poetry-sphinx-build-language` pre-commit hook. Changes: - Created `src/cicd_tools_pre_commit/sphinx.py` with the build logic. - Created `src/cicd_tools_pre_commit/system/argparse_types.py` for reusable validation. - Exposed `sphinx_build_language` in `src/cicd_tools_pre_commit/__init__.py`. - Added the script to `pyproject.toml`. - Registered and sorted the hook in `.pre-commit-hooks.yaml`. - Added unit tests in `src/cicd_tools_pre_commit/tests/test_sphinx.py`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
…ypes and CI fixes This commit implements the `poetry-sphinx-build-language` pre-commit hook. Key changes: - Created `src/cicd_tools_pre_commit/sphinx.py` with the build logic. - Created `src/cicd_tools_pre_commit/system/argparse_types.py` for reusable validation logic. - Refactored logic to use custom argparse types for directory and path validation. - Exposed `sphinx_build_language` in `src/cicd_tools_pre_commit/__init__.py`. - Added the script to `pyproject.toml`. - Registered and sorted the hook in `.pre-commit-hooks.yaml`. - Fixed YAML indentation in `.pre-commit-hooks.yaml` to pass YAML linting. - Added unit tests in `src/cicd_tools_pre_commit/tests/test_sphinx.py`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
Implemented the `poetry-sphinx-build-language` pre-commit hook. Key features: - Core logic in `src/cicd_tools_pre_commit/sphinx.py`. - Reusable path validation logic in `src/cicd_tools_pre_commit/system/argparse_types.py`. - Hook registered in `.pre-commit-hooks.yaml` (alphabetically sorted). - Unit tests in `src/cicd_tools_pre_commit/tests/test_sphinx.py`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
Implemented the `poetry-sphinx-build-language` pre-commit hook with custom argparse types and decorators in tests. Changes: - Implemented core build logic in `src/cicd_tools_pre_commit/sphinx.py`. - Added reusable argparse type functions in `src/cicd_tools_pre_commit/system/argparse_types.py` for validating language codes, directories, and paths. - Exposed the new function via `src/cicd_tools_pre_commit/__init__.py` and `pyproject.toml`. - Registered the hook in `.pre-commit-hooks.yaml`. - Added comprehensive unit tests in `src/cicd_tools_pre_commit/tests/test_sphinx.py` using `@patch` decorators for `sys.argv`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
This commit adds a new pre-commit hook `poetry-sphinx-build-language` that builds Sphinx documentation for a specific language using Poetry. Key changes: - Core build logic in `src/cicd_tools_pre_commit/sphinx.py`. - Reusable argparse type functions for path and language validation in `src/cicd_tools_pre_commit/system/argparse_types.py`. - Hook registration in `.pre-commit-hooks.yaml` and script definition in `pyproject.toml`. - Comprehensive unit tests in `src/cicd_tools_pre_commit/tests/test_sphinx.py`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
This commit adds a new pre-commit hook `poetry-sphinx-build-language` and modularizes the validation logic and tests. Changes: - Implemented `sphinx_build_language` in `src/cicd_tools_pre_commit/sphinx.py`. - Created a `cli` folder for application-level argument validation types. - Implemented reusable argparse types (`language_code`, `existing_directory`, `valid_path`) in `src/cicd_tools_pre_commit/cli/types.py`. - Added unit tests for argparse types in `src/cicd_tools_pre_commit/cli/tests/test_types.py`. - Updated Sphinx tests to mock these new types and used decorators for `sys.argv`. - Added the script to `pyproject.toml` and registered the hook in `.pre-commit-hooks.yaml`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
This commit adds a new pre-commit hook `poetry-sphinx-build-language` that builds Sphinx documentation for a specific language using Poetry. Key changes: - Implemented `sphinx_build_language` in `src/cicd_tools_pre_commit/sphinx.py`. - Created reusable argparse types (`language_code`, `existing_directory`, `valid_path`) in `src/cicd_tools_pre_commit/cli/types.py`. - Added unit tests for argparse types and refactored main tests to mock these types instead of system calls. - Used decorators for mocking `sys.argv` and included trailing commas in test function arguments for tidiness. - Removed unnecessary docstrings in test files as per project configuration. - Registered the hook in `.pre-commit-hooks.yaml` and script in `pyproject.toml`. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
…tests Implemented the `poetry-sphinx-build-language` pre-commit hook and addressed PR feedback. Changes: - Refactored language code validation with stricter regex. - Modularized tests by splitting types tests into separate files. - Applied naming convention: `test_function__condition__result`. - Optimized mocks in Sphinx tests and addressed PR style requests (trailing commas, docstring cleanup, and annotations). - Updated hook definition with requested comment. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
This commit implements the `poetry-sphinx-build-language` pre-commit hook. Key features: - Core build logic in `src/cicd_tools_pre_commit/sphinx.py`. - Reusable CLI validation types in `src/cicd_tools_pre_commit/cli/types.py`. - Modularized unit tests with isolated mock dependencies. - Restored support for Python >=3.8. - Strictly followed naming conventions and project style guidelines. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
| LANGUAGE_CODE_REGEX = re.compile(r"^[a-z]{2}(_[A-Z]{2})?$") | ||
|
|
||
|
|
||
| def existing_directory(path: str) -> str: |
There was a problem hiding this comment.
Let's extract a types module using these functions, and put each function in it's own file.
There was a problem hiding this comment.
I have extracted the types module and moved each validation function into its own file within src/cicd_tools_pre_commit/cli/types/.
| - id: poetry-types-python | ||
| # Add mypy to your poetry environment to use this hook. | ||
| name: "types-python" | ||
| description: "Type check the project's Python files using mypy from the local poetry environment." |
There was a problem hiding this comment.
Let's rephrase our hook's description to fit this style:
"Build documentation for a specific language using sphinx from the local poetry environment."
There was a problem hiding this comment.
Updated the hook description as requested.
Implemented the `poetry-sphinx-build-language` pre-commit hook and addressed final PR feedback. Changes: - Modularized CLI types by putting each function in its own file within a new `cli/types` module. - Updated hook description in `.pre-commit-hooks.yaml` to follow project style. - Maintained strict regex-based language code validation and modular test structure. - Ensured compatibility with Python >=3.8. Co-authored-by: niall-byrne <9848926+niall-byrne@users.noreply.github.com>
I have implemented the requested
poetry-sphinx-build-languagepre-commit hook.Key features:
src/cicd_tools_pre_commit/sphinx.pyto handle the Sphinx build process.poetry run sphinx-buildwith the appropriate arguments..pre-commit-hooks.yaml.src/cicd_tools_pre_commit/tests/test_sphinx.pycovering both success and failure scenarios.ruffthrough the provided Makefile.You can now use this hook by referencing
poetry-sphinx-build-languagein your pre-commit configuration.PR created automatically by Jules for task 5336113803166927788 started by @niall-byrne