Skip to content

Commit be4a5fa

Browse files
authored
Standalone pip package (jupyterlab#415)
* Standalone pip package * Move python tests in package * Correct travis script * Use yarn and add conda for server manager * Install from sdist
1 parent 6329d29 commit be4a5fa

20 files changed

+850
-54
lines changed

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ node_modules/
105105
.vscode/
106106

107107
package-lock.json
108+
MANIFEST
109+
jupyterlab_git/labextension/*.tgz

Diff for: .travis.yml

+9-10
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ cache:
55
pip: true
66
directories:
77
- /home/travis/.yarn-cache/
8-
install: pip install pytest "jupyterlab>=1.0.3"
98
script:
10-
- pytest tests/unit
11-
- yarn
12-
- yarn build
13-
- yarn test
14-
- pip install .
15-
- jupyter serverextension enable --py jupyterlab_git
16-
- jupyter labextension install .
9+
- python setup.py sdist
10+
- pip install --find-links=dist jupyterlab_git[test]
11+
- pytest jupyterlab_git
12+
- jlpm install
13+
- jlpm run build
14+
- jlpm run test
15+
- jupyter lab build
1716
- python -m jupyterlab.browser_check
18-
- yarn run lint
19-
- python -m tests.test-browser.run_browser_test
17+
- jlpm run lint
18+
- python tests/test-browser/run_browser_test.py

Diff for: MANIFEST.in

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
include LICENSE
2+
include README.md
3+
4+
include setupbase.py
5+
6+
include package.json
7+
include *.config.js
8+
include setupJest.js
9+
include ts*.json
10+
include jupyterlab_git/labextension/*.tgz
11+
12+
# Tests
13+
graft tests
14+
prune tests/build
15+
16+
# Javascript files
17+
graft src
18+
graft style
19+
prune **/node_modules
20+
prune lib
21+
22+
# Patterns to exclude from any directory
23+
global-exclude *~
24+
global-exclude *.pyc
25+
global-exclude *.pyo
26+
global-exclude .git
27+
global-exclude .ipynb_checkpoints

Diff for: README.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ A JupyterLab extension for version control using git
2020
To install perform the following steps:
2121

2222
```bash
23-
jupyter labextension install @jupyterlab/git
2423
pip install --upgrade jupyterlab-git
25-
jupyter serverextension enable --py jupyterlab_git
24+
jupyter lab build
2625
```
2726

2827
## Development
@@ -59,24 +58,20 @@ Requires node 4+ and npm 4+
5958
# Clone the repo to your local environment
6059
git clone https://github.com/jupyterlab/jupyterlab-git.git
6160
cd jupyterlab-git
62-
# Install dependencies
63-
npm install # or yarn
61+
# Install the server extension in development mode
62+
pip install -e .
63+
jupyter serverextension enable --py jupyterlab_git
64+
# Install Javascript dependencies
65+
jlpm install
6466
# Build Typescript source
65-
npm run build # or yarn build
67+
jlpm run build
6668
# Link your development version of the extension with JupyterLab
6769
jupyter labextension link .
68-
# Rebuild Typescript source after making changes
69-
npm run build # or yarn build
70-
```
71-
72-
```bash
73-
pip install .
74-
jupyter serverextension enable --py jupyterlab_git
7570
```
7671

77-
To rebuild the package and the JupyterLab app:
72+
To rebuild the package after a change and the JupyterLab app:
7873

7974
```bash
80-
npm run build
75+
jlpm run build
8176
jupyter lab build
8277
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"NotebookApp": {
3+
"nbserver_extensions": {
4+
"jupyterlab_git": true
5+
}
6+
}
7+
}

Diff for: jupyterlab_git/README.md

-6
This file was deleted.

Diff for: jupyterlab_git/_version.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) Project Jupyter.
2+
# Distributed under the terms of the Modified BSD License.
3+
4+
version_info = (0, 8, 2)
5+
__version__ = ".".join(map(str, version_info))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: package.json

