Style Guide

Prerequisite Reading & Misc. Background Information

Familiarity with the concepts covered in the following sections are highly recommended:

We highly recommend becoming an expert Metagraph user before contributing to Metagraph itself.

Additionally, we highly recommend reading our GitHub repository’s README.

Code Formatting

We use Black to format our code.

We use pre-commit to have a pre-commit Git hook that runs Black to format our code prior to committing. You can do the same by running pre-commit install at the top-level of your Metagraph checkout.

Environment Setup

We maintain our dependencies via conda.

If your proposed changes require any new dependencies, it’s necessary to update the environment.yml accordingly to avoid dependency issues for users and fellow developers.

String Formatting

We conventionally use f-string formatting rather than string formatting via ‘%’ or ‘.format()’.

Core Plugin Style

These are style guidelines for how to contribute to the core plugins.

Each core plugin is stored under its own plugin directory under metagraph/plugins/.

3-Part Modules

The Plugin Author Guide describes 3 main plugin parts, i.e. algorithms, translators, and types.

We conventionally compartmentalize these into their own modules under the plugin directory as algorithms.py, translators.py, and types.py.

We conventionally make them available by importing them in the __init__.py of the plugin directory.