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

[wip] add lab 3 #1

Open
wants to merge 17 commits into
base: master
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
26 changes: 26 additions & 0 deletions .binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: jupyterlab-pull-requests

channels:
- conda-forge
- nodefaults

dependencies:
# runtimes
- python >=3.6,<3.10
- nodejs >=12,!=13.*,<15
- git
# client
- jupyterlab >=3,<4
# packaging
- pip
- wheel
- twine
# test
- asynctest
- pytest
- pytest-cov
# TODO: use the real stuff
- pip:
- jupyterlab-git >=0.30.0b2
# doesn't actually start in lab
- nbdime >=3.0.0b1
21 changes: 21 additions & 0 deletions .binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -eux

# preflight node stuff
jlpm --ignore-optional --prefer-offline
jlpm lint
jlpm build

# install labextension in editable mode
jupyter labextension develop --overwrite .

# install python package
python -m pip install -e . --no-deps --ignore-installed -v

# manually enable extension
jupyter serverextension enable --py jupyterlab_pullrequests
jupyter server extension enable --py jupyterlab_pullrequests

# verify install
jupyter labextension list
jupyter server extension list
39 changes: 39 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
node_modules
**/build
**/lib
**/node_modules
**/mock_packages
**/static
**/typings
**/schemas
**/themes
coverage
*.map.js
*.bundle.js

dev_mode/index.js
!dev_mode/static/index.out.js
dev_mode/workspaces
docs/_build
docs/api
docs/build
examples/chrome-example-test.js
examples/federated/core_package/index.template.js
jupyterlab/chrome-test.js
jupyterlab/geckodriver
packages/extensionmanager-extension/examples/listings
packages/nbconvert-css/raw.js
packages/ui-components/src/icon/iconimports.ts
packages/ui-components/storybook-static
jupyterlab/staging/yarn.js
jupyterlab/staging/index.js
tsconfigdoc.json
examples/federated/core_package/index.js
examples/federated/labextensions

# jetbrains IDE stuff
.idea/

# ms IDE stuff
.history/
.vscode/
70 changes: 70 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
module.exports = {
env: {
browser: true,
es6: true,
commonjs: true,
node: true,
'jest/globals': true
},
globals: {
JSX: 'readonly'
},
root: true,
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:react/recommended',
'plugin:jest/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.eslint.json'
},
plugins: ['@typescript-eslint', 'jest'],
rules: {
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'@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-use-before-define': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
'@typescript-eslint/ban-types': 'warn',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'warn',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/triple-slash-reference': 'warn',
'@typescript-eslint/no-inferrable-types': 'off',
'jest/no-conditional-expect': 'warn',
'jest/valid-title': 'warn',
'no-inner-declarations': 'off',
'no-prototype-builtins': 'off',
'no-control-regex': 'warn',
'no-undef': 'warn',
'no-case-declarations': 'warn',
'no-useless-escape': 'off',
'prefer-const': 'off',
'react/prop-types': 'warn'
},
settings: {
react: {
version: 'detect'
}
}
};
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ node_modules/

package-lock.json

yarn.lock

.pytest_cache/
.pyc

.DS_Store
.DS_Store

# built files
jupyterlab_pullrequests/labextension
.yarn-packages
18 changes: 18 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
**/build
**/node_modules
**/lib
**/package.json
**/static
**/.ipynb_checkpoints
**/labextension
**/.pytest_cache
tests/**/coverage

.eggs

# jetbrains IDE stuff
.idea/

# ms IDE stuff
.history/
.vscode/
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"
}
2 changes: 2 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn-offline-mirror "./.yarn-packages"
yarn-offline-mirror-pruning true
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ If you have suggestions on how these processes can be improved, please suggest t
If you are using this software and encounter some behavior that is unexpected, then you may have come accross a bug!
To get this fixed, first creation an issue that should have, ideally:

* The behavior you expected
* The actual behavior (screenshots can be helpful here)
* How someone else could reproduce it (version of the software, as well as your browser and OS can help)
- The behavior you expected
- The actual behavior (screenshots can be helpful here)
- How someone else could reproduce it (version of the software, as well as your browser and OS can help)

Once you create this issue, someone with commit rights should come by and try to reproduce the issue locally and comment if they are able to. If they are able to, then they will add the `type:Bug` label. If they are not able to, then they will add the `status: Needs info` label and wait for information from you.

