From 962ddf4257b74190fdcfa59f6f72988066d61813 Mon Sep 17 00:00:00 2001 From: Pavel Zorin Date: Thu, 8 Jan 2026 16:11:22 +0100 Subject: [PATCH 1/4] Chore: pre-commit, pre-commit action, contribution guide update --- cognee/api/.env.example => .env.example | 4 ++++ .github/pull_request_template.md | 2 +- .github/workflows/pre_test.yml | 11 ++++++++--- .gitignore | 1 + CONTRIBUTING.md | 19 +++++++++++++------ 5 files changed, 27 insertions(+), 10 deletions(-) rename cognee/api/.env.example => .env.example (75%) diff --git a/cognee/api/.env.example b/.env.example similarity index 75% rename from cognee/api/.env.example rename to .env.example index ad08f6e4e..8a1f9830d 100644 --- a/cognee/api/.env.example +++ b/.env.example @@ -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" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index be9d219c1..4bd15a4ad 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -29,7 +29,7 @@ DO NOT use AI-generated descriptions. We want to understand your thought process ## Pre-submission Checklist -- [ ] **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 diff --git a/.github/workflows/pre_test.yml b/.github/workflows/pre_test.yml index 115313eac..aa4a26347 100644 --- a/.github/workflows/pre_test.yml +++ b/.github/workflows/pre_test.yml @@ -13,10 +13,15 @@ jobs: with: fetch-depth: 0 - - name: Install uv - uses: astral-sh/setup-uv@v4 + - name: Cognee Setup + uses: ./.github/actions/cognee_setup with: - enable-cache: true + python-version: '3.11.x' - 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 + run: | + uv run pip install pre-commit + pre-commit run diff --git a/.gitignore b/.gitignore index ff42efc97..3d7d33d3c 100644 --- a/.gitignore +++ b/.gitignore @@ -147,6 +147,7 @@ venv/ ENV/ env.bak/ venv.bak/ +mise.toml # Spyder project settings .spyderproject diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e8ed4aa9..3a810733b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 . From b0fe1a8439eac842cb6de855c2960faf4ec56c19 Mon Sep 17 00:00:00 2001 From: Pavel Zorin Date: Thu, 8 Jan 2026 16:31:59 +0100 Subject: [PATCH 2/4] CI: Speed up pre-test workflow --- .github/workflows/pre_test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre_test.yml b/.github/workflows/pre_test.yml index aa4a26347..27931ea45 100644 --- a/.github/workflows/pre_test.yml +++ b/.github/workflows/pre_test.yml @@ -13,10 +13,10 @@ jobs: with: fetch-depth: 0 - - name: Cognee Setup - uses: ./.github/actions/cognee_setup + - name: Install uv + uses: astral-sh/setup-uv@v4 with: - python-version: '3.11.x' + enable-cache: true - 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; } From 15a88accac056e46d948bb0c4feba73276b66a6d Mon Sep 17 00:00:00 2001 From: Pavel Zorin Date: Thu, 8 Jan 2026 16:51:48 +0100 Subject: [PATCH 3/4] Chore: use pre-commit action --- .github/workflows/pre_test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pre_test.yml b/.github/workflows/pre_test.yml index 27931ea45..a36b17f89 100644 --- a/.github/workflows/pre_test.yml +++ b/.github/workflows/pre_test.yml @@ -22,6 +22,4 @@ jobs: run: uv lock --check || { echo "'uv lock --check' failed."; echo "Run 'uv lock' and push your changes."; exit 1; } - name: Run pre-commit hooks - run: | - uv run pip install pre-commit - pre-commit run + uses: pre-commit/action@v3.0.1 From 3e602fdad72f712030ae1ec94d2c2b27599faebe Mon Sep 17 00:00:00 2001 From: Pavel Zorin Date: Thu, 8 Jan 2026 18:40:02 +0100 Subject: [PATCH 4/4] Renamed the pre_test workflow --- .github/workflows/pre_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre_test.yml b/.github/workflows/pre_test.yml index a36b17f89..912dc7bc7 100644 --- a/.github/workflows/pre_test.yml +++ b/.github/workflows/pre_test.yml @@ -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