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
Start a Jupyter Notebook instance, open a new notebook and check out the memory usage in the top right!
74
+
75
+
```bash
76
+
jupyter notebook
77
+
```
78
+
79
+
If you want to test the memory limit display functionality, you can do so by setting the `MEM_LIMIT` environment variable (in bytes) when starting `jupyter notebook`.
The JupyterLab extension for `nbresuse` was bootstrapped from the [extension cookiecutter](https://github.com/jupyterlab/extension-cookiecutter-ts), and follows the common patterns and tooling for developing extensions.
88
+
89
+
```bash
90
+
# activate the environment (conda, pipenv)
91
+
92
+
# install the package in development mode
93
+
python -m pip install -e ".[dev]"
94
+
95
+
# link your development version of the extension with JupyterLab
96
+
jupyter labextension develop . --overwrite
97
+
98
+
# go to the labextension directory
99
+
cd labextension/
100
+
101
+
# Rebuild extension Typescript source after making changes
102
+
jlpm run build
103
+
```
104
+
105
+
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
106
+
107
+
```bash
108
+
# Watch the source directory in one terminal, automatically rebuilding when needed
109
+
jlpm run watch
110
+
# Run JupyterLab in another terminal
111
+
jupyter lab
112
+
```
113
+
114
+
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
115
+
116
+
To check the extension is correctly installed, run:
117
+
118
+
```bash
119
+
jupyter labextension list
120
+
```
121
+
122
+
It should show something like the following:
123
+
124
+
```bash
125
+
JupyterLab v3.0.0
126
+
/path/to/env/share/jupyter/labextensions
127
+
nbresuse v0.1.0 enabled OK
128
+
```
129
+
130
+
## pre-commit
131
+
132
+
`nbresuse` has adopted automatic code formatting so you shouldn't need to worry too much about your code style.
62
133
As long as your code is valid,
63
134
the pre-commit hook should take care of how it should look. Here is how to set up pre-commit hooks for automatic code formatting, etc.
64
135
65
-
```bash
66
-
pre-commit install
67
-
```
136
+
```bash
137
+
pre-commit install
138
+
```
68
139
69
-
You can also invoke the pre-commit hook manually at any time with
140
+
You can also invoke the pre-commit hook manually at any time with
70
141
71
-
```bash
72
-
pre-commit run
73
-
```
142
+
```bash
143
+
pre-commit run
144
+
```
74
145
75
146
which should run any autoformatting on your code
76
147
and tell you about any errors it couldn't fix automatically.
@@ -82,11 +153,11 @@ hook with `pre-commit install`, you can fix everything up using
82
153
`pre-commit run --all-files`. You need to make the fixing commit
83
154
yourself after that.
84
155
85
-
9. It's a good idea to write tests to exercise any new features,
86
-
or that trigger any bugs that you have fixed to catch regressions. `pytest` is used to run the test suite. You can run the tests with:
156
+
## Tests
157
+
158
+
It's a good idea to write tests to exercise any new features,
159
+
or that trigger any bugs that you have fixed to catch regressions. `pytest` is used to run the test suite. You can run the tests with in the repo directory:
0 commit comments