Hopefully, then some nice person will come by to fix your bug! This will likely be someone who already works on the project,
but it could be anyone.

They will fix the bug locally, then push those changes to their fork. Then they will make a pull request, and in the description
say "This fixes bug #xxx".
say "This fixes bug #xxx".

Someone who maintains the repo will review this change, and this can lead to some more back and forth about the implementation.

Expand All @@ -38,7 +38,7 @@ Maybe the current behavior isn't wrong, but you still have an idea on how it cou

The flow will be similar to opening a bug, but the process could be longer, as we all work together to agree on what
behavior should be added. So when you open an issue, it's helpful to give some context around what you are trying to achieve,
why that is important, where the current functionality falls short, and any ideas you have on how it could be improved.
why that is important, where the current functionality falls short, and any ideas you have on how it could be improved.

These issues should get a `type:Enhancement` label. If the solution seems obvious enough and you think others will agree,
then anyone is welcome to implement the solution and propose it in a pull request.
Expand All @@ -47,4 +47,4 @@ However, if the issue is multifaceted or has many different good options, then t
first. In this case, a maintainer should add a `status:Needs Discussion` label. Then there will be some period of time where
anyone who has a stake in this issue or ideas on how to solve it should work together to come up with a coherent solution.

Once there seem to be some consensus around how to move forward, then someone can proceed to implementing the changes.
Once there seem to be some consensus around how to move forward, then someone can proceed to implementing the changes.
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include license
recursive-include etc *
recursive-include jupyterlab_pullrequests/labextension *
global-exclude .ipynb_checkpoints node_modules
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ where "`<YOUR_ACCESS_TOKEN>`" is the string value you obtained above.

Congrats, you did it! Launch JupyterLab and look for the Pull Request tab on the left! 🎉


## Development

### Contributing
Expand Down
7 changes: 7 additions & 0 deletions etc/jupyterlab-pull-requests-notebook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"NotebookApp": {
"nbserver_extensions": {
"jupyterlab_pullrequests": true
}
}
}
7 changes: 7 additions & 0 deletions etc/jupyterlab-pull-requests-server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ServerApp": {
"jpserver_extensions": {
"jupyterlab_pullrequests": true
}
}
}
12 changes: 9 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest'
},
globals: { 'ts-jest': { tsconfig: 'tsconfig.json' } },
moduleNameMapper: {
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
"monaco-editor": "<rootDir>/node_modules/react-monaco-editor"
'monaco-editor': '<rootDir>/node_modules/react-monaco-editor'
},
testRegex: '/tests/test-.*/.*.spec.ts[x]?$',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
testPathIgnorePatterns: ['/dev_mode/', '/lib/', '/node_modules/', ".*\\.d\\.ts$"],
testPathIgnorePatterns: [
'/dev_mode/',
'/lib/',
'/node_modules/',
'.*\\.d\\.ts$'
],
transformIgnorePatterns: ['/node_modules/(?!(@jupyterlab/.*)/)'],
setupFiles: ['./setupJest.js']
};
};
16 changes: 14 additions & 2 deletions jupyterlab_pullrequests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
""""Pull Requests for JupyterLab"""

from ._version import __version__, __js__

__all__ = ["__version__", "__js__"]


def _jupyter_server_extension_paths():
return [{"module": "jupyterlab_pullrequests.handlers"}]


def _jupyter_nbextension_paths():
return []
def _jupyter_labextension_paths():
return [
{
"src": "labextension",
"dest": "@jupyterlab/pullrequests",
}
]
12 changes: 12 additions & 0 deletions jupyterlab_pullrequests/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"""version information for jupyterlab_pullrequests"""
from pathlib import Path
import json

HERE = Path(__file__).parent
PKG = (HERE / "labextension/package.json")

__js__ = json.loads(PKG.read_text(encoding="utf-8"))

__version__ = __js__["version"]

__all__ = ["__version__", "__js__"]
7 changes: 5 additions & 2 deletions jupyterlab_pullrequests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
import traceback

import tornado.gen as gen
from jupyterlab_pullrequests.github_manager import PullRequestsGithubManager
from notebook.base.handlers import APIHandler
from tornado import web
from tornado.httpclient import AsyncHTTPClient

from traitlets import Bool, Unicode
from traitlets.config import Configurable

from jupyter_server.base.handlers import APIHandler

from .github_manager import PullRequestsGithubManager


class GitHubConfig(Configurable):
"""
Expand Down
Loading