Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit ea8b31f

Browse files
authored
Merge pull request #39 from microsoft/support-newer-jupyterlab
Support newer jupyterlab and python-program-analysis
2 parents 0d63bba + ce1479c commit ea8b31f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+8715
-10280
lines changed

README.md

+10-34
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ To run the development version of nbgather, run:
5454

5555
```bash
5656
git clone <this-repository-url> # clone the repository
57-
jlpm install # download dependencies
57+
npm install # download dependencies
5858
jupyter labextension link . # install this package in Jupyter Lab
59-
jlpm run watch # automatically recompile source code
59+
npm run watch # automatically recompile source code
6060
jupyter lab --watch # launch Jupyter Lab, automatically re-load extension
6161
```
6262

@@ -74,46 +74,22 @@ a pull request, as described below:
7474
### Formatting the code
7575

7676
Before submitting a pull request with changed code, format the code
77-
files by running `jlpm run format:all`.
77+
files by running `npm run format:all`.
7878

7979
### Testing the code
8080

81-
The tests assume you have Google Chrome installed on your
82-
computer. Because this plugin depends on Jupyter Lab and in
83-
turn on browser functionality, some of these tests need a
84-
browser to run in.
85-
8681
To run the tests from the command line, call:
8782

8883
```bash
89-
jlpm run test
90-
```
91-
92-
Wait a few seconds while the code compiles, and then you
93-
should see the results of running the tests. The process
94-
will continue to live after the tests finish running---it
95-
will recompile and re-run the tests whenever the test code
96-
changes. Type Ctrl+C to abort the command at any time.
97-
98-
Note that running tests with this command may interfere with
99-
you opening Chrome browsers. If that happens, cancel the
100-
command, open Chrome, and then restart the command.
101-
102-
To debug the tests, call:
103-
104-
```bash
105-
jlpm run test:debug
84+
npm run test
10685
```
10786

108-
This will launch a Chrome window. Click the **DEBUG**
109-
button in the page that opens. Launch the Chrome developer
110-
tools (View -> Developer -> Developer Tools). The "Console"
111-
will show the test results, with one line for each test. In
112-
the "Sources" tab, you can open scripts using the file prompt
113-
(Cmd + P on Mac, Ctrl + P on Windows) and set breakpoints in
114-
the code. When you refresh the page, the tests will be run
115-
again, and the debugger will trigger when the first
116-
breakpoint is reached.
87+
The first time you run tests, they will take about a minute
88+
to finish. The second time, and all subsequent times, the
89+
tests will take only a few seconds. The first test run takes
90+
longer because the Jest test runner transpiles dependencies
91+
like the '@jupyterlab' libraries into a dialect of
92+
JavaScript it expects before running the tests.
11793

11894
### Troubleshooting
11995

babel.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// babel.config.js
2+
// All presets and plugins in this file, except for preset-typescript, are for transpiling
3+
// @jupyterlab source code during tests. preset-typescript is for transpiling the source code
4+
// from this project while running tests.
5+
module.exports = {
6+
plugins: ["@babel/plugin-proposal-class-properties", "inline-react-svg"],
7+
presets: [
8+
"@babel/preset-typescript",
9+
["@babel/preset-env", { targets: { node: "current" } }],
10+
"@babel/preset-react"
11+
]
12+
};

binder/Try out nbgather.ipynb

+110-100
Large diffs are not rendered by default.

binder/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
jupyterlab==0.35.4
1+
jupyterlab==1.2.1
22
numpy
33
scikit-learn
44
matplotlib

jest.config.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// For a detailed explanation regarding each configuration property, visit:
2+
// https://jestjs.io/docs/en/configuration.html
3+
4+
module.exports = {
5+
// Loads mocks necessary for tests.
6+
setupFiles: ["./src/test/setup.js"],
7+
8+
// Execute scripts within a DOM to allow JupyterLab code to run.
9+
testEnvironment: "jsdom",
10+
11+
testMatch: ["<rootDir>/src/test/**/*.test.ts"],
12+
13+
// Transpile all Typescript and Javascript files.
14+
transform: {
15+
"^.+\\.[tj]sx?$": require.resolve("babel-jest")
16+
},
17+
18+
// Transpile all @jupyterlab JavaScript files.
19+
transformIgnorePatterns: [".*/node_modules/(?!@jupyterlab/).*.js"]
20+
};

0 commit comments

Comments
 (0)