There are two ways of going about setting up a virtual environment, installing dependencies, and building the artifacts from schema/nmdc.yaml.
- Python venv
- Pipenv
The exact steps for each approach are listed below.
Python venv
is a lightweight module for setting up virtual environments. You can create a virtual environment like so,
python -m venv my-env
Then to activate your virtual environment,
source my-env/bin/activate
To install all the core packages,
pip install -r requirements.txt
To install all the core and dev packages (required for running notebooks that are bundled as part of this repository),
pip install -r requirements.txt
pip install -r requirements-dev.txt
You can individually generate each artifact or let the Makefile do it for you.
If you haven't already, make sure you install all the dev packages from the requirements-dev.txt,
pip install -r requirements-dev.txt
Then start Jupyter,
jupyter notebook
and navigate to your desired notebook for running the analyses.
Pipenv is an alternative to Python's venv
module and is the library we use in our build process and in our Makefile.
Using Pipenv is slightly nuanced and can be different from Python's venv
module.
pip install pipenv
pipenv install
This tells pipenv to install all core packages listed in Pipfile, via the [packages]
directive.
If you would like to install both the core packages and dev packages (required for running notebooks that are bundled as part of this repository) then,
pipenv install --dev
You can individually generate each artifact or let the Makefile do it for you.
Note: The Makefile takes care of installing pipenv
and all the required core packages necessary for building the artifacts.
If you haven't already, make sure you install all the dev packages from the Pipfile,
pip install --dev
Start Jupyter via pipenv,
pipenv run jupyter notebook
and navigate to your desired notebook for running the analyses.
The main source of truth for dependencies in this repository is the Pipfile. Each time you change the Pipfile, be sure to update the requirements.txt and requirements-dev.txt to ensure that they are in sync.
This can be done by running the following command,
pipenv_to_requirements
The above command will parse the Pipfile and autogenerate requirements.txt and requirements-dev.txt