Skip to content

Latest commit

 

History

History
127 lines (85 loc) · 3.15 KB

install.md

File metadata and controls

127 lines (85 loc) · 3.15 KB

project e-commerce guide installation

Prerequisites

Create environment

conda env create -f environment.yml
activate c17-97-t-data-bi

or

mamba env create -f environment.yml
activate c17-97-t-data-bi

finally execute

pip install -r requirements.txt

The packages necessary to run the project are now installed inside the conda environment.

Note: The following sections assume you are located in your conda environment.

Set up project's module

To move beyond notebook prototyping, all reusable code should go into the c17-97-t-data-bi/ folder package. To use that package inside your project, install the project's module in editable mode, so you can edit files in the c17-97-t-data-bi folder and use the modules inside your notebooks :

pip install --editable .

To use the module inside your notebooks, add %autoreload at the top of your notebook :

%load_ext autoreload
%autoreload 2

Example of module usage :

from c17-97-t-data-bi.utils.paths import data_dir
data_dir()

Set up Git diff for notebooks and lab

We use nbdime for diffing and merging Jupyter notebooks.

To configure it to this git project :

nbdime config-git --enable

To enable notebook extension :

nbdime extensions --enable --sys-prefix

Or, if you prefer full control, you can run the individual steps:

jupyter serverextension enable --py nbdime --sys-prefix

jupyter nbextension install --py nbdime --sys-prefix
jupyter nbextension enable --py nbdime --sys-prefix

jupyter labextension install nbdime-jupyterlab

You may need to rebuild the extension : jupyter lab build

Set up Plotly for Jupyterlab

Plotly works in notebook but further steps are needed for it to work in Jupyterlab :

  • @jupyter-widgets/jupyterlab-manager # Jupyter widgets support
  • plotlywidget # FigureWidget support
  • @jupyterlab/plotly-extension # offline iplot support

There are conflict versions between those extensions so check the latest Plotly README to ensure you fetch the correct ones.

jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.36 --no-build
jupyter labextension install plotlywidget@0.2.1  --no-build
jupyter labextension install @jupyterlab/plotly-extension@0.16  --no-build
jupyter lab build

Invoke command

We use Invoke to manage an unique entry point into all of the project tasks.

List of all tasks for project :

$ invoke -l

Available tasks:

  lab     Launch Jupyter lab

Help on a particular task :

$ invoke --help lab
Usage: inv[oke] [--core-opts] notebook [--options] [other tasks here ...]

Docstring:
  Launch Jupyter lab

Options:
  -i STRING, --ip=STRING   IP to listen on, defaults to *
  -p, --port               Port to listen on, defaults to 8888

You will find the definition of each task inside the tasks.py file, so you can add your own.