Skip to content

Commit acd0821

Browse files
committed
chore: prepare for publishing
1 parent 3710389 commit acd0821

36 files changed

Lines changed: 947 additions & 407 deletions

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
quality:
11+
name: Code Quality & Tests
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.10", "3.11"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
cache: 'pip'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -e ".[dev]"
30+
31+
- name: Check formatting (Black)
32+
run: black . --check
33+
34+
- name: Check imports (isort)
35+
run: isort . --check-only
36+
37+
- name: Lint (Flake8)
38+
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
39+
40+
- name: Test (Pytest)
41+
run: pytest

.pre-commit-config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
10+
- repo: https://github.com/psf/black
11+
rev: 24.1.1
12+
hooks:
13+
- id: black
14+
15+
- repo: https://github.com/pycqa/isort
16+
rev: 5.13.2
17+
hooks:
18+
- id: isort
19+
20+
- repo: https://github.com/pycqa/flake8
21+
rev: 7.0.0
22+
hooks:
23+
- id: flake8
24+
additional_dependencies: [flake8-bugbear]

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

PUBLISH.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Publishing to PyPI Guide
2+
3+
This guide outlines the steps to publish the **Code-RAG** project to PyPI.
4+
5+
## 1. Prerequisites
6+
- Create an account on [PyPI](https://pypi.org/account/register/).
7+
- (Optional but recommended) Create an account on [TestPyPI](https://test.pypi.org/account/register/) to test the upload first.
8+
- Install the necessary tools:
9+
```bash
10+
pip install --upgrade build twine
11+
```
12+
13+
## 2. Configuration
14+
We have already created a `pyproject.toml` file which contains the metadata and dependencies.
15+
- **Action Required**: Open `pyproject.toml` and update the following fields:
16+
- `authors`: Replace "Your Name" and "your.email@example.com".
17+
- `project.urls`: Update the GitHub URLs to your repository.
18+
19+
## 3. Build the Package
20+
Run the following command in the root directory:
21+
```bash
22+
python -m build
23+
```
24+
This will create a `dist/` directory containing the source distribution (`.tar.gz`) and the wheel (`.whl`).
25+
26+
## 4. Validate the Package
27+
Check if the description and metadata are correct:
28+
```bash
29+
twine check dist/*
30+
```
31+
32+
## 5. (Recommended) Upload to TestPyPI
33+
It's a good idea to test the upload on the test server first:
34+
```bash
35+
twine upload --repository testpypi dist/*
36+
```
37+
You can then try installing it from TestPyPI:
38+
```bash
39+
pip install --index-url https://test.pypi.org/simple/ --no-deps code-rag
40+
```
41+
42+
## 6. Upload to PyPI
43+
Once everything looks good, upload to the real PyPI:
44+
```bash
45+
twine upload dist/*
46+
```
47+
48+
## 7. Versioning
49+
To publish a new version later:
50+
1. Update the version in `pyproject.toml` and `src/__init__.py`.
51+
2. Delete the old `dist/` folder.
52+
3. Repeat steps 3, 4, and 6.

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Claude: [Automatically searches and finds the code]
6464
"I found the database connection logic in src/db/connection.py..."
6565
```
6666

67-
See [MCP_SETUP.md](MCP_SETUP.md) for detailed setup.
67+
See [docs/mcp.md](docs/mcp.md) for detailed setup.
6868

6969
## Basic Usage
7070

@@ -107,7 +107,7 @@ export CODE_RAG_CHUNK_SIZE="2048"
107107
export CODE_RAG_ADDITIONAL_IGNORE_PATTERNS="*.tmp,*.bak,logs/"
108108
```
109109

110-
Full configuration options in [IMPLEMENTATION.md](IMPLEMENTATION.md#configuration-system).
110+
Full configuration options in [docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md#configuration-system).
111111

112112
## How It Works
113113

@@ -141,8 +141,8 @@ for r in results:
141141
## Documentation
142142

143143
- **[AGENTS.md](AGENTS.md)** - Developer onboarding and architecture overview
144-
- **[IMPLEMENTATION.md](IMPLEMENTATION.md)** - Detailed implementation reference
145-
- **[MCP_SETUP.md](MCP_SETUP.md)** - MCP server setup guide
144+
- **[docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md)** - Detailed implementation reference
145+
- **[docs/mcp.md](docs/mcp.md)** - MCP server setup guide
146146

147147
## Supported Languages
148148

@@ -164,6 +164,29 @@ Other languages use line-aware chunking (still works, just less context-aware).
164164

165165
**Memory issues?** `export CODE_RAG_BATCH_SIZE="16"`
166166

167+
## Development
168+
169+
### Setup
170+
171+
```bash
172+
# Install with dev dependencies
173+
pip install -e ".[dev]"
174+
```
175+
176+
### Testing & Linting
177+
178+
```bash
179+
# Run tests
180+
pytest
181+
182+
# Format code
183+
black .
184+
isort .
185+
186+
# Linting
187+
flake8
188+
```
189+
167190
## Contributing
168191

169192
1. Fork the repo
@@ -172,7 +195,7 @@ Other languages use line-aware chunking (still works, just less context-aware).
172195
4. Add tests
173196
5. Submit PR
174197

175-
See [AGENTS.md](AGENTS.md) for architecture and [IMPLEMENTATION.md](IMPLEMENTATION.md) for internals.
198+
See [AGENTS.md](AGENTS.md) for architecture and [docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md) for internals.
176199

177200
## License
178201

pyproject.toml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "code-rag"
7+
version = "0.1.0"
8+
description = "MCP server for efficient code search"
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
license = {file = "LICENSE"}
12+
authors = [
13+
{name = "Duc Nguyen", email = "duc@qduc.me"},
14+
]
15+
keywords = ["rag", "code-search", "embeddings", "semantic-search", "mcp"]
16+
classifiers = [
17+
"Development Status :: 3 - Alpha",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.8",
22+
"Programming Language :: Python :: 3.9",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
26+
"Topic :: Software Development :: Libraries :: Python Modules",
27+
]
28+
dependencies = [
29+
"chromadb>=1.3.5",
30+
"qdrant-client>=1.7.0",
31+
"sentence-transformers>=2.2.0",
32+
"einops>=0.6.0",
33+
"openai>=1.50.0",
34+
"python-dotenv>=0.21.0",
35+
"mcp>=0.9.0",
36+
"tree-sitter>=0.22.0",
37+
"tree-sitter-python>=0.21.0",
38+
"tree-sitter-javascript>=0.21.0",
39+
"tree-sitter-typescript>=0.21.0",
40+
"tree-sitter-go>=0.21.0",
41+
"tree-sitter-rust>=0.21.0",
42+
"tree-sitter-java>=0.21.0",
43+
"tree-sitter-cpp>=0.21.0",
44+
"tree-sitter-c>=0.21.0",
45+
"fastapi>=0.104.0",
46+
"uvicorn>=0.24.0",
47+
"requests>=2.31.0",
48+
]
49+
50+
[project.optional-dependencies]
51+
dev = [
52+
"pytest>=7.0.0",
53+
"flake8>=6.0.0",
54+
"black>=23.0.0",
55+
"isort>=5.12.0",
56+
"twine>=4.0.0",
57+
"build>=1.0.0",
58+
"pre-commit>=3.6.0",
59+
]
60+
61+
[project.scripts]
62+
code-rag = "code_rag.main:main"
63+
code-rag-mcp = "code_rag.mcp_server:main"
64+
code-rag-server = "code_rag.embedding_server:main"
65+
66+
[project.urls]
67+
Homepage = "https://github.com/qduc/code-rag"
68+
Issues = "https://github.com/qduc/code-rag/issues"
69+
70+
[tool.setuptools]
71+
packages = ["code_rag"]
72+
73+
[tool.setuptools.package-dir]
74+
code_rag = "src"
75+
76+
[tool.black]
77+
line-length = 88
78+
79+
[tool.isort]
80+
profile = "black"
81+
line_length = 88

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 120
3+
extend-ignore = E203, W503
4+
exclude = .git, __pycache__, build, dist, .venv, .env, .idea, .pytest_cache

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
"""Setup script for code-rag."""
22

3-
from setuptools import setup, find_packages
4-
5-
3+
from setuptools import find_packages, setup
64

75
setup(
86
name="code-rag",

src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Code-RAG: Codebase vector search tool."""
22

3-
__version__ = "0.1.0"
3+
__version__ = "0.1.0"

0 commit comments

Comments
 (0)