Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct extension build status, with cleanup #78

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ dist
coverage
**/*.d.ts
tests

**/__tests__
ui-tests
49 changes: 14 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '12.x'
node-version: 18
cache: 'yarn'
cache-dependency-path: yarn.lock
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.7'
architecture: 'x64'


- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.7-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.7-
pip-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9
- name: Build the extension
python-version: 3.11
cache: 'pip'
- name: Install the extension
run: python -m pip install .
- name: Update markupsafe
run: python -m pip install markupsafe==2.0.1
- name: Check the extension
run: |
jlpm
jlpm run eslint:check
python -m pip install .
RED=`tput -T xterm setaf 1`
GREEN=`tput -T xterm setaf 2`
SERVER_EXT=`jupyter serverextension list 2>&1`
Expand All @@ -60,5 +40,4 @@ jobs:
echo "$SERVER_EXT"
echo -n "lab extension install "
grep -e "jupyterlab-slurm.*enabled.*OK" <<< $LAB_EXT && echo "${GREEN}PASS" || echo "${RED}FAIL"
echo "$LAB_EXT"
python -m jupyterlab.browser_check
echo "$LAB_EXT"
7 changes: 1 addition & 6 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
'@babel/preset-typescript',
],
};
module.exports = require('@jupyterlab/testutils/lib/babel.config');
44 changes: 36 additions & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,38 @@
const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config');

const jlabConfig = jestJupyterLab(__dirname);

const {
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform
} = jlabConfig;

