Skip to content

chore: add code quality automation with pre-commit hooks, coverage, and Dependabot#65

Open
knqiufan wants to merge 4 commits intooceanbase:mainfrom
knqiufan:chore/code-quality-automation
Open

chore: add code quality automation with pre-commit hooks, coverage, and Dependabot#65
knqiufan wants to merge 4 commits intooceanbase:mainfrom
knqiufan:chore/code-quality-automation

Conversation

@knqiufan
Copy link

Summary

This PR adds code quality automation tooling to improve development workflow and maintain code standards, including pre-commit hooks, type checking support, test coverage reporting, and automated dependency updates.

close #44

Dependencies

  • Depends on #XX (PR 2: Improved Error Handling)

Changes

1. Pre-commit Hooks (.pre-commit-config.yaml)

  • pre-commit-hooks v4.5.0: trailing-whitespace, end-of-file-fixer, check-yaml, check-added-large-files, check-merge-conflict, debug-statements
  • ruff-pre-commit v0.5.0: linting and formatting
  • mirrors-mypy v1.10.0: type checking for langchain_oceanbase/ directory
  • Added pre-commit = "^3.7" to dev dependencies in pyproject.toml
  • Added Makefile targets: install-hooks, run-hooks

2. py.typed Marker (PEP 561)

  • Created langchain_oceanbase/py.typed empty marker file
  • Updated pyproject.toml with packages and include configuration

3. Test Coverage

  • Added pytest-cov = "^4.1" to test dependencies
  • Added Makefile target: test-coverage (generates HTML coverage report)
  • Added badges to README.md (CI, PyPI, Python Version, License)
  • Updated .gitignore for coverage files (.coverage, htmlcov/)

4. Dependabot (.github/dependabot.yml)

  • Python dependencies: weekly updates (Monday), grouped by dev/production
  • GitHub Actions: monthly updates
  • Automatic labels for dependency PRs

Usage

Install pre-commit hooks

poetry install --with dev
poetry run pre-commit install

Run hooks manually

poetry run pre-commit run --all-files

Run tests with coverage

poetry run pytest --cov=langchain_oceanbase --cov-report=html tests/unit_tests/

…nd improve SQL syntax in checkpointer.py for clarity and consistency
…g in OceanBase integration

- Introduced a comprehensive troubleshooting section in README.md covering common connection issues, vector dimension mismatches, index creation failures, and AI function support.
- Enhanced error handling in the OceanBase integration by replacing generic ValueErrors with specific OceanBase exceptions for better clarity and debugging.
- Updated exception handling in the OceanBaseCheckpointSaver and OceanbaseVectorStore classes to provide more informative error messages.
…guration

- Added a .pre-commit-config.yaml file to integrate pre-commit hooks for code quality checks, including trailing whitespace removal, YAML validation, and Ruff for linting.
- Updated the Makefile to include targets for installing and running pre-commit hooks, as well as a new target for testing coverage.
- Expanded .gitignore to exclude coverage-related files and directories.
- Updated pyproject.toml to include pre-commit and pytest-cov as development dependencies.
- Added coverage package to poetry.lock for test coverage measurement.
@knqiufan knqiufan mentioned this pull request Jan 31, 2026
9 tasks
@xxsc0529
Copy link
Contributor

@knqiufan Thank you for your contribution. Can you resolve the PR conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code quality automation

2 participants