+12-5
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,22 @@
55
"main": "lib/index.js",
66
"style": "style/index.css",
77
"license": "BSD-3-Clause",
8-
"author": "Git Intern Team - Jenna Landy, Noah Stapp, Alena Mueller; AWS - Jaipreet Singh, Neelam Gehlot; Quansight - Saul Shanabrook",
8+
"author": "Jupyter Development Team",
99
"keywords": [
1010
"jupyter",
1111
"jupyterlab",
1212
"jupyterlab-extension"
1313
],
1414
"scripts": {
15-
"build": "tsc",
16-
"clean": "rimraf lib",
17-
"prepublish": "npm run build",
15+
"build": "yarn run build:lib",
16+
"build:labextension": "cd jupyterlab_git && rimraf labextension && mkdirp labextension && cd labextension && npm pack ../..",
17+
"build:lib": "tsc",
18+
"build:all": "yarn run build:labextension",
19+
"clean": "yarn run clean:lib",
20+
"clean:lib": "rimraf lib",
21+
"clean:labextension": "rimraf jupyterlab_git/labextension",
22+
"clean:all": "yarn run clean:lib && yarn run clean:labextension",
23+
"prepare": "yarn run clean && yarn run build",
1824
"watch": "tsc -w",
1925
"test": "jest",
2026
"lint": "tslint --project .",
@@ -30,7 +36,8 @@
3036
"discovery": {
3137
"server": {
3238
"managers": [
33-
"pip"
39+
"pip",
40+
"conda"
3441
],
3542
"base": {
3643
"name": "jupyterlab-git"

Diff for: postBuild

-6
This file was deleted.

Diff for: requirements.txt

-3
This file was deleted.

Diff for: setup.py

+79-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,91 @@
11
"""
22
Setup Module to setup Python Handlers (Git Handlers) for the Git Plugin.
33
"""
4+
from os.path import join as pjoin
5+
6+
from setupbase import (
7+
create_cmdclass, install_npm, ensure_targets,
8+
find_packages, combine_commands, ensure_python,
9+
get_version, HERE
10+
)
11+
412
import setuptools
513

14+
# The name of the project
15+
name='jupyterlab_git'
16+
17+
# Ensure a valid python version
18+
ensure_python('>=3.5')
19+
20+
# Get our version
21+
version = get_version(pjoin(name, '_version.py'))
22+
23+
lab_path = pjoin(HERE, name, 'labextension')
24+
25+
# Representative files that should exist after a successful build
26+
jstargets = [
27+
pjoin(HERE, 'lib', 'git.js'),
28+
]
29+
30+
package_data_spec = {
31+
name: [
32+
'*'
33+
]
34+
}
35+
36+
data_files_spec = [
37+
('share/jupyter/lab/extensions', lab_path, '*.tgz'),
38+
('etc/jupyter/jupyter_notebook_config.d',
39+
'jupyter-config/jupyter_notebook_config.d', 'jupyterlab_git.json'),
40+
]
41+
42+
cmdclass = create_cmdclass('jsdeps',
43+
package_data_spec=package_data_spec,
44+
data_files_spec=data_files_spec
45+
)
46+
cmdclass['jsdeps'] = combine_commands(
47+
install_npm(HERE, build_cmd='build:all'),
48+
ensure_targets(jstargets),
49+
)
50+
651
with open("README.md", "r") as fh:
752
long_description = fh.read()
853

9-
setuptools.setup(
10-
name='jupyterlab_git',
11-
version='0.8.1',
12-
author='Git Intern Team - Noah Stapp, Jenna Landy, Alena Mueller; AWS - Jaipreet Singh, Neelam Gehlot; Quansight - Saul Shanabrook',
13-
description="A server extension for JupyterLab's git extension",
14-
long_description=long_description,
54+
setup_args = dict(
55+
name = name,
56+
description = "A server extension for JupyterLab's git extension",
57+
long_description= long_description,
1558
long_description_content_type="text/markdown",
16-
packages=setuptools.find_packages(),
17-
install_requires=[
59+
version = version,
60+
cmdclass = cmdclass,
61+
packages = setuptools.find_packages(),
62+
author = 'Jupyter Development Team',
63+
url = 'https://github.com/jupyterlab/jupyterlab-git',
64+
license = 'BSD',
65+
platforms = "Linux, Mac OS X, Windows",
66+
keywords = ['Jupyter', 'JupyterLab', 'Git'],
67+
classifiers = [
68+
'Intended Audience :: Developers',
69+
'Intended Audience :: Science/Research',
70+
'License :: OSI Approved :: BSD License',
71+
'Programming Language :: Python',
72+
'Programming Language :: Python :: 3',
73+
'Programming Language :: Python :: 3.5',
74+
'Programming Language :: Python :: 3.6',
75+
'Programming Language :: Python :: 3.7',
76+
'Framework :: Jupyter',
77+
],
78+
include_package_data = True,
79+
install_requires = [
1880
'notebook',
19-
'nbdime >= 1.1.0'
81+
'nbdime >= 1.1.0',
2082
],
21-
package_data={'jupyterlab_git': ['*']},
83+
extras_require = {
84+
'test': [
85+
'pytest',
86+
'jupyterlab>=1.0.3',
87+
],
88+
},
2289
)
90+
91+
setuptools.setup(**setup_args)

0 commit comments

Comments
 (0)