module.exports = {
preset: 'ts-jest/presets/js-with-babel',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'],
globals: {
'ts-jest': {
tsConfig: 'tsconfig.json'
}
},
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform,
automock: false,
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/.ipynb_checkpoints/*'
],
coverageDirectory: 'coverage',
coverageReporters: ['lcov', 'text'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json'
}
},
testRegex: 'src/.*/.*.spec.ts[x]?$',
transformIgnorePatterns: ['/node_modules/(?!@jupyterlab/.+)']
};
41 changes: 17 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab-slurm",
"version": "3.0.2",
"version": "3.1.0",
"description": "A JupyterLab extension to interface with the Slurm workload manager.",
"keywords": [
"jupyter",
Expand Down Expand Up @@ -56,34 +56,28 @@
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.0.10",
"@jupyterlab/apputils": "^3.0.6",
"@jupyterlab/coreutils": "^5.0.4",
"@jupyterlab/filebrowser": "^3.0.8",
"@jupyterlab/launcher": "^3.0.6",
"@jupyterlab/services": "^6.0.6",
"@jupyterlab/testutils": "^2.1.2",
"@lumino/widgets": "1.19.0",
"@types/bootstrap": "^4.3.0",
"@types/lodash": "^4.14.138",
"@types/node": "^11.13.7",
"@types/react": "^17.0.4",
"@types/styled-components": "^5.1.10",
"bootstrap": "^4.2.1",
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/launcher": "^3.0.0",
"@jupyterlab/filebrowser": "^3.0.0",
"@jupyterlab/ui-components": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/services": "^6.0.0",
"lodash": "^4.17.15",
"popper.js": "^1.15.0",
"react": "^17.0.1",
"react-bootstrap": "^1.0.1",
"react-popper": "^1.3.11",
"react-data-table-component": "^6.11.7",
"react-dom": "^17.0.1",
"react-icons": "^4.2.0",
"react-spinners": "^0.11.0",
"styled-components": "^5.3.0",
"uuid": "^8.1.0"
"uuid": "^8.1.0",
"bootstrap": "^4.6.2",
"react-bootstrap": "^1.0.1"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@jupyterlab/builder": "^3.0.0",
"@types/jest": "^26.0.3",
"@types/lodash": "^4.14.138",
"@types/styled-components": "^5.1.10",
"@types/uuid": "^8.3.0",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
Expand All @@ -94,12 +88,10 @@
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.1.0",
"mkdirp": "^1.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
"ts-jest": "^26.1.1",
"typescript": "~4.1.3",
"yarn-deduplicate": "^1.1.1"
},
Expand All @@ -119,6 +111,7 @@
"outputDir": "jupyterlab_slurm/labextension"
},
"resolutions": {
"@lumino/widgets": "~1.19.0"
"@jupyterlab/rendermime-interfaces": "^3.0.0 <= 3.6.3",
"@types/react": "^17.0.4"
}
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["jupyter_packaging~=0.7.9", "jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"]
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0rc13,==3.*", "jupyterlab_pygments<0.3.0", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,21 @@
cmdclass=cmdclass,
packages=setuptools.find_packages(),
install_requires=[
"jupyterlab~=3.0",
"jupyterlab>=3.0.0rc13,==3.*", "jupyterlab_pygments<0.3.0"
],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
python_requires=">=3.8",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
classifiers=[
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Framework :: Jupyter",
],
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/JobSubmitForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace types {

export type State = {
filebrowser: FileBrowser;
fileitems: JSX.Element[];
fileitems: React.JSX.Element[];
inputType: string;
inputPathSelectType: string;
filepath: string;
Expand Down Expand Up @@ -56,7 +56,7 @@ export default class JobSubmitForm extends React.Component<
* component was clicked on and is now visible). If changed
* to true, it calls the updateFileitems() function
*/
componentDidUpdate(prevProps: types.Props, prevState: types.State): void {
componentDidUpdate(prevProps: types.Props): void {
if (prevProps.active !== this.props.active) {
if (this.props.active) {
this.updateFileitems();
Expand All @@ -69,7 +69,7 @@ export default class JobSubmitForm extends React.Component<
* and creates an array of <option> elements for each file.
* If there are no files in the current directory, an empty entry is created.
*/
private getFileItems(filebrowser: FileBrowser): JSX.Element[] {
private getFileItems(filebrowser: FileBrowser): React.JSX.Element[] {
const fileListing = [];
const iter = filebrowser.model.items();
let i = iter.next();
Expand Down
6 changes: 3 additions & 3 deletions src/components/SqueueDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default class SqueueDataTable extends Component<

return await requestAPI<any>('squeue', squeueParams)
.then(data => {
console.log('SqueueDataTable getData() squeue', squeueParams, data);
console.debug('SqueueDataTable getData() squeue', squeueParams, data);

this.setState(
{
Expand All @@ -178,7 +178,7 @@ export default class SqueueDataTable extends Component<
},
() => {
this.updateDisplayRows();
console.log('loading finished');
console.debug('loading finished');
}
);
})
Expand Down Expand Up @@ -347,7 +347,7 @@ export default class SqueueDataTable extends Component<

render(): ReactNode {
/*
console.log({
console.debug({
rows: this.state.rows,
columns: columns,
data: data,
Expand Down
4 changes: 2 additions & 2 deletions src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function requestAPI<T>(

let response: Response;
try {
//console.log('requestAPI new request', requestUrl, init, settings);
//console.debug('requestAPI new request', requestUrl, init, settings);
response = await ServerConnection.makeRequest(requestUrl, init, settings);
} catch (error) {
console.error(
Expand All @@ -54,7 +54,7 @@ export async function requestAPI<T>(

if (data.length > 0) {
try {
console.log('response data', requestUrl, urlParams, init, data);
console.debug('response data', requestUrl, urlParams, init, data);
data = JSON.parse(data);
} catch (error) {
console.error(
Expand Down
20 changes: 9 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import { requestAPI } from './handler';
import SlurmWidget from './slurmWidget';
import { ISlurmUserSettings } from './types';

import 'bootstrap/dist/css/bootstrap.min.css';

/**
* The class names for the Slurm extension icon, for launcher and
* tab, respectively
Expand Down Expand Up @@ -48,7 +46,7 @@ const extension: JupyterFrontEndPlugin<void> = {
settingRegistry: ISettingRegistry,
launcher: ILauncher | null
) => {
console.log('JupyterFrontEndPlugin.activate()');
console.debug('Slurm Extension is activated.');

// Declare a Slurm widget variable
let widget: SlurmWidget;
Expand All @@ -57,8 +55,8 @@ const extension: JupyterFrontEndPlugin<void> = {
const commandID = 'slurm:open';
const filebrowser = factory.defaultBrowser;

console.log('After restore:');
console.log(widget);
//console.debug('After restore:');
//console.debug(widget);

const parsedSettings: ISlurmUserSettings = {
queueCols: [],
Expand All @@ -82,11 +80,11 @@ const extension: JupyterFrontEndPlugin<void> = {
parsedSettings.autoReloadRate = setting.get('autoReloadRate')
.composite as number;

console.log('Loaded UserSettings: ' + parsedSettings);
//console.debug('Loaded UserSettings: ' + parsedSettings);
}

const settings = await settingRegistry.load(PLUGIN_ID);
console.log(settings);
//console.debug(settings);
loadSetting(settings);

// Track and restore the widget state
Expand All @@ -103,7 +101,7 @@ const extension: JupyterFrontEndPlugin<void> = {
iconClass: SLURM_ICON_CLASS_LAUNCHER,
execute: () => {
if (!widget) {
console.log(settingRegistry);
//console.debug(settingRegistry);
// Instantiate a new widget if one does not exist
widget = new SlurmWidget(filebrowser, parsedSettings);
widget.title.icon = SLURM_ICON_CLASS_TAB;
Expand All @@ -112,7 +110,7 @@ const extension: JupyterFrontEndPlugin<void> = {
if (!tracker.has(widget)) {
// Track the state of the widget for later restoration
tracker.add(widget);
console.log('added widget to tracker');
//console.debug('added widget to tracker');
}

if (!widget.isAttached) {
Expand Down Expand Up @@ -143,7 +141,7 @@ const extension: JupyterFrontEndPlugin<void> = {

requestAPI<any>('get_example')
.then(data => {
console.log('get_example', data);
console.debug('get_example', data);
})
.catch(reason => {
console.error(
Expand All @@ -153,7 +151,7 @@ const extension: JupyterFrontEndPlugin<void> = {

requestAPI<any>('user')
.then(data => {
console.log('user', data['user']);
console.debug('user', data['user']);
})
.catch(reason => {
console.error(
Expand Down
Loading