Skip to content

Commit

Permalink
Add new engine code, remove media and fluff
Browse files Browse the repository at this point in the history
  • Loading branch information
markgacoka committed Jun 10, 2024
1 parent f5b25df commit b240c1b
Show file tree
Hide file tree
Showing 23 changed files with 62 additions and 594 deletions.
13 changes: 0 additions & 13 deletions CHANGELOG.md

This file was deleted.

176 changes: 0 additions & 176 deletions LICENSE

This file was deleted.

12 changes: 0 additions & 12 deletions ORIENTDB.md

This file was deleted.

41 changes: 27 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
## Code Property Graph
<p align="center">
<a href="https://github.com/markgacoka/codepropertygraph/blob/main/LICENSE" alt="License"><img align="center" alt="Apache license badge" src="https://img.shields.io/github/license/markgacoka/codepropertygraph?style=flat-square"></a>
<a href="https://github.com/markgacoka/codepropertygraph/pulse" alt="Stars"><img align="center" alt="Github Stars badge" src="https://img.shields.io/github/stars/markgacoka/codepropertygraph?style=flat-square"></a>
<a href="https://github.com/markgacoka/codepropertygraph/releases" alt="Release"><img align="center" alt="GitHub release (latest SemVer) badge" src="https://img.shields.io/github/v/release/markgacoka/codepropertygraph?style=flat-square"></a>
<a href="https://github.com/markgacoka/codepropertygraph/graphs/contributors" alt="Maintained"><img align="center" alt="Maintenance badge" src="https://img.shields.io/maintenance/yes/2022?style=flat-square"></a>
<a href="https://github.com/markgacoka/codepropertygraph/blob/main/CONTRIBUTING.md" alt="Contributions Welcome"><img align="center" alt="Contributions badge" src="https://img.shields.io/badge/contributions-welcome-blue?style=flat-square"></a>
</p>

<p align="center"><img align="center" alt="Code Property Graph Logo" src="https://raw.githubusercontent.com/markgacoka/codepropertygraph/main/media/cpg.png"></p>
Expand All @@ -18,7 +16,7 @@ A code property graph is a highly efficient data structure designed to mine larg
## Running as a Library
### Installation
Requires:
- `python==3.9.12`
- `Python 3`
- `pip3`
```
pip install codepropertygraph
Expand All @@ -28,12 +26,12 @@ pip install codepropertygraph
```python
from codepropertygraph import CPG

PATH = 'C:\Users\ExampleUser\Projects\portfolio'
code = """a = 1; b = 2; print(a + b)"""

code_cpg = CPG(PATH)
print(code_cpg.files.count)
graph = CPG(code)
print(graph)

> 1
> Graph(Nodes(a, b), Edges([a, b]))
```

## Running from Source
Expand All @@ -48,16 +46,14 @@ print(code_cpg.files.count)
|-----------------------|-----------------|
| ![Start the DB](media/start_db.png) | ![Active DB](media/db_active.png) |

If you would like to use OrientDB, here are the [instructions](/ORIENTDB.md).

### Installation
To install the repository, you need to clone it and run it inside a virtual environment. Running `main.py` generates a Code Property Graph of the simple addition script inside `examples/` and saves it to `output/`.
```
git clone https://github.com/markgacoka/codepropertygraph.git
cd codepropertygraph
conda create --name codepropertygraph python=3.8
conda activate codepropertygraph
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```

Expand All @@ -67,13 +63,30 @@ python main.py
```

## Testing
**Note:** Tested only on Windows 10, 11.
Run all tests
```
pytest tests
```

## Updating Library

1. Change the version number
```
--> VERSION="0.0.9"
DESCRIPTION="A Python implementation of a Code Property Graph."
LONG_DESCRIPTION="A tool for ..."
-- OR --
setup(
name='codepropertygraph',
version=VERSION,
```

python tests/test_example.py
2. Upload to Pypi
```
python setup.py sdist bdist_wheel
pip install twine
twine upload dist/*
```


For first time contributors, read the [CONTRIBUTING](https://github.com/markgacoka/codepropertygraph/blob/main/CONTRIBUTING.md) page.
5 changes: 1 addition & 4 deletions codepropertygraph/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
import sys
sys.dont_write_bytecode = True

from core.cpgraph import CPG
from .engine import get_neo4j_connection
2 changes: 0 additions & 2 deletions codepropertygraph/core/__init__.py

This file was deleted.

14 changes: 0 additions & 14 deletions codepropertygraph/core/ast2.py

This file was deleted.

60 changes: 0 additions & 60 deletions codepropertygraph/core/ast3.py

This file was deleted.

7 changes: 0 additions & 7 deletions codepropertygraph/core/ast4.py

This file was deleted.

Loading

0 comments on commit b240c1b

Please sign in to comment.