COG-3395: Chore: pre-commit, pre-commit action, contribution guide update (#1979)
## Description Revisited the `CONTRIBUTING.md`: * Added the `Required tools` * Pre-commit requirement. It replaces `ruff` and other linting guides * Fixed `test_library.py` paths. Made sure that the testing guide is complete and works * Added a `pre-commit` step to `Pre-Test` workflow. It will fail if `pre-commit` has issues and no other tests will be triggered * Added a sufficient LLM configuration example for tests. Moved `cognee/.env.example` to the project root for convenience >>> Requires: https://github.com/topoteretes/cognee/pull/1980 <<< ## Acceptance Criteria `pre-commit` action works Tested pre-commit locally. If a commit violates the rules - it rejects it and fixes the issues. Then we need to `git commit ...` again. ## Type of Change <!-- Please check the relevant option --> - [ ] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [x] Other (please specify): CI and DevExp improvement ## Screenshots/Videos (if applicable) <!-- Add screenshots or videos to help explain your changes --> ## Pre-submission Checklist <!-- Please check all boxes that apply before submitting your PR --> - [ ] **I have tested my changes thoroughly before submitting this PR** - [ ] **This PR contains minimal changes necessary to address the issue/feature** - [ ] My code follows the project's coding standards and style guidelines - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added necessary documentation (if applicable) - [ ] All new and existing tests pass - [ ] I have searched existing PRs to ensure this change hasn't been submitted already - [ ] I have linked any relevant issues in the description - [ ] My commits have clear and descriptive messages ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Expanded contributor guide with setup, required tools, testing instructions, examples, and updated PR submission guidance. * Updated pull-request checklist to reference contributing instructions. * **Chores** * Added three new local environment variables for LLM configuration and updated example env file. * Added a pre-commit validation step to CI. * Updated ignore list to exclude a local environment file. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
commit
b1ff473a38
5 changed files with 23 additions and 8 deletions
|
|
@ -3,3 +3,7 @@
|
|||
# CORS_ALLOWED_ORIGINS="https://yourdomain.com,https://another.com"
|
||||
# For local development, you might use:
|
||||
# CORS_ALLOWED_ORIGINS="http://localhost:3000"
|
||||
|
||||
LLM_API_KEY="your-openai-api-key"
|
||||
LLM_MODEL="openai/gpt-4o-mini"
|
||||
LLM_PROVIDER="openai"
|
||||
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
|
|
@ -29,7 +29,7 @@ DO NOT use AI-generated descriptions. We want to understand your thought process
|
|||
|
||||
## Pre-submission Checklist
|
||||
<!-- Please check all boxes that apply before submitting your PR -->
|
||||
- [ ] **I have tested my changes thoroughly before submitting this PR**
|
||||
- [ ] **I have tested my changes thoroughly before submitting this PR** (See `CONTRIBUTING.md`)
|
||||
- [ ] **This PR contains minimal changes necessary to address the issue/feature**
|
||||
- [ ] My code follows the project's coding standards and style guidelines
|
||||
- [ ] I have added tests that prove my fix is effective or that my feature works
|
||||
|
|
|
|||
5
.github/workflows/pre_test.yml
vendored
5
.github/workflows/pre_test.yml
vendored
|
|
@ -5,7 +5,7 @@ permissions:
|
|||
contents: read
|
||||
jobs:
|
||||
check-uv-lock:
|
||||
name: Validate uv lockfile and project metadata
|
||||
name: Lockfile and Pre-commit Hooks
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
|
|
@ -20,3 +20,6 @@ jobs:
|
|||
|
||||
- name: Validate uv lockfile and project metadata
|
||||
run: uv lock --check || { echo "'uv lock --check' failed."; echo "Run 'uv lock' and push your changes."; exit 1; }
|
||||
|
||||
- name: Run pre-commit hooks
|
||||
uses: pre-commit/action@v3.0.1
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -147,6 +147,7 @@ venv/
|
|||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
mise.toml
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
|
|
|
|||
|
|
@ -62,6 +62,11 @@ Looking for a place to start? Try filtering for [good first issues](https://gith
|
|||
|
||||
## 2. 🛠️ Development Setup
|
||||
|
||||
### Required tools
|
||||
* [Python](https://www.python.org/downloads/)
|
||||
* [uv](https://docs.astral.sh/uv/getting-started/installation/)
|
||||
* pre-commit: `uv run pip install pre-commit && pre-commit install`
|
||||
|
||||
### Fork and Clone
|
||||
|
||||
1. Fork the [**cognee**](https://github.com/topoteretes/cognee) repository
|
||||
|
|
@ -93,29 +98,31 @@ git checkout -b feature/your-feature-name
|
|||
4. **Commits**: Write clear commit messages
|
||||
|
||||
### Running Tests
|
||||
|
||||
Rename `.env.example` into `.env` and provide your OPENAI_API_KEY as LLM_API_KEY
|
||||
|
||||
```shell
|
||||
python cognee/cognee/tests/test_library.py
|
||||
uv run python cognee/tests/test_library.py
|
||||
```
|
||||
|
||||
### Running Simple Example
|
||||
|
||||
Change .env.example into .env and provide your OPENAI_API_KEY as LLM_API_KEY
|
||||
Rename `.env.example` into `.env` and provide your OPENAI_API_KEY as LLM_API_KEY
|
||||
|
||||
Make sure to run ```shell uv sync ``` in the root cloned folder or set up a virtual environment to run cognee
|
||||
|
||||
```shell
|
||||
python cognee/cognee/examples/python/simple_example.py
|
||||
python examples/python/simple_example.py
|
||||
```
|
||||
or
|
||||
|
||||
```shell
|
||||
uv run python cognee/cognee/examples/python/simple_example.py
|
||||
uv run python examples/python/simple_example.py
|
||||
```
|
||||
|
||||
## 4. 📤 Submitting Changes
|
||||
|
||||
1. Install ruff on your system
|
||||
2. Run ```ruff format .``` and ``` ruff check ``` and fix the issues
|
||||
1. Make sure that `pre-commit` and hooks are installed. See `Required tools` section for more information. Try executing `pre-commit run` if you are not sure.
|
||||
3. Push your changes:
|
||||
```shell
|
||||
git add .
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue