Skip to content

Commit

Permalink
Merge pull request #66 from yt-project/jlab3
Browse files Browse the repository at this point in the history
Update to user JupyterLab 3.0 and bundled javascript
  • Loading branch information
munkm authored Feb 25, 2021
2 parents 3b53f1c + 8c782c4 commit 6aa376c
Show file tree
Hide file tree
Showing 25 changed files with 508 additions and 275 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
coverage
**/*.d.ts
tests
39 changes: 39 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
'selector': 'interface',
'format': ['PascalCase'],
'custom': {
'regex': '^I[A-Z]',
'match': true
}
}
],
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false }
],
curly: ['error', 'all'],
eqeqeq: 'error',
'prefer-arrow-callback': 'error'
}
};
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build

on:
push:
branches: main
pull_request:
branches: '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install Python
uses: actions/setup-python@v2
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
run: |
jlpm
jlpm run eslint:check
python -m pip install git+https://github.com/yt-project/yt.git
python -m pip install .
jupyter server extension list 2>&1 | grep -ie "widgyts.*OK"
jupyter labextension list 2>&1 | grep -ie "@yt-project/yt-widgets.*OK"
python -m jupyterlab.browser_check
43 changes: 18 additions & 25 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
widgyts/labextension

*/labextension/*.tgz
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python

Expand Down Expand Up @@ -36,10 +36,7 @@ pip-wheel-metadata/
share/python-wheels/
.installed.cfg
*.egg
node_modules/
widgyts/static/
js/package-lock.json
js/yarn.lock
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -54,6 +51,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
Expand All @@ -67,14 +65,6 @@ coverage.xml
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

Expand All @@ -84,9 +74,6 @@ docs/_build/
# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

Expand All @@ -96,24 +83,30 @@ celerybeat-schedule
# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.vscode/settings.json
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# End of https://www.gitignore.io/api/python

# OSX files
.DS_Store
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
**/node_modules
**/lib
**/package.json
widgyts
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018, Data Exploration Lab
All rights reserved.
Copyright (c) 2020, Data Exploration Lab All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
6 changes: 4 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
include LICENSE
include README.md
include pyproject.toml

include jupyter-config/widgyts.json

include package.json
include install.json
include ts*.json
include widgyts/labextension/*.tgz
include yarn.lock

graft widgyts/labextension

# Javascript files
graft src
Expand Down
10 changes: 4 additions & 6 deletions examples/galaxy_display.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"ds = yt.load(\"IsolatedGalaxy/galaxy0030/galaxy0030\")\n",
"ds = yt.load_sample(\"IsolatedGalaxy\")\n",
"s = ds.r[:,:,0.5]\n",
"ss = s.display(\"density\")\n",
"ss"
Expand All @@ -61,9 +59,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
"version": "3.9.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
5 changes: 5 additions & 0 deletions install.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"packageManager": "python",
"packageName": "widgyts",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package widgyts"
}
6 changes: 3 additions & 3 deletions jupyter-config/widgyts.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"widgytsts": true
"ServerApp": {
"jpserver_extensions": {
"widgyts": true
}
}
}
Loading

0 comments on commit 6aa376c

Please sign in to comment.