Skip to main content

Initial Setup

Init a new instance

Clone the data modelling docs repository.

git clone git@github.com:equinor/dm-docs.git

Install pre-commit

When contributing to this project, pre-commit is necessary, as it runs certain tests, sanitisers, and formatters.

The project provides a .pre-commit-config.yaml file that is used to setup git pre-commit hooks.

On commit locally, code is automatically formatted, checked for security vulnerabilities using pre-commit git hooks.

pre-commit install

This tell pre-commit to always run for this repository on every commit.

tip

Pre-commit will run on every commit, but can also be run manually on all files:

pre-commit run --all-files

Or be skipped:

git commit --no-verify 

Setup API

From inside the /api folder.

Create virtualenv

python3 -m venv .venv

Virtual environment is used for running unit tests with pre-commit and upgrade packages.

It also can be used to run the application if you not are using Docker.

Activate virtualenv

Linux
$ source .venv/bin/activate
Windows
$ .\venv\Scripts\Activate.ps1
$ pip install --upgrade pip

Install Poetry

Poetry is used to manage Python package dependencies.

$ pip install poetry
# Do not create virtual environments
$ poetry config virtualenvs.create false

The installation instructions for Poetry can be found here.

Install packages

$ poetry install

Setup Web

From inside the /web folder.

Install Yarn

This project uses yarn to manage web package dependencies.

npm install -g yarn

The installation instructions can be found here.

Install packages

yarn install