kodit 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kodit might be problematic. Click here for more details.
- kodit-0.1.2/.github/workflows/test.yaml +71 -0
- {kodit-0.1.1 → kodit-0.1.2}/PKG-INFO +1 -1
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/_version.py +2 -2
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/alembic/env.py +3 -0
- kodit-0.1.2/src/kodit/config.py +5 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/database.py +5 -3
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/sources/service.py +2 -1
- kodit-0.1.2/tests/smoke.sh +20 -0
- kodit-0.1.1/.github/workflows/test.yaml +0 -44
- {kodit-0.1.1 → kodit-0.1.2}/.github/CODE_OF_CONDUCT.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/CONTRIBUTING.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/workflows/docker.yaml +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/workflows/docs.yaml +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/workflows/pypi-test.yaml +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.github/workflows/pypi.yaml +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.gitignore +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.python-version +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/.vscode/settings.json +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/Dockerfile +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/LICENSE +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/README.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/alembic.ini +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/docs/_index.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/docs/developer/index.md +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/pyproject.toml +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/.gitignore +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/alembic/README +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/alembic/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/alembic/script.py.mako +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/alembic/versions/85155663351e_initial.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/alembic/versions/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/app.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/cli.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/indexing/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/indexing/models.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/indexing/repository.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/indexing/service.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/logging.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/mcp.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/middleware.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/retreival/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/retreival/repository.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/retreival/service.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/sources/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/sources/models.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/sources/repository.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/src/kodit/sse.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/conftest.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/cli_test.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/indexing/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/indexing/test_service.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/mcp_test.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/retreival/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/retreival/test_service.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/sources/__init__.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/tests/kodit/sources/test_service.py +0 -0
- {kodit-0.1.1 → kodit-0.1.2}/uv.lock +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
workflow_call:
|
|
7
|
+
|
|
8
|
+
# Set default permissions for all jobs
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read # Needed to check out code
|
|
11
|
+
checks: write # Needed to report test results
|
|
12
|
+
pull-requests: write # Needed to add comments/annotations to PRs
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout code
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
# Use the official Python action to set up Python because it is faster
|
|
22
|
+
- name: "Set up Python"
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version-file: ".python-version"
|
|
26
|
+
|
|
27
|
+
- name: Install uv
|
|
28
|
+
uses: astral-sh/setup-uv@v5
|
|
29
|
+
|
|
30
|
+
- name: Install the project
|
|
31
|
+
run: uv sync --locked --all-extras --dev
|
|
32
|
+
|
|
33
|
+
- name: Lint
|
|
34
|
+
run: uv run ruff check
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: uv run pytest -s --cov=src --cov-report=xml
|
|
38
|
+
|
|
39
|
+
- name: Pytest coverage comment
|
|
40
|
+
if: github.event_name == 'pull_request'
|
|
41
|
+
uses: MishaKav/pytest-coverage-comment@v1.1.54
|
|
42
|
+
with:
|
|
43
|
+
pytest-xml-coverage-path: ./coverage.xml
|
|
44
|
+
build-test:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
steps:
|
|
47
|
+
- name: Checkout code
|
|
48
|
+
uses: actions/checkout@v4
|
|
49
|
+
|
|
50
|
+
# Use the official Python action to set up Python because it is faster
|
|
51
|
+
- name: "Set up Python"
|
|
52
|
+
uses: actions/setup-python@v5
|
|
53
|
+
with:
|
|
54
|
+
python-version-file: ".python-version"
|
|
55
|
+
|
|
56
|
+
- name: Install uv
|
|
57
|
+
uses: astral-sh/setup-uv@v5
|
|
58
|
+
|
|
59
|
+
- run: uv build --sdist --out-dir test-build
|
|
60
|
+
- run: uv tool run twine check test-build/*.tar.gz
|
|
61
|
+
- name: Find the path of the sdist
|
|
62
|
+
id: sdist-path
|
|
63
|
+
run: echo "::set-output name=path::$(ls test-build/*.tar.gz)"
|
|
64
|
+
- name: Install sdist
|
|
65
|
+
uses: threeal/pipx-install-action@v1.0.0
|
|
66
|
+
with:
|
|
67
|
+
packages: ${{ steps.sdist-path.outputs.path }}
|
|
68
|
+
- name: Run simple version command test
|
|
69
|
+
run: kodit version
|
|
70
|
+
- name: Run smoke test
|
|
71
|
+
run: ./tests/smoke.sh
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
5
5
|
|
|
6
|
+
import structlog
|
|
6
7
|
from alembic import context
|
|
7
8
|
from sqlalchemy import pool
|
|
8
9
|
from sqlalchemy.engine import Connection
|
|
@@ -65,6 +66,8 @@ async def run_async_migrations() -> None:
|
|
|
65
66
|
prefix="sqlalchemy.",
|
|
66
67
|
poolclass=pool.NullPool,
|
|
67
68
|
)
|
|
69
|
+
log = structlog.get_logger(__name__)
|
|
70
|
+
log.debug("Running migrations on %s", connectable.url)
|
|
68
71
|
|
|
69
72
|
async with connectable.connect() as connection:
|
|
70
73
|
await connection.run_sync(do_run_migrations)
|
|
@@ -4,7 +4,6 @@ import asyncio
|
|
|
4
4
|
from collections.abc import AsyncGenerator, Callable
|
|
5
5
|
from datetime import UTC, datetime
|
|
6
6
|
from functools import wraps
|
|
7
|
-
from pathlib import Path
|
|
8
7
|
from typing import Any, TypeVar
|
|
9
8
|
|
|
10
9
|
from alembic import command
|
|
@@ -18,8 +17,9 @@ from sqlalchemy.ext.asyncio import (
|
|
|
18
17
|
)
|
|
19
18
|
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
|
20
19
|
|
|
20
|
+
from kodit.config import DATA_DIR
|
|
21
|
+
|
|
21
22
|
# Constants
|
|
22
|
-
DATA_DIR = Path.cwd() / ".kodit"
|
|
23
23
|
DB_URL = f"sqlite+aiosqlite:///{DATA_DIR}/kodit.db"
|
|
24
24
|
|
|
25
25
|
# Create data directory if it doesn't exist
|
|
@@ -81,5 +81,7 @@ def with_session(func: Callable[..., T]) -> Callable[..., T]:
|
|
|
81
81
|
def configure_database() -> None:
|
|
82
82
|
"""Configure the database by initializing it and running any pending migrations."""
|
|
83
83
|
# Create Alembic configuration and run migrations
|
|
84
|
-
alembic_cfg = Config(
|
|
84
|
+
alembic_cfg = Config()
|
|
85
|
+
alembic_cfg.set_main_option("script_location", "src/kodit/alembic")
|
|
86
|
+
alembic_cfg.set_main_option("sqlalchemy.url", DB_URL)
|
|
85
87
|
command.upgrade(alembic_cfg, "head")
|
|
@@ -18,10 +18,11 @@ import structlog
|
|
|
18
18
|
from tqdm import tqdm
|
|
19
19
|
from uritools import isuri, urisplit
|
|
20
20
|
|
|
21
|
+
from kodit.config import DATA_DIR
|
|
21
22
|
from kodit.sources.models import File, Source
|
|
22
23
|
from kodit.sources.repository import SourceRepository
|
|
23
24
|
|
|
24
|
-
CLONE_DIR =
|
|
25
|
+
CLONE_DIR = DATA_DIR / "clones"
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
class SourceView(pydantic.BaseModel):
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# Test version command
|
|
5
|
+
kodit version
|
|
6
|
+
|
|
7
|
+
# Test sources commands
|
|
8
|
+
kodit sources list
|
|
9
|
+
kodit sources create .
|
|
10
|
+
|
|
11
|
+
# Test indexes commands
|
|
12
|
+
kodit indexes list
|
|
13
|
+
kodit indexes create 1
|
|
14
|
+
kodit indexes run 1
|
|
15
|
+
|
|
16
|
+
# Test retrieve command
|
|
17
|
+
kodit retrieve "test query"
|
|
18
|
+
|
|
19
|
+
# Test serve command with timeout
|
|
20
|
+
timeout 2s kodit serve || true
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
name: Tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
pull_request:
|
|
6
|
-
branches:
|
|
7
|
-
- main
|
|
8
|
-
workflow_call:
|
|
9
|
-
|
|
10
|
-
# Set default permissions for all jobs
|
|
11
|
-
permissions:
|
|
12
|
-
contents: read # Needed to check out code
|
|
13
|
-
checks: write # Needed to report test results
|
|
14
|
-
pull-requests: write # Needed to add comments/annotations to PRs
|
|
15
|
-
|
|
16
|
-
jobs:
|
|
17
|
-
test:
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
steps:
|
|
20
|
-
- name: Checkout code
|
|
21
|
-
uses: actions/checkout@v4
|
|
22
|
-
|
|
23
|
-
# Use the official Python action to set up Python because it is faster
|
|
24
|
-
- name: "Set up Python"
|
|
25
|
-
uses: actions/setup-python@v5
|
|
26
|
-
with:
|
|
27
|
-
python-version-file: ".python-version"
|
|
28
|
-
|
|
29
|
-
- name: Install uv
|
|
30
|
-
uses: astral-sh/setup-uv@v5
|
|
31
|
-
|
|
32
|
-
- name: Install the project
|
|
33
|
-
run: uv sync --locked --all-extras --dev
|
|
34
|
-
|
|
35
|
-
- name: Lint
|
|
36
|
-
run: uv run ruff check
|
|
37
|
-
|
|
38
|
-
- name: Run tests
|
|
39
|
-
run: uv run pytest -s --cov=src --cov-report=xml
|
|
40
|
-
|
|
41
|
-
- name: Pytest coverage comment
|
|
42
|
-
uses: MishaKav/pytest-coverage-comment@v1.1.54
|
|
43
|
-
with:
|
|
44
|
-
pytest-xml-coverage-path: ./coverage.xml
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|