Skip to content

Commit 0c013a5

Browse files
authored
Merge branch 'main' into routes
2 parents 5d76259 + 277cdae commit 0c013a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4759
-1905
lines changed

.env

Lines changed: 0 additions & 3 deletions
This file was deleted.

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ FALKORDB_PORT=<port>
33
FALKORDB_USERNAME=<username>
44
FALKORDB_PASSWORD=<password>
55
OPENAI_API_KEY=<openai_api_key>
6-
GOOGLE_API_KEY=<google_api_key>
6+
GEMINI_API_KEY=<gemini_api_key>
77
SECRET_TOKEN=<secret_token>
88

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip" # See documentation for possible values
4+
directory: "/" # Location of package manifests
5+
schedule:
6+
interval: "daily"
7+
target-branch: "staging"

.github/workflows/python-app.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python application
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Set up Python 3.10
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: "3.10"
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install flake8 pytest
30+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
- name: Lint with flake8
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+
38+
# - name: Test with pytest
39+
# run: |
40+
# pytest

.github/workflows/release-image.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release image to DockerHub
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags: ["v*.*.*"]
7+
branches:
8+
- main
9+
10+
jobs:
11+
build-and-release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set tags
18+
run: |
19+
if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}; then
20+
echo "TAGS=falkordb/code-graph-backend:latest,falkordb/code-graph-backend:${{ github.ref_name }}" >> $GITHUB_ENV
21+
else
22+
echo "TAGS=falkordb/code-graph-backend:edge" >> $GITHUB_ENV
23+
fi
24+
25+
- name: Login to DockerHub
26+
uses: docker/login-action@v3
27+
with:
28+
username: ${{ secrets.DOCKER_USERNAME }}
29+
password: ${{ secrets.DOCKER_PASSWORD }}
30+
31+
- name: Build image
32+
uses: docker/build-push-action@v5
33+
with:
34+
context: .
35+
file: ./Dockerfile
36+
push: true
37+
tags: ${{ env.TAGS }}

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,44 @@
1+
# Byte-compiled files
2+
*.pyc
3+
*.pyo
4+
*.pyd
5+
__pycache__/
6+
7+
# Virtual environments
8+
venv/
9+
env/
10+
.virtualenv/
11+
12+
# Distribution/build files
13+
build/
14+
dist/
15+
*.egg-info/
16+
.eggs/
17+
18+
# IDE settings
19+
.vscode/
20+
.idea/
21+
*.swp
22+
23+
# Logs and debugging
24+
*.log
25+
*.trace
26+
27+
# OS-specific files
28+
.DS_Store
29+
Thumbs.db
30+
31+
# Testing and coverage
32+
htmlcov/
33+
*.cover
34+
.coverage
35+
.cache/
36+
pytest_cache/
37+
38+
# Jupyter Notebook checkpoints
39+
.ipynb_checkpoints/
40+
41+
# Custom settings
142
.env
43+
*.sqlite3
244
.vercel

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Use a Python base image
2+
FROM python:3.12
3+
4+
# Set working directory
5+
WORKDIR /api
6+
7+
# Copy requirements.txt and install dependencies
8+
COPY requirements.txt ./
9+
RUN pip install --no-cache-dir -r requirements.txt
10+
11+
# Copy the rest of the application code
12+
COPY . .
13+
14+
# Expose the port the backend runs on
15+
EXPOSE 5000
16+
17+
# Start the backend
18+
#CMD ["python", "index.py"]
19+
CMD ["flask", "--app", "api/index.py", "run", "--debug"]
20+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 FalkorDB
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,59 @@
1+
[![Try Free](https://img.shields.io/badge/Try%20Free-FalkorDB%20Cloud-FF8101?labelColor=FDE900&link=https://app.falkordb.cloud)](https://app.falkordb.cloud)
2+
[![Dockerhub](https://img.shields.io/docker/pulls/falkordb/falkordb?label=Docker)](https://hub.docker.com/r/falkordb/falkordb/)
3+
[![Discord](https://img.shields.io/discord/1146782921294884966?style=flat-square)](https://discord.com/invite/6M4QwDXn2w)
4+
5+
## Getting Started
6+
7+
[Live Demo](https://code-graph.falkordb.com/)
8+
9+
## Running locally
10+
11+
### Run FalkorDB
12+
13+
Free cloud instance: https://app.falkordb.cloud/signup
14+
15+
Or by running locally with docker:
16+
117
```bash
2-
flask --app code_graph run --debug
18+
docker run -p 6379:6379 -p 3000:3000 -it --rm falkordb/falkordb:latest
319
```
420

5-
Process local git repository, ignoring specific folder(s)
21+
### Config
622

23+
Create your own `.env` file from the `.env.template` file
24+
25+
Start the server:
726
```bash
8-
curl -X POST http://127.0.0.1:5000/process_local_repo -H "Content-Type: application/json" -d '{"repo": "/Users/roilipman/Dev/FalkorDB", "ignore": ["./.github", "./sbin", "./.git","./deps", "./bin", "./build"]}'
27+
flask --app api/index.py run --debug
928
```
1029

11-
Process code coverage
30+
### Creating a graph
31+
32+
Process a local source folder:
1233

1334
```bash
14-
curl -X POST http://127.0.0.1:5000/process_code_coverage -H "Content-Type: application/json" -d '{"lcov": "/Users/roilipman/Dev/code_graph/code_graph/code_coverage/lcov/falkordb.lcov", "repo": "FalkorDB"}'
35+
curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "<FULL_PATH_TO_FOLDER>", "ignore": [<OPTIONAL_IGNORE_LIST>]}' -H "Authorization: <.ENV_SECRET_TOKEN>"
1536
```
1637

17-
Process git information
38+
For example:
1839

1940
```bash
20-
curl -X POST http://127.0.0.1:5000/process_git_history -H "Content-Type: application/json" -d '{"repo": "/Users/roilipman/Dev/falkorDB"}'
41+
curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "/Users/roilipman/Dev/GraphRAG-SDK", "ignore": ["./.github", "./build"]}' -H "Authorization: OpenSesame"
2142
```
43+
44+
## Working with your graph
45+
46+
Once the source code analysis completes your FalkorDB DB will be populated with
47+
a graph representation of your source code, the graph name should be the same as
48+
the name of the folder you've requested to analyze, for the example above a graph named:
49+
"GraphRAG-SDK".
50+
51+
At the moment only the Python and C languages are supported, we do intend to support additional languages.
52+
53+
At this point you can explore and query your source code using various tools
54+
Here are several options:
55+
56+
1. [Code-Graph UI](https://github.com/FalkorDB/code-graph)
57+
1. FalkorDB [Browser](https://github.com/FalkorDB/falkordb-browser/)
58+
2. One of FalkorDB's [clients](https://docs.falkordb.com/clients.html)
59+
3. Use FalkorDB [GraphRAG-SDK](https://github.com/FalkorDB/GraphRAG-SDK) to connect an LLM for natural language exploration.

api/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from .info import *
22
from .llm import ask
33
from .graph import *
4+
from .project import *
45
from .entities import *
6+
from .git_utils import *
57
from .code_coverage import *
68
from .analyzers.source_analyzer import *
79
from .auto_complete import prefix_search

0 commit comments

Comments
 (0)