From 3c54db92fb3dc287a8dbf0b6540571216b7b3111 Mon Sep 17 00:00:00 2001 From: Katarina Supe <61758502+katarinasupe@users.noreply.github.com> Date: Tue, 18 Apr 2023 19:25:46 +0200 Subject: [PATCH] Update installation prerequisites (#233) * Update installation prerequisites * Update with optional dependencies * Change docs generation instructions * Update README with optional dependencies * Add PyG installation --------- Co-authored-by: antepusic --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index b721c0cd..d4f2996b 100644 --- a/README.md +++ b/README.md @@ -14,33 +14,68 @@ An Object Graph Mapper or OGM provides a developer-friendly workflow that allows for writing object-oriented notation to communicate with graph databases. Instead of writing Cypher queries, you will be able to write object-oriented code, which the OGM will automatically translate into Cypher queries. +## Installation + GQLAlchemy is built on top of Memgraph's low-level Python client `pymgclient` ([PyPI](https://pypi.org/project/pymgclient/) / [Documentation](https://memgraph.github.io/pymgclient/) / -[GitHub](https://github.com/memgraph/pymgclient)). +[GitHub](https://github.com/memgraph/pymgclient)). -## Installation +To install GQLAlchemy, you first need to install `pymgclient` [build prerequisites](https://memgraph.github.io/pymgclient/introduction.html#build-prerequisites). -Before you install `gqlalchemy`, make sure that you have `cmake` installed by running: -``` -cmake --version -``` -You can install `cmake` by following the [official instructions](https://cgold.readthedocs.io/en/latest/first-step/installation.html#). +After you have installed the prerequisites, run the following command: -To install `gqlalchemy`, simply run the following command: -``` -pip install gqlalchemy +`pip install gqlalchemy` + +With the above command, you get the basic GQLAlchemy capabilities. To add additional import/export capabilities, install GQLAlchemy with one of the following commands: + +- `pip install gqlalchemy[arrow]` # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats +- `pip install gqlalchemy[dgl]` # DGL support (includes PyTorch) + +- `pip install gqlalchemy[all]` # All of the above + +If you intend to use GQLAlchemy with PyTorch Geometric support, that library must be installed manually: + +```bash +pip install gqlalchemy[torch_pyg] # prerequisite +pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.13.0+cpu.html" ``` If you are using [Conda](https://docs.conda.io/en/latest/) for Python environment management, you can install GQLAlchemy through pip. ## Build & Test -The project uses [Poetry](https://python-poetry.org/) to build the GQLAlchemy Python library. To build and run tests, execute the following command: -`poetry install` +The project uses [Poetry](https://python-poetry.org/) to build the library. Clone or download the [GQLAlchemy source code](https://github.com/memgraph/gqlalchemy) locally and run the following command to build it from source with Poetry: + +```bash +poetry install --all-extras +``` -Before starting the tests, make sure you have an active Memgraph instance running. Execute the following command: -`poetry run pytest .` +The ``poetry install --all-extras`` command installs GQLAlchemy with all extras +(optional dependencies). Alternatively, you can use the ``-E`` option to define +what extras to install: + +```bash +poetry install # No extras + +poetry install -E arrow # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats +poetry install -E dgl # DGL support (also includes torch) +``` + +To run the tests, make sure you have an [active Memgraph instance](/memgraph), and execute one of the following commands: + +```bash +poetry run pytest . -k "not slow" # If all extras installed + +poetry run pytest . -k "not slow and not extras" # Otherwise +``` + +If you’ve installed only certain extras, it’s also possible to run their associated tests: + +```bash +poetry run pytest . -k "arrow" +poetry run pytest . -k "dgl" +``` ## GQLAlchemy capabilities @@ -235,10 +270,11 @@ Since Memgraph is an in-memory graph database, the GQLAlchemy library provides a If you want to learn more about OGM, query builder, managing streams, importing data from different source, managing Memgraph instances, managing database triggers and using on-disk storage, check out the GQLAlchemy [how-to guides](https://memgraph.com/docs/gqlalchemy/how-to-guides). ## Development (how to build) -``` + +```bash poetry run flake8 . poetry run black . -poetry run pytest . -k "not slow" +poetry run pytest . -k "not slow and not extras" ``` ## Documentation @@ -247,8 +283,8 @@ The GQLAlchemy documentation is available on [memgraph.com/docs/gqlalchemy](http The documentation can be generated by executing: ``` -pip3 install python-markdown -python-markdown +pip3 install pydoc-markdown +pydoc-markdown ``` ## License