You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
├── requirements.txt <- The requirements file for reproducing the analysis environment, e.g.
103
103
│ generated with `pip freeze > requirements.txt`
104
104
│
105
+
├── setup.py <- Make this project pip installable with `pip install -e`
105
106
├── src <- Source code for use in this project.
106
107
│ ├── __init__.py <- Makes src a Python module
107
108
│ │
@@ -140,25 +141,18 @@ Since notebooks are challenging objects for source control (e.g., diffs of the `
140
141
141
142
1. Follow a naming convention that shows the owner and the order the analysis was done in. We use the format `<step>-<ghuser>-<description>.ipynb` (e.g., `0.3-bull-visualize-distributions.ipynb`).
142
143
143
-
2. Refactor the good parts. Don't write code to do the same task in multiple notebooks. If it's a data preprocessing task, put it in the pipeline at `src/data/make_dataset.py` and load data from `data/interim`. If it's useful utility code, refactor it to `src` and import it into notebooks with a cell like the following. If updating the system path is icky to you, we'd recommend making a Python package (there is a [cookiecutter for that](https://github.com/audreyr/cookiecutter-pypackage) as well) and installing that as an editable package with `pip install -e`.
144
+
2. Refactor the good parts. Don't write code to do the same task in multiple notebooks. If it's a data preprocessing task, put it in the pipeline at `src/data/make_dataset.py` and load data from `data/interim`. If it's useful utility code, refactor it to `src`.
145
+
146
+
Now by default we turn the project into a Python package (see the `setup.py` file). You can import your code and use it in notebooks with a cell like the following:
144
147
145
148
```
146
-
# Load the "autoreload" extension
149
+
# OPTIONAL: Load the "autoreload" extension so that code can change
147
150
%load_ext autoreload
148
151
149
-
# always reload modules marked with "%aimport"
150
-
%autoreload 1
151
-
152
-
import os
153
-
import sys
154
-
155
-
# add the 'src' directory as one where we can import modules
0 commit comments