Skip to content

Commit e595deb

Browse files
authored
Merge pull request #353 from bollwyvl/remove-travis-ci
Remove travis-ci, split README/CONTRIBUTING
2 parents 9c38c20 + 211e010 commit e595deb

10 files changed

+417
-66
lines changed

.binder/environment.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: pythreejs-binder
2+
3+
channels:
4+
- conda-forge
5+
- nodefaults
6+
7+
dependencies:
8+
# runtimes
9+
- nodejs >=12,!=13,<15 # prefer LTS
10+
- pip
11+
- python >=3.6,<3.10
12+
- yarn <2
13+
# packaging dependencies
14+
- wheel
15+
- setuptools
16+
# dependencies
17+
- ipydatawidgets >=1.1.1
18+
- ipywidgets >=7.2.1
19+
- numpy >=1.14
20+
# clients
21+
- jupyterlab >=3,<4
22+
- jupyterlab-classic
23+
# dev
24+
- nbval
25+
- pytest-check-links
26+
# examples
27+
- ipympl
28+
- ipywebrtc
29+
- matplotlib-base
30+
- scikit-image
31+
- scipy
32+
# docs
33+
- nbsphinx >=0.2.13
34+
- nbsphinx-link
35+
- sphinx >=1.5
36+
- sphinx_rtd_theme

.binder/postBuild

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -eux
3+
4+
export PIP_DISABLE_PIP_VERSION_CHECK=1
5+
export PYTHONUNBUFFERED=1
6+
export PYTHONIOENCODING=utf-8
7+
8+
pushd js
9+
jlpm --ignore-optional
10+
popd
11+
12+
# build distribution
13+
python setup.py sdist
14+
15+
pushd dist
16+
python -m pip install \
17+
-v \
18+
--no-deps \
19+
--no-build-isolation \
20+
pythreejs*.tar.gz
21+
popd
22+
23+
# build docs
24+
pushd docs
25+
make html
26+
popd
27+
28+
# validate extensions
29+
jupyter nbextension list
30+
jupyter labextension list
31+
python -m pip check || echo "uh oh"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ docs/source/examples/img
3535

3636
js/lab-dist
3737
js/package-lock.json
38+
js/yarn.lock
3839
pythreejs/labextension

CONTRIBUTING.md

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Contributing
2+
3+
Thanks for contributing to pythreejs!
4+
5+
## Code Of Conduct
6+
7+
This project follows the [Project Jupyter Code of Conduct][coc].
8+
9+
[coc]: https://github.com/jupyter/governance/blob/master/conduct/code_of_conduct.md
10+
11+
## Prerequisites
12+
13+
A full development environment will require:
14+
15+
- `python >=3.6`
16+
- `jupyterlab >=3`
17+
- once built, `jupyterlab` version `1` or `2` may be used
18+
- `nodejs >=12` e.g. via
19+
```bash
20+
conda install -c conda-forge 'nodejs>=12'
21+
```
22+
23+
## Development Tasks
24+
25+
The relevant commands while working on the repository are included below. These are not meant to be run sequentially, but rather as a list of useful commands.
26+
27+
Most of these tasks are executed on many platforms and clients in [continuous integration][ci]
28+
29+
[ci]: https://github.com/jupyter-widgets/pythreejs/blob/master/.github/workflows/ci.yml
30+
31+
### Clone
32+
33+
```bash
34+
git clone https://github.com/jupyter-widgets/pythreejs
35+
cd pythreejs
36+
```
37+
38+
### Dev setup
39+
40+
```bash
41+
python -m pip install -e .
42+
```
43+
44+
### Re-generate autogen files
45+
46+
```bash
47+
cd js
48+
npm run autogen
49+
```
50+
51+
> More about [autogen](#Autogen-update)
52+
53+
### Build and install JS distribution
54+
55+
```bash
56+
cd js
57+
npm run build:all
58+
jupyter nbextension install --py --symlink --sys-prefix pythreejs
59+
```
60+
61+
### Build the python distributions
62+
63+
```bash
64+
python setup.py sdist bdist_wheel
65+
```
66+
67+
### Clean out generated files
68+
69+
```bash
70+
cd js
71+
npm run clean
72+
```
73+
74+
### Symlink the JupyterLab 3 federated extension
75+
76+
```bash
77+
jupyter labextension develop . --overwrite
78+
```
79+
80+
### Run the tests
81+
82+
```bash
83+
python -m pip install -e .[test]
84+
pytest -vv -l --nbval-lax --current-env .
85+
```
86+
87+
### Build the docs
88+
89+
```bash
90+
python -m pip install -e .[docs]
91+
cd docs
92+
make html
93+
```
94+
95+
### Explore the examples
96+
97+
```bash
98+
python -m pip install -e .[examples]
99+
```
100+
101+
And then:
102+
103+
```bash
104+
jupyter notebook --debug
105+
# or
106+
jupyter lab --no-browser --debug
107+
```
108+
109+
### Watching sources
110+
111+
```bash
112+
cd js
113+
npm watch
114+
```
115+
116+
### Watching JupyterLab 3+ federated extension
117+
118+
```bash
119+
jupyter labextension watch .
120+
```
121+
122+
## Autogen update
123+
124+
This is a _significant_ re-work of the pythreejs extension that introduces an "autogen" script that generates the majority of the ipython-widget code to wrap each of three.js's types. It also takes a different view towards the pythreejs API. Whereas pythreejs adds custom functionality to the classes, sometimes renaming, etc., this approach attempts to mimic the low-level three.js API as closely as possible, opening up the possibility for others to build utility libraries on top of this.
125+
126+
The autogen script, `generate-wrappers.js`, takes advantage of a config file `three-class-config.js` to auto-generate both javascript and python files to define the ipywidget wrappers for each three.js class. The generated javascript files will have `.autogen.js` as the extension. The generated python files have `_autogen.py` as their extension. The script uses the handlebars template system to generate the various code files.
127+
128+
The autogen solution allows for overriding the default behavior of the generated classes. E.g., if `Object3D.js` is present, then it will be loaded into the namespace as opposed to loading `Object3D.autogen.js`. It is up to the author of the override classe to decide whether to inherit behavior from the autogen class or not. Same goes for the python modules. This allows for writing custom methods on both the python and javascript side when needed.
129+
130+
The autogen script relies on a json-like config file (`three-class-config.js`) to describe the classes. Reasonable defaults should take care of most, but it allows specifying the base class, constructor args, etc. for each of the wrappers. A base version of this file can be generated by `generate-class-config.js`, but beware, it overwrites any customization to the config file that has already been done.

MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ include screencast.gif
99
graft docs
1010
exclude docs/\#*
1111

12+
# demo
13+
exclude .binder
14+
1215
# docs subdirs we want to skip
1316
prune docs/build
1417
prune docs/dist

0 commit comments

Comments
 (0)