Installation

The installation for KGX requires Python 3.10 or greater.

Installation for users

Installing from PyPI

KGX is available on PyPI and can be installed using pip as follows:

pip install kgx

To install a particular version of KGX, specify the version number:

pip install kgx==2.4.2

Installing from GitHub

Clone the GitHub repository and install using pip:

git clone https://github.com/biolink/kgx
cd kgx
pip install .

Installation for developers

Setting up a development environment with Poetry

KGX uses Poetry for dependency management. First, install Poetry using pipx:

pip install pipx
pipx ensurepath
pipx install poetry

Next, clone the GitHub repository:

git clone https://github.com/biolink/kgx
cd kgx

Install all dependencies and create a virtual environment with Poetry:

poetry install

To activate the poetry virtual environment:

poetry shell

Using a traditional virtual environment

Alternatively, you can use a traditional virtual environment:

git clone https://github.com/biolink/kgx
cd kgx
python3 -m venv env
source env/bin/activate
pip install .

Setting up a testing environment

KGX has a suite of tests that rely on Docker containers to run Neo4j specific tests.

To set up the required containers, first install Docker on your local machine.

Once Docker is up and running, run the following commands:

docker run -d --name kgx-neo4j-integration-test \
            -p 7474:7474 -p 7687:7687 \
            --env NEO4J_AUTH=neo4j/test \
            neo4j:3.5.25
docker run -d --name kgx-neo4j-unit-test \
            -p 8484:7474 -p 8888:7687 \
            --env NEO4J_AUTH=neo4j/test \
            neo4j:3.5.25

Note: Setting up the Neo4j container is optional. If there is no container set up then the tests that rely on them are skipped.

KGX tests are run using make:

# The Makefile already handles running commands through Poetry
make test