From 22bba6a51c656a4ec347bf009a64cb4967cc2f63 Mon Sep 17 00:00:00 2001 From: Alyssa Dai Date: Fri, 8 Dec 2023 14:57:36 -0500 Subject: [PATCH 1/4] update instructions for dev environment setup --- docs/cli.md | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 9bc9060a..f39fc672 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -152,11 +152,34 @@ Neurobagel is under active, early development and future releases of the CLI may _If you have already created `.jsonld` files for your Neurobagel graph database using the CLI_, they can be quickly re-generated under the new data model by following the instructions [here](updating_dataset.md#following-a-change-in-the-neurobagel-data-model) so that they will not conflict with dataset `.jsonld` files generated using the latest CLI version. + ## Development environment -To set up a development environment, please run +To ensure that our Docker images are built in a predictable way, +we use `requirements.txt` as a lock-file. +That is, `requirements.txt` includes the entire dependency tree of our tool, +with pinned versions for every dependency (see [also](https://pip.pypa.io/en/latest/topics/repeatable-installs/#repeatability)) + +### Setting up a local development environment +We suggest that you create a development environment +that is as close as possible to the environment we run in production. + +To do so, we first need to install the dependencies from our lockfile (`dev_requirements.txt`): + ```bash -git clone https://github.com/neurobagel/bagel-cli.git -cd bagel-cli -pip install -e '.[all]' -``` \ No newline at end of file +pip install -r dev_requirements.txt +``` + +And then we install the CLI without touching the dependencies + +```bash +pip install --no-deps -e . +``` + +Finally, to run the test suite we need to install the `bids-examples` and `neurobagel_examples` submodules: +```bash +git submodule init +git submodule update +``` +Confirm that everything works well by running a test +`pytest .` From d33908bd569fdca0d63541d4f12cb07edcb00060 Mon Sep 17 00:00:00 2001 From: Alyssa Dai Date: Wed, 13 Dec 2023 21:08:37 -0500 Subject: [PATCH 2/4] recommend installing pre-commit hooks --- docs/cli.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/cli.md b/docs/cli.md index f39fc672..ca0411cc 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -183,3 +183,13 @@ git submodule update ``` Confirm that everything works well by running a test `pytest .` + + +#### Setting up code formatting and linting (recommended) + +[pre-commit](https://pre-commit.com/) is configured in the development environment for this repository, and can be set up to automatically run a number of code linters and formatters on any commit you make according to the consistent code style set for this project. + +Run the following from the repository root to install the configured pre-commit "hooks" for your local clone of the repo: +```bash +pre-commit install +``` From 58827d751d4cd0eb58f0c197229fb5984341e57c Mon Sep 17 00:00:00 2001 From: Alyssa Dai Date: Wed, 13 Dec 2023 21:15:56 -0500 Subject: [PATCH 3/4] clarify dev env setup --- docs/cli.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index ca0411cc..67c85a74 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -158,7 +158,7 @@ they can be quickly re-generated under the new data model by following the instr To ensure that our Docker images are built in a predictable way, we use `requirements.txt` as a lock-file. That is, `requirements.txt` includes the entire dependency tree of our tool, -with pinned versions for every dependency (see [also](https://pip.pypa.io/en/latest/topics/repeatable-installs/#repeatability)) +with pinned versions for every dependency (for more information, see [https://pip.pypa.io/en/latest/topics/repeatable-installs/#repeatability](https://pip.pypa.io/en/latest/topics/repeatable-installs/#repeatability)). ### Setting up a local development environment We suggest that you create a development environment @@ -182,7 +182,8 @@ git submodule init git submodule update ``` Confirm that everything works well by running a test -`pytest .` +`pytest .` +(no tests should fail). #### Setting up code formatting and linting (recommended) From d51950b795655f45b0fff14d415234cb12591cb7 Mon Sep 17 00:00:00 2001 From: Alyssa Dai Date: Wed, 13 Dec 2023 21:19:12 -0500 Subject: [PATCH 4/4] grammar fix --- docs/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cli.md b/docs/cli.md index 67c85a74..f83f4562 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -181,7 +181,7 @@ Finally, to run the test suite we need to install the `bids-examples` and `neuro git submodule init git submodule update ``` -Confirm that everything works well by running a test +Confirm that everything works well by running a test: `pytest .` (no tests should fail).