Skip to content

Commit 67a2df9

Browse files
authored
Merge pull request #74 from jtpio/rename
Rename to jupyter-resource-usage
2 parents ff7531f + f492d09 commit 67a2df9

21 files changed

+99
-91
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
python -m pip install --upgrade pip
2727
python -m pip install -e ".[dev]"
2828
- name: Lint with flake8
29-
run: python -m flake8 nbresuse
29+
run: python -m flake8 jupyter_resource_usage
3030
- name: Test with pytest
3131
run: |
32-
python -m pytest -vvv nbresuse --cov=nbresuse --junitxml=python_junit.xml --cov-report=xml --cov-branch
32+
python -m pytest -vvv jupyter_resource_usage --cov=jupyter_resource_usage --junitxml=python_junit.xml --cov-report=xml --cov-branch

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
- pip install --editable .
1212

1313
script:
14-
- python -m pytest -vvv nbresuse
14+
- python -m pytest -vvv jupyter-resource-usage
1515

1616

1717
jobs:

CHANGELOG.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## 0.4.0
44

5-
- Soft-deprecate `/metrics` endpoint: [#68](https://github.com/yuvipanda/jupyter-resource-usage/pull/68)
6-
- `nbresuse` now exposes a new endpoint: `/api/metrics/v1`: [#68](https://github.com/yuvipanda/jupyter-resource-usage/pull/68)
5+
- Soft-deprecate `/metrics` endpoint: [#68](https://github.com/jupyter-server/jupyter-resource-usage/pull/68)
6+
- `nbresuse` now exposes a new endpoint: `/api/metrics/v1`: [#68](https://github.com/jupyter-server/jupyter-resource-usage/pull/68)
77

88
### Migrating to 0.4.0
99

@@ -30,51 +30,51 @@ jupyter lab --ResourceUseDisplay.disable_legacy_endpoint=False
3030

3131
## 0.3.6
3232

33-
- Fix handling of cpu percent in the API endpoint [#56](https://github.com/yuvipanda/jupyter-resource-usage/pull/56)
34-
- Added Binder [#53](https://github.com/yuvipanda/jupyter-resource-usage/pull/53) & RELEASE.md [#54](https://github.com/yuvipanda/jupyter-resource-usage/pull/54)
33+
- Fix handling of cpu percent in the API endpoint [#56](https://github.com/jupyter-server/jupyter-resource-usage/pull/56)
34+
- Added Binder [#53](https://github.com/jupyter-server/jupyter-resource-usage/pull/53) & RELEASE.md [#54](https://github.com/jupyter-server/jupyter-resource-usage/pull/54)
3535

3636
## 0.3.5
3737

38-
- Adding support for jupyterlab statusbar-extension [#45](https://github.com/yuvipanda/jupyter-resource-usage/pull/45) [#36](https://github.com/yuvipanda/jupyter-resource-usage/issues/36)
38+
- Adding support for jupyterlab statusbar-extension [#45](https://github.com/jupyter-server/jupyter-resource-usage/pull/45) [#36](https://github.com/jupyter-server/jupyter-resource-usage/issues/36)
3939

4040
**Note**: this release restores the `/metrics` endpoint returning a JSON response, that was removed in `0.3.4`.
4141

4242
## 0.3.4
4343

44-
- Autoformatting and documentation [#33](https://github.com/yuvipanda/jupyter-resource-usage/pull/33)
45-
- Add section about CPU usage to the README [#30](https://github.com/yuvipanda/jupyter-resource-usage/pull/30)
46-
- Make psutil optional dependency of NBResuse [#25](https://github.com/yuvipanda/jupyter-resource-usage/pull/25)
47-
- Report the memory usage metrics as prometheus metrics [#22](https://github.com/yuvipanda/jupyter-resource-usage/pull/22)
44+
- Autoformatting and documentation [#33](https://github.com/jupyter-server/jupyter-resource-usage/pull/33)
45+
- Add section about CPU usage to the README [#30](https://github.com/jupyter-server/jupyter-resource-usage/pull/30)
46+
- Make psutil optional dependency of NBResuse [#25](https://github.com/jupyter-server/jupyter-resource-usage/pull/25)
47+
- Report the memory usage metrics as prometheus metrics [#22](https://github.com/jupyter-server/jupyter-resource-usage/pull/22)
4848

4949
**Note**: this release removed the `/metrics` endpoint that was returning a JSON response. As a result, JupyterLab does not display the memory usage indicator in the status bar with `nbresuse==0.3.4`.
5050

5151
## 0.3.3
5252

53-
- Made memory limit possibly dynamic via passing a callable in the config. [#23](https://github.com/yuvipanda/jupyter-resource-usage/pull/23)
54-
- Track CPU usage [#21](https://github.com/yuvipanda/jupyter-resource-usage/pull/21)
53+
- Made memory limit possibly dynamic via passing a callable in the config. [#23](https://github.com/jupyter-server/jupyter-resource-usage/pull/23)
54+
- Track CPU usage [#21](https://github.com/jupyter-server/jupyter-resource-usage/pull/21)
5555

5656
## 0.3.2
5757

58-
- Require authentication for /metrics API Handler [#18](https://github.com/yuvipanda/jupyter-resource-usage/pull/18)
58+
- Require authentication for /metrics API Handler [#18](https://github.com/jupyter-server/jupyter-resource-usage/pull/18)
5959

6060
## 0.3.1
6161

62-
- Don't poll in background, since user does not see it [#15](https://github.com/yuvipanda/jupyter-resource-usage/pull/15)
63-
- Poll instantly once page is foregrounded [#15](https://github.com/yuvipanda/jupyter-resource-usage/pull/15)
62+
- Don't poll in background, since user does not see it [#15](https://github.com/jupyter-server/jupyter-resource-usage/pull/15)
63+
- Poll instantly once page is foregrounded [#15](https://github.com/jupyter-server/jupyter-resource-usage/pull/15)
6464

6565
This should reduce the number of /metrics requests massively, with minimal interruption to user experience.
6666

6767
## 0.3.0
6868

69-
- Automatically install & enable extensions [#9](https://github.com/yuvipanda/jupyter-resource-usage/pull/9)
69+
- Automatically install & enable extensions [#9](https://github.com/jupyter-server/jupyter-resource-usage/pull/9)
7070
- Put nbextension / serverextension enables in different places
7171
- Put nbresuse js files in appropriate path
7272

7373
## 0.2.0
7474

7575
- Change 'Mem' prefix in display to less cryptic 'Memory'
7676
- Fix primary screenshot to show memory limit too
77-
- Distribute static files via package_data [#1](https://github.com/yuvipanda/jupyter-resource-usage/pull/1)
77+
- Distribute static files via package_data [#1](https://github.com/jupyter-server/jupyter-resource-usage/pull/1)
7878
- Add screenshot for memory usage warning
7979
- Configurable memory usage warnings
8080
- More configurability via traitlets

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
22

3-
Contributions to NBResuse are highly welcome! As a [Jupyter](https://jupyter.org) project,
3+
Contributions to jupyter-resource-usage are highly welcome! As a [Jupyter](https://jupyter.org) project,
44
you can follow the [Jupyter contributor guide](https://jupyter.readthedocs.io/en/latest/contributor/content-contributor.html).
55

66
Make sure to also follow [Project Jupyter's Code of Conduct](https://github.com/jupyter/governance/blob/master/conduct/code_of_conduct.md)
@@ -13,13 +13,13 @@ We recommend using [pipenv](https://docs.pipenv.org/) to make development easier
1313
1. Clone the git repository:
1414

1515
```bash
16-
git clone https://github.com/yuvipanda/nbresuse
16+
git clone https://github.com/jupyter-server/jupyter-resource-usage
1717
```
1818

1919
2. Create an environment that will hold our dependencies.
2020

2121
```bash
22-
cd nbresuse
22+
cd jupyter-resource-usage
2323
pipenv --python 3.6
2424
```
2525

@@ -29,7 +29,7 @@ We recommend using [pipenv](https://docs.pipenv.org/) to make development easier
2929
pipenv shell
3030
```
3131

32-
4. Do a dev install of nbresuse and its dependencies
32+
4. Do a dev install of jupyter-resource-usage and its dependencies
3333

3434
```bash
3535
pip install --editable .[dev]
@@ -38,9 +38,9 @@ We recommend using [pipenv](https://docs.pipenv.org/) to make development easier
3838
5. Install and enable the nbextension for use with Jupyter Classic Notebook.
3939

4040
```bash
41-
jupyter nbextension install --py nbresuse --symlink --sys-prefix
42-
jupyter serverextension enable --py nbresuse --sys-prefix
43-
jupyter nbextension enable --py nbresuse --sys-prefix
41+
jupyter nbextension install --py jupyter-resource-usage --symlink --sys-prefix
42+
jupyter serverextension enable --py jupyter-resource-usage --sys-prefix
43+
jupyter nbextension enable --py jupyter-resource-usage --sys-prefix
4444
```
4545

4646
6. Start a Jupyter Notebook instance, open a new notebook and check out the memory usage
@@ -57,7 +57,7 @@ We recommend using [pipenv](https://docs.pipenv.org/) to make development easier
5757
MEM_LIMIT=$(expr 128 \* 1024 \* 1024) jupyter notebook
5858
```
5959

60-
8. NBResuse has adopted automatic code formatting so you shouldn't
60+
8. jupyter-resource-usage has adopted automatic code formatting so you shouldn't
6161
need to worry too much about your code style.
6262
As long as your code is valid,
6363
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.
@@ -86,7 +86,7 @@ yourself after that.
8686
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:
8787

8888
```bash
89-
python -m pytest -vvv nbresuse
89+
python -m pytest -vvv jupyter-resource-usage
9090
```
9191

9292
in the repo directory.

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
**[Resources Displayed](#resources-displayed)** |
44
**[Contributing](#contributing)**
55

6-
# NBResuse
6+
# jupyter-resource-usage
77

8-
![Github Actions Status](https://github.com/yuvipanda/nbresuse/workflows/Tests/badge.svg)
9-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/yuvipanda/nbresuse/stable)
10-
[![PyPI](https://img.shields.io/pypi/v/nbresuse)](https://pypi.python.org/pypi/nbresuse)
11-
[![PyPI](https://img.shields.io/pypi/l/nbresuse)](https://pypi.python.org/pypi/nbresuse)
12-
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/yuvipanda/nbresuse/issues)
8+
![Github Actions Status](https://github.com/jupyter-server/jupyter-resource-usage/workflows/Tests/badge.svg)
9+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jupyter-server/jupyter-resource-usage/stable)
10+
[![PyPI](https://img.shields.io/pypi/v/jupyter-resource-usage)](https://pypi.python.org/pypi/jupyter-resource-usage)
11+
[![PyPI](https://img.shields.io/pypi/l/jupyter-resource-usage)](https://pypi.python.org/pypi/jupyter-resource-usage)
12+
[![GitHub](https://img.shields.io/badge/issue_tracking-github-blue?logo=github)](https://github.com/jupyter-server/jupyter-resource-usage/issues)
1313

1414
![Screenshot with memory limit](screenshot.png)
1515

16-
NB Resource Usage (NBResuse) is a small extension for Jupyter Notebooks that
16+
Jupyter Resource Usage is an extension for Jupyter Notebooks and JupyterLab that
1717
displays an indication of how much resources your current notebook server and
1818
its children (kernels, terminals, etc) are using. This is displayed in the
1919
main toolbar in the notebook itself, refreshing every 5s.
@@ -23,22 +23,22 @@ main toolbar in the notebook itself, refreshing every 5s.
2323
You can currently install this package from PyPI.
2424

2525
```bash
26-
pip install nbresuse
26+
pip install jupyter-resource-usage
2727
```
2828

2929
**If your notebook version is < 5.3**, you need to enable the extension manually.
3030

3131
```
32-
jupyter serverextension enable --py nbresuse --sys-prefix
33-
jupyter nbextension install --py nbresuse --sys-prefix
34-
jupyter nbextension enable --py nbresuse --sys-prefix
32+
jupyter serverextension enable --py jupyter-resource-usage --sys-prefix
33+
jupyter nbextension install --py jupyter-resource-usage --sys-prefix
34+
jupyter nbextension enable --py jupyter-resource-usage --sys-prefix
3535
```
3636

3737
## Configuration
3838

3939
### Memory Limit
4040

41-
`nbresuse` can display a memory limit (but not enforce it). You can set this
41+
`jupyter-resource-usage` can display a memory limit (but not enforce it). You can set this
4242
in several ways:
4343

4444
1. `MEM_LIMIT` environment variable. This is set by [JupyterHub](https://github.com/jupyterhub/jupyterhub/)
@@ -61,7 +61,7 @@ can set the parameter `--ResourceUseDisplay.mem_warning_threshold=0.1`.
6161

6262
### CPU Usage
6363

64-
`nbresuse` can also track CPU usage and report a `cpu_percent` value as part of the `/metrics` response.
64+
`jupyter-resource-usage` can also track CPU usage and report a `cpu_percent` value as part of the `/metrics` response.
6565

6666
You can set the `cpu_limit` in several ways:
6767

RELEASE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Making a new release of nbresuse
1+
# Making a new release of jupyter-resource-usage
22

33
## Getting a clean environment
44

55
Creating a new environment can help avoid pushing local changes and any extra tag.
66

77
```bash
8-
conda create -n nbresuse-release -c conda-forge twine keyring
9-
conda activate nbresuse-release
8+
conda create -n jupyter-resource-usage-release -c conda-forge twine keyring
9+
conda activate jupyter-resource-usage-release
1010
```
1111

1212
Alternatively, the local repository can be cleaned with:
@@ -23,7 +23,7 @@ Make sure the `dist/` folder is empty.
2323
2. `python setup.py sdist bdist_wheel`
2424
3. Double check the size of the bundles in the `dist/` folder
2525
4. Run the tests
26-
- `pip install "dist/nbresuse-X.Y.Z-py3-none-any.whl[dev]"`
26+
- `pip install "dist/jupyter-resource-usage-X.Y.Z-py3-none-any.whl[dev]"`
2727
- `python -m pytest`
2828
5. `export TWINE_USERNAME=mypypi_username`
2929
6. `twine upload dist/*`
@@ -34,7 +34,7 @@ The easiest is to wait for the bot to open the PR automatically.
3434

3535
To do the release manually:
3636

37-
1. Open a new PR on https://github.com/conda-forge/nbresuse-feedstock to update the `version` and the `sha256` hash
37+
1. Open a new PR on https://github.com/conda-forge/jupyter-resource-usage-feedstock to update the `version` and the `sha256` hash
3838
2. Wait for the tests
3939
3. Merge the PR
4040

binder/environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: nbresuse
1+
name: jupyter-resource-usage
22
channels:
33
- conda-forge
44
dependencies:
55
- python=3
66
- jupyterlab=2
7-
- nbresuse=0.3.6
7+
- jupyter_resource_usage=0.3.6
88
- nodejs

nbresuse/__init__.py renamed to jupyter_resource_usage/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1+
from jupyter_resource_usage.api import ApiHandler
2+
from jupyter_resource_usage.config import ResourceUseDisplay
3+
from jupyter_resource_usage.metrics import PSUtilMetricsLoader
4+
from jupyter_resource_usage.prometheus import PrometheusHandler
15
from notebook.utils import url_path_join
26
from tornado import ioloop
37

4-
from nbresuse.api import ApiHandler
5-
from nbresuse.config import ResourceUseDisplay
6-
from nbresuse.metrics import PSUtilMetricsLoader
7-
from nbresuse.prometheus import PrometheusHandler
8-
98

109
def _jupyter_server_extension_paths():
1110
"""
1211
Set up the server extension for collecting metrics
1312
"""
14-
return [{"module": "nbresuse"}]
13+
return [{"module": "jupyter_resource_usage"}]
1514

1615

1716
def _jupyter_nbextension_paths():
@@ -21,9 +20,9 @@ def _jupyter_nbextension_paths():
2120
return [
2221
{
2322
"section": "notebook",
24-
"dest": "nbresuse",
23+
"dest": "jupyter_resource_usage",
2524
"src": "static",
26-
"require": "nbresuse/main",
25+
"require": "jupyter_resource_usage/main",
2726
}
2827
]
2928

@@ -33,7 +32,7 @@ def load_jupyter_server_extension(nbapp):
3332
Called during notebook start
3433
"""
3534
resuseconfig = ResourceUseDisplay(parent=nbapp)
36-
nbapp.web_app.settings["nbresuse_display_config"] = resuseconfig
35+
nbapp.web_app.settings["jupyter_resource_usage_display_config"] = resuseconfig
3736
base_url = nbapp.web_app.settings["base_url"]
3837

3938
if not resuseconfig.disable_legacy_endpoint:

nbresuse/api.py renamed to jupyter_resource_usage/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async def get(self):
2222
"""
2323
Calculate and return current resource usage metrics
2424
"""
25-
config = self.settings["nbresuse_display_config"]
25+
config = self.settings["jupyter_resource_usage_display_config"]
2626

2727
cur_process = psutil.Process()
2828
all_processes = [cur_process] + cur_process.children(recursive=True)

nbresuse/config.py renamed to jupyter_resource_usage/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ def validate(self, obj, value):
3434

3535
class ResourceUseDisplay(Configurable):
3636
"""
37-
Holds server-side configuration for nbresuse
37+
Holds server-side configuration for jupyter-resource-usage
3838
"""
3939

4040
disable_legacy_endpoint = Bool(
4141
True,
4242
help="""
4343
Disable legacy /metrics endpoint
4444
45-
This prevents nbresuse from shadowing the prometheus /metrics endpoint.
45+
This prevents jupyter-resource-usage from shadowing the prometheus /metrics endpoint.
4646
""",
4747
config=True,
4848
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"load_extensions": {
3+
"jupyter_resource_usage/main": true
4+
}
5+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"NotebookApp": {
33
"nbserver_extensions": {
4-
"nbresuse": true
4+
"jupyter_resource_usage": true
55
}
66
}
77
}

nbresuse/metrics.py renamed to jupyter_resource_usage/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
class PSUtilMetricsLoader:
1010
def __init__(self, nbapp: NotebookApp):
11-
self.config = nbapp.web_app.settings["nbresuse_display_config"]
11+
self.config = nbapp.web_app.settings["jupyter_resource_usage_display_config"]
1212
self.nbapp = nbapp
1313

1414
def get_process_metric_value(self, process, name, kwargs, attribute=None):

nbresuse/prometheus.py renamed to jupyter_resource_usage/prometheus.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from typing import Optional
22

3+
from jupyter_resource_usage.metrics import PSUtilMetricsLoader
34
from notebook.notebookapp import NotebookApp
45
from prometheus_client import Gauge
56

6-
from nbresuse.metrics import PSUtilMetricsLoader
7-
87
try:
98
# Traitlets >= 4.3.3
109
from traitlets import Callable

0 commit comments

Comments
 (0)