Skip to content

Commit

Permalink
Merge pull request #62 from jvail/master
Browse files Browse the repository at this point in the history
v2.0.0
  • Loading branch information
fredboudon authored Jun 28, 2022
2 parents f8bd615 + c18c4ee commit 5f4a804
Show file tree
Hide file tree
Showing 56 changed files with 15,283 additions and 7,719 deletions.
2 changes: 0 additions & 2 deletions .coveragerc

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ pgljupyter/labextension/*.tgz
pgljupyter/labextension

.vscode

examples/test
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.DS_Store
node_modules/
tests/
.jshintrc
# Ignore any build output from python:
dist/*.tar.gz
dist/*.wheel
examples
src/pgljs/plantgl
src/pgljs/build
src/pgljs/dist
74 changes: 0 additions & 74 deletions .travis.yml

This file was deleted.

44 changes: 0 additions & 44 deletions HOWTO.md

This file was deleted.

31 changes: 7 additions & 24 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,36 +1,19 @@
include LICENSE.txt
include README.md
include LICENSE
include *.md
include pyproject.toml

include setupbase.py
include pytest.ini
include .coverage.rc

include tsconfig.json
include package.json
include webpack.config.js
include pgljupyter/labextension/*.tgz

# Documentation
#graft docs
exclude docs/\#*
prune docs/build
prune docs/gh-pages
prune docs/dist

# Examples
#graft examples

# Tests
prune tests
include install.json
include ts*.json
include yarn.lock

# Javascript files
graft pgljupyter/nbextension
graft src
graft css
prune src/pgljs/node_modules
prune src/pgljs/plantgl
prune src/pgljs/debug
prune src/pgljs/build
prune src/pgljs/dist
prune **/node_modules
prune *.js.map
prune examples
Expand Down
57 changes: 24 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

[PlantGL](https://github.com/fredboudon/plantgl) & [L-Py](https://github.com/fredboudon/lpy) jupyter widgets

Currently supports openalea.lpy>=3.9.0 and openalea.plantgl>=3.14.0 from conda channel ['fredboudon'](https://anaconda.org/fredboudon/openalea.lpy).

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/fredboudon/plantgl-jupyter/HEAD?labpath=%2Fexamples%2Fbroccoli.ipynb)


![Leuvenberg](docs/lpy_leuwenberg.gif)

Expand Down Expand Up @@ -103,6 +107,7 @@ Arguments:
- `--unit`, `-u` enum: same as `unit`
- `--params`, `-p` LsystemParameters: name of LsystemParameters instance
- `--animate`, `-a` True: runs animation automatically
- `--extended-editor`, `-e` False: show/hide all parameter controls

Example:

Expand Down Expand Up @@ -157,6 +162,7 @@ Arguments:
- `arg0`, string: L-Py file
- `--size`, `-s` int,int: width and hight of the canvas
- `--cell`, `-c` float: size of cell for a single derivation step
- `--derive`, `-d` int[,int[,int]]: start, stop, step derivation

Example:

Expand All @@ -173,39 +179,36 @@ Tutorial:

## Installation

### Install with pip - inside conda env
### Install with pip - inside conda environment

Building JupyterLab extensions requires nodejs. In case it is not available on your system add `nodejs` to the
`conda create` command. Some examples also require `matplotlib`, `xarray-simlab` and `rpy2`.
Some examples also require `matplotlib`, `xarray-simlab` and `rpy2`.

```bash
conda create -y -n pgl -c fredboudon -c conda-forge \
openalea.lpy jupyterlab ipywidgets ipython=7 pip
openalea.lpy jupyterlab ipywidgets pip
```

```bash
conda activate pgl
jupyter labextension install @jupyter-widgets/jupyterlab-manager
pip install pgljupyter
```

### Build, install and run from source
### Development install

- install lpy, plantgl, jupyterlab, widgets and widgetsextension

```bash
conda create -y -n pgl -c fredboudon -c conda-forge openalea.lpy jupyterlab ipywidgets
conda activate pgl
jupyter labextension install --no-build @jupyter-widgets/jupyterlab-manager
mamba env create -f environment-dev.yml
conda activate pgljupyter-dev
```

- install emsdk: https://emscripten.org/docs/getting_started/downloads.html

```bash
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install 2.0.20
./emsdk activate 2.0.20
./emsdk install 2.0.29
./emsdk activate 2.0.29
source ./emsdk_env.sh
cd ..
```
Expand All @@ -226,38 +229,26 @@ npm install
cd ../..
```

- install pgljupyter deps and build (requires activation of emsdk i.e. source ./emsdk_env.sh)
- install pgljupyter deps and build (requires activated emsdk i.e. source ./emsdk_env.sh)

```bash
npm install
npm run build:all
```

- install python modules and jupyter extensions

```bash
pip install -e .
jupyter nbextension install --sys-prefix --overwrite --py pgljupyter
jupyter nbextension enable --sys-prefix --py pgljupyter
jupyter labextension install .
jupyter lab clean
jupyter labextension develop . --overwrite
```

- run the lab
- run lab

```bash
jupyter lab --notebook-dir=./examples
```

## Docker

Run jupyter as docker container locally. Replace `/examples` with the path to your notebooks.
Tag `latest` might not always be up-to-date since docker is primarily used for binder
### Development uninstall

```bash
pip uninstall pgljupyter
```
docker pull jvail/plantgl-jupyter:1.1.0
docker run --rm \
-p 8888:8888 \
-v $PWD/examples:/home/jovyan/work jvail/plantgl-jupyter:1.1.0 \
jupyter lab
```

In development mode, you will also need to remove the symlink created by `jupyter labextension develop`
command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions`
folder is located. Then you can remove the symlink named `pgljupyter` within that folder.
62 changes: 62 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## Manual release

This extension can be distributed as Python packages. All of the Python packaging instructions in the `pyproject.toml` file to wrap your extension in a Python package. Before generating a package, we first need to install `build`.

```bash
pip install build twine
```

## Bump version in **all** relevant files

- package.json
- package-lock.json
- pgljupyter/_frontend.py
- pgljupyter/_version.py


## Update README

- version
- API spec
- descriptions

## Commit all changes in branch develop

## Build python pkgs and publish them

Activate conda dev env and emsdk e.g.

```bash
conda activate pgljupyter-dev
source ~/emsdk/emsdk_env.sh
```
You need build and twine installed. To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:

```bash
npm run build:prod
python -m build
```

Make sure there are no old/oudated files in dist/
Then to upload the package to PyPI, do:

```bash
twine upload dist/pgljupyter-*
```

## Test if npm builds and publish npm pkg

Mainly for tools like nbviewer or vscode that load widgets from the npm package.

```bash
npm login
npm publish
```

## Merge changes into master, tag and push

```bash
git push
git tag -a v{version} -m "v{version}"
git push --tags
```
Loading

0 comments on commit 5f4a804

Please sign in to comment.