Update to drawio 21.1.4 (#112)

pull/116/head
Nicholas Bollweg 2023-04-09 11:46:27 -05:00 zatwierdzone przez GitHub
rodzic 606fd7037a
commit 3765c72391
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
189 zmienionych plików z 3370 dodań i 7754 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
# a heavy demo environment for interactive testing # a heavy demo environment for interactive testing
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -21,7 +21,7 @@ channels:
- nodefaults - nodefaults
dependencies: dependencies:
- python >=3.7 - python >=3.8
# demo toys # demo toys
- graphviz2drawio - graphviz2drawio
- jupyter-lsp-python-lsp-server - jupyter-lsp-python-lsp-server
@ -31,6 +31,7 @@ dependencies:
- matplotlib-base - matplotlib-base
- nbgitpuller - nbgitpuller
- networkx - networkx
- pandas
- pygraphviz - pygraphviz
- python-graphviz - python-graphviz
- qrcode-artistic - qrcode-artistic
@ -44,27 +45,28 @@ dependencies:
- jupyterlab_widgets - jupyterlab_widgets
- jupyterlab-tour - jupyterlab-tour
- jupyterlab-webrtc-docprovider - jupyterlab-webrtc-docprovider
- wxyz_datagrid - jupyterlite-pyodide-kernel ==0.0.6
- wxyz_json_schema_form - jupyterlite-javascript-kernel
- wxyz_lab
- wxyz_svg
### FEDERATED EXTENSIONS ### ### FEDERATED EXTENSIONS ###
############################################################################ ############################################################################
### ipydrawio-docs-deps ### ### ipydrawio-docs-deps ###
- autodoc-traits
- docutils >=0.18.1 - docutils >=0.18.1
- jupyter-server-mathjax - jupyter-server-mathjax
- jupyterlab-myst - jupyterlite-core ==0.1.0
- jupyterlite-core-with-libarchive
- jupyterlite-pyodide-kernel ==0.0.6
- myst-nb - myst-nb
- pkginfo - pkginfo
- pydata-sphinx-theme >=0.10.1,<0.11.0 - pydata-sphinx-theme >=0.13.3,<0.14.0
- pytest-check-links - pytest-check-links
- python-libarchive-c
- sphinx >=5,<6 - sphinx >=5,<6
- sphinx-copybutton
- sphinx-design
- sphinx-jsonschema - sphinx-jsonschema
- sphinxext-rediraffe - sphinxext-rediraffe
- ssort
- pip:
- jupyterlite ==0.1.0b14
### ipydrawio-docs-deps ### ### ipydrawio-docs-deps ###
@ -75,15 +77,15 @@ dependencies:
# core # core
- doit - doit
- nodejs >=16,<17 - nodejs >=18,<19
- python # this gets patched in ci - python # this gets patched in ci
# run # run
- ipywidgets >=7.6,<9 - ipywidgets >=7.6,<9
- jupyterlab >=3.5.0,<4.0.0a0 - jupyterlab >=3.6.3,<4.0.0a0
- jupyterlab_widgets >=1 - jupyterlab_widgets >=1
- lxml - lxml
- pillow - pillow
- pypdf2 - pypdf >=3.5
- requests_cache - requests_cache
# building # building
- flit >=3.7.1 - flit >=3.7.1
@ -91,17 +93,18 @@ dependencies:
- twine >=3.7.1 - twine >=3.7.1
- wheel - wheel
# linting # linting
- black - black-jupyter
- flake8 - nbqa
- isort >=5
- pyflakes
- pyyaml - pyyaml
- robotframework-lint
- robotframework-tidy - robotframework-tidy
- robotframework-robocop
- ruff
- ssort
# unit testing # unit testing
- pytest - pytest
- pytest-console-scripts - pytest-console-scripts
- pytest-html - pytest-html
- pytest-jupyter-server
- pytest-tornasync - pytest-tornasync
- pytest-xdist - pytest-xdist
# acceptance testing # acceptance testing

Wyświetl plik

@ -1,6 +1,5 @@
{ {
"LabApp": { "ServerApp": {
"collaborative": true,
"tornado_settings": { "tornado_settings": {
"page_config_data": { "page_config_data": {
"buildAvailable": false, "buildAvailable": false,

Wyświetl plik

@ -1,6 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

1
.github/.condarc vendored
Wyświetl plik

@ -10,4 +10,3 @@ remote_read_timeout_secs: 600.0
show_channel_urls: True show_channel_urls: True
show_sources: True show_sources: True
unsatisfiable_hints_check_depth: 0 unsatisfiable_hints_check_depth: 0
use_only_tar_bz2: True

Wyświetl plik

@ -83,7 +83,7 @@ refreshing the window and then reproducing the bug to reduce the noise in the lo
</details> </details>
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -24,7 +24,7 @@ https://jupyterlab.readthedocs.io/en/latest/getting_started/issue.html
<!--Describe how this documentation can be kept up-to-date: testing, link checking, etc. --> <!--Describe how this documentation can be kept up-to-date: testing, link checking, etc. -->
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -24,7 +24,7 @@ https://jupyterlab.readthedocs.io/en/latest/getting_started/issue.html
<!-- Share any kind of design ideas (e.g. ASCII art, links, screenshots) that might help us understand --> <!-- Share any kind of design ideas (e.g. ASCII art, links, screenshots) that might help us understand -->
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -36,7 +36,7 @@ labels: maintenance
https://discourse.jupyter.org/t/ipydrawio-diagrams-in-jupyterlab-with-pages-layers-widgets-pdf-export https://discourse.jupyter.org/t/ipydrawio-diagrams-in-jupyterlab-with-pages-layers-widgets-pdf-export
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
# a sufficient environment for building conda packages # a sufficient environment for building conda packages
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
# a sufficient environment for building conda packages # a sufficient environment for building conda packages
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
# extra/pinned packages for python 3.7 # extra/pinned packages for python 3.8
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -21,7 +21,5 @@ channels:
- nodefaults - nodefaults
dependencies: dependencies:
# for flake8, sigh
- importlib-metadata <4.3
# for legacy ipywidgets # for legacy ipywidgets
- ipywidgets <8 - ipywidgets <8

Wyświetl plik

@ -1,6 +1,6 @@
# a sufficient environment for acceptance testing # a sufficient environment for acceptance testing
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -25,15 +25,15 @@ dependencies:
# core # core
- doit - doit
- nodejs >=16,<17 - nodejs >=18,<19
- python # this gets patched in ci - python # this gets patched in ci
# run # run
- ipywidgets >=7.6,<9 - ipywidgets >=7.6,<9
- jupyterlab >=3.5.0,<4.0.0a0 - jupyterlab >=3.6.3,<4.0.0a0
- jupyterlab_widgets >=1 - jupyterlab_widgets >=1
- lxml - lxml
- pillow - pillow
- pypdf2 - pypdf >=3.5
- requests_cache - requests_cache
# building # building
- flit >=3.7.1 - flit >=3.7.1
@ -41,17 +41,18 @@ dependencies:
- twine >=3.7.1 - twine >=3.7.1
- wheel - wheel
# linting # linting
- black - black-jupyter
- flake8 - nbqa
- isort >=5
- pyflakes
- pyyaml - pyyaml
- robotframework-lint
- robotframework-tidy - robotframework-tidy
- robotframework-robocop
- ruff
- ssort
# unit testing # unit testing
- pytest - pytest
- pytest-console-scripts - pytest-console-scripts
- pytest-html - pytest-html
- pytest-jupyter-server
- pytest-tornasync - pytest-tornasync
- pytest-xdist - pytest-xdist
# acceptance testing # acceptance testing

22
.github/pip-build.txt vendored
Wyświetl plik

@ -1,23 +1,5 @@
# basically ipydrawio[all,test] and ipydrawio-export... plus robot, pyyaml
black
doit doit
flake8 flit
ipywidgets >=7.6,<9
isort >=5
jsonpointer
jupyterlab ==3.*
jupyterlab_widgets >=1
lxml
pillow
pip pip
pyflakes
pypdf2
pytest
pyyaml pyyaml
requests jupyterlab >=3.6,<4.0.0a0
requests-cache
robotframework
robotframework-lint
setuptools
ssort
wheel

49
.github/workflows/badges.yml vendored 100644
Wyświetl plik

@ -0,0 +1,49 @@
# make badges
# Copyright 2023 ipydrawio contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
on:
pull_request_target:
types: [opened]
permissions:
pull-requests: write
jobs:
binder:
runs-on: ubuntu-latest
steps:
- name: Add Binder/Lite PR comment
uses: actions/github-script@v6
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const PR_NUMBER = context.issue.number
const { PR_HEAD_REF, PR_HEAD_USERREPO } = process.env;
const RTD = `https://ipydrawio--${PR_NUMBER}.org.readthedocs.build/en/${PR_NUMBER}/_static/lab/index.html?path=Diagram%20Widget.ipynb`;
const BH = `https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=lab/tree/docs/Diagram%20Widget.ipynb`;
const LITE = `https://jupyterlite.rtfd.io/en/latest/_static/badge.svg`;
const BND = `https://mybinder.org/badge_logo.svg`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Try this PR on [![](${LITE})](${RTD}) :arrow_left: ReadTheDocs or Binder :arrow_right: [![](${BND})](${BH})`,
});

Wyświetl plik

@ -1,6 +1,6 @@
# main continuous integration workflow # main continuous integration workflow
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -35,7 +35,7 @@ env:
# our stuff # our stuff
ATEST_RETRIES: '3' ATEST_RETRIES: '3'
CACHE_EPOCH: '4' CACHE_EPOCH: '6'
CONDA_BUILDERER: mambabuild CONDA_BUILDERER: mambabuild
jobs: jobs:
@ -121,7 +121,10 @@ jobs:
run: doit list --all --status run: doit list --all --status
- name: build - name: build
run: doit dist || doit dist run: doit -n8 dist || exit 0
- name: build (again, maybe)
run: doit dist
- name: status - name: status
run: doit list --all --status | sort run: doit list --all --status | sort
@ -147,15 +150,6 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: cache (conda)
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-build-${{ hashFiles('.github/environment-conda-build.yml') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-build-
- name: install (conda) - name: install (conda)
uses: conda-incubator/setup-miniconda@v2 uses: conda-incubator/setup-miniconda@v2
with: with:
@ -179,6 +173,10 @@ jobs:
name: ipydrawio-${{ github.run_number }}-conda name: ipydrawio-${{ github.run_number }}-conda
path: ./build/conda-bld path: ./build/conda-bld
- name: Rename uncached conda packages
shell: bash
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache"
conda-test: conda-test:
needs: [conda-build] needs: [conda-build]
runs-on: ${{ matrix.os }}-latest runs-on: ${{ matrix.os }}-latest
@ -193,15 +191,6 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: cache (conda)
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-build-${{ hashFiles('.github/environment-*.yml') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-build-
- name: install (conda) - name: install (conda)
uses: conda-incubator/setup-miniconda@v2 uses: conda-incubator/setup-miniconda@v2
if: matrix.os == 'windows' if: matrix.os == 'windows'
@ -230,6 +219,10 @@ jobs:
conda index build/conda-bld conda index build/conda-bld
doit -s conda_test || doit -s conda_test doit -s conda_test || doit -s conda_test
- name: Rename uncached conda packages
shell: bash
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache"
test: test:
needs: [build] needs: [build]
name: ${{ matrix.os }} ${{ matrix.python-version }} name: ${{ matrix.os }} ${{ matrix.python-version }}
@ -238,9 +231,9 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: ['ubuntu', 'macos', 'windows'] os: ['ubuntu', 'macos', 'windows']
python-version: ['3.7', '3.11'] python-version: ['3.8', '3.11']
include: include:
- python-version: '3.7' - python-version: '3.8'
CI_ARTIFACT: 'sdist' CI_ARTIFACT: 'sdist'
- python-version: '3.11' - python-version: '3.11'
CI_ARTIFACT: 'wheel' CI_ARTIFACT: 'wheel'
@ -253,28 +246,18 @@ jobs:
- name: checkout - name: checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: cache (conda)
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-${{ matrix.python-version }}-${{ hashFiles('.github/environment*.yml') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-${{ matrix.python-version }}-
- name: install (conda) - name: install (conda)
uses: conda-incubator/setup-miniconda@v2 uses: conda-incubator/setup-miniconda@v2
with: with:
miniforge-variant: Mambaforge miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
environment-file: .github/environment.yml environment-file: .github/environment.yml
use-only-tar-bz2: true
use-mamba: true use-mamba: true
- name: tweak install (conda) - name: tweak install (conda)
if: matrix.python-version == '3.7' if: matrix.python-version == '3.8'
shell: bash -l {0} shell: bash -l {0}
run: mamba env update -n test --file .github/environment-py37.yml run: mamba env update -n test --file .github/environment-py38.yml
- name: download (dist) - name: download (dist)
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
@ -329,6 +312,64 @@ jobs:
ipydrawio-${{ github.run_number }}-atest-${{ matrix.os }}-${{matrix.python-version }} ipydrawio-${{ github.run_number }}-atest-${{ matrix.os }}-${{matrix.python-version }}
path: ./build/atest path: ./build/atest
- name: Rename uncached conda packages
shell: bash
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache"
lint:
name: lint
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: ['ubuntu']
python-version: ['3.11']
steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: cache (node)
uses: actions/cache@v3
id: cache-node-modules
with:
path: '**/node_modules'
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-node-build-${{ hashFiles('yarn.lock', '.github/pip-build.txt') }}
- name: cache (yarn)
uses: actions/cache@v3
if: steps.cache-node-modules.outputs.cache-hit != 'true'
id: cache-yarn-packages
with:
path: .yarn-packages
key: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-
${{ env.CACHE_EPOCH }}-yarn-
- name: install (conda)
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }}
environment-file: .binder/environment.yml
use-mamba: true
- name: lint
shell: bash -l {0}
run: doit -n8 test:integrity lint || exit 0
- name: lint (again, maybe)
shell: bash -l {0}
run: doit test:integrity lint
- name: Rename uncached conda packages
shell: bash
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache"
docs: docs:
name: docs name: docs
runs-on: ${{ matrix.os }}-latest runs-on: ${{ matrix.os }}-latest
@ -345,15 +386,6 @@ jobs:
with: with:
submodules: recursive submodules: recursive
- name: cache (conda)
uses: actions/cache@v3
with:
path: ~/conda_pkgs_dir
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-docs-${{ matrix.python-version }}-${{ hashFiles('./docs/environment.yml') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-docs-${{ matrix.python-version }}-
- name: cache (node) - name: cache (node)
uses: actions/cache@v3 uses: actions/cache@v3
id: cache-node-modules id: cache-node-modules
@ -380,12 +412,11 @@ jobs:
miniforge-variant: Mambaforge miniforge-variant: Mambaforge
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
environment-file: docs/environment.yml environment-file: docs/environment.yml
use-only-tar-bz2: true
use-mamba: true use-mamba: true
- name: build - name: build
shell: bash -l {0} shell: bash -l {0}
run: doit build run: doit -n4 build
- name: build docs - name: build docs
shell: bash -l {0} shell: bash -l {0}
@ -414,3 +445,7 @@ jobs:
name: |- name: |-
ipydrawio-${{ github.run_number }}-docs-${{ matrix.os }}-${{matrix.python-version }} ipydrawio-${{ github.run_number }}-docs-${{ matrix.os }}-${{matrix.python-version }}
path: ./build/docs path: ./build/docs
- name: Rename uncached conda packages
shell: bash
run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache"

1
.gitignore vendored
Wyświetl plik

@ -8,7 +8,6 @@ _output
.virtual_documents/ .virtual_documents/
*.bundle.* *.bundle.*
*.egg-info/ *.egg-info/
*.isorted
*.log *.log
*.pdf *.pdf
*.sqlite *.sqlite

Wyświetl plik

@ -1,4 +1,4 @@
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -18,10 +18,23 @@ build:
os: ubuntu-20.04 os: ubuntu-20.04
tools: tools:
python: mambaforge-4.10 python: mambaforge-4.10
jobs:
conda: pre_build:
environment: docs/environment.yml - doit list
- doit build
- doit list
- doit setup:pip:check
- doit list
- doit docs:typedoc:mystify
- doit list
- doit demo:stage*
- doit list
- doit demo
sphinx: sphinx:
builder: html builder: html
configuration: docs/conf.py configuration: docs/conf.py
fail_on_warning: true
conda:
environment: docs/environment.yml

Wyświetl plik

@ -1,5 +1,4 @@
disable-self-update-check true disable-self-update-check true
ignore-optional true
ignore-scripts true ignore-scripts true
network-timeout "300000" network-timeout "300000"
prefer-offline true prefer-offline true

Wyświetl plik

@ -2,25 +2,41 @@
## Unreleased ## Unreleased
### ipydrawio-widgets 1.2.3 ### ipydrawio-widgets 1.3.0
### ipydrawio 1.2.3 - minimum supported python is now 3.8
#### @deathbeds/ipydrawio 1.2.3 ### ipydrawio 1.3.0
#### @deathbeds/ipydrawio-notebook 1.2.3 - minimum supported python is now 3.8
#### @deathbeds/ipydrawio-webpack 20.5.301 #### @deathbeds/ipydrawio 1.3.0
#### @deathbeds/ipydrawio-jupyter-templates 1.2.3 #### @deathbeds/ipydrawio-notebook 1.3.0
### ipydrawio-export 1.2.3 #### @deathbeds/ipydrawio-webpack 21.1.400
#### @deathbeds/ipydrawio-pdf 1.2.3 - updates to [drawio v21.1.4](https://github.com/jgraph/drawio/releases/tag/v21.1.4)
- includes
[mermaidjs 10.0.0](https://github.com/mermaid-js/mermaid/releases/tag/v10.0.0)
### ipydrawio-mathjax 1.2.3 #### @deathbeds/ipydrawio-jupyter-templates 1.3.0
#### @deathbeds/ipydrawio-mathjax 1.2.3 ### ipydrawio-export 1.3.0
- minimum supported python is now 3.8
- updates to
[draw-image-export2 v1.0.2](https://github.com/jgraph/draw-image-export2/releases/tag/v1.0.2)
- by default uses a private copy of chromium in `{sys.prefix}/jupyter/ipydrawio_export`
- can be overridden with `IPYDRAWIO_PUPPETEER_CACHE_DIR` or `PUPPETEER_CACHE_DIR`
#### @deathbeds/ipydrawio-pdf 1.3.0
### ipydrawio-mathjax 1.3.0
- minimum supported python is now 3.8
#### @deathbeds/ipydrawio-mathjax 1.3.0
## Releases ## Releases
@ -60,8 +76,6 @@
[#106]: https://github.com/deathbeds/ipydrawio/pull/106 [#106]: https://github.com/deathbeds/ipydrawio/pull/106
---
### ipydrawio-widgets 1.2.1 ### ipydrawio-widgets 1.2.1
- add support for `ipywidgets` 8 [#98] - add support for `ipywidgets` 8 [#98]
@ -120,8 +134,6 @@
[#85]: https://github.com/deathbeds/ipydrawio/issues/85 [#85]: https://github.com/deathbeds/ipydrawio/issues/85
[#88]: https://github.com/deathbeds/ipydrawio/issues/88 [#88]: https://github.com/deathbeds/ipydrawio/issues/88
---
### ipydrawio 1.1.3 ### ipydrawio 1.1.3
#### @deathbeds/ipydrawio 1.1.3 #### @deathbeds/ipydrawio 1.1.3
@ -138,8 +150,6 @@
#### @deathbeds/ipydrawio-pdf 1.1.3 #### @deathbeds/ipydrawio-pdf 1.1.3
---
### ipydrawio 1.1.2 ### ipydrawio 1.1.2
#### @deathbeds/ipydrawio 1.1.2 #### @deathbeds/ipydrawio 1.1.2
@ -163,8 +173,6 @@
[#72]: https://github.com/deathbeds/ipydrawio/issues/72 [#72]: https://github.com/deathbeds/ipydrawio/issues/72
---
### ipydrawio 1.1.1 ### ipydrawio 1.1.1
- adds `jupyter ipydrawio clean` for removing `host`, `agent`, `modified` attributes and - adds `jupyter ipydrawio clean` for removing `host`, `agent`, `modified` attributes and
@ -190,11 +198,8 @@
#### @deathbeds/ipydrawio-pdf 1.1.1 #### @deathbeds/ipydrawio-pdf 1.1.1
[#41]: https://github.com/deathbeds/ipydrawio/issues/41
[#44]: https://github.com/deathbeds/ipydrawio/issues/44 [#44]: https://github.com/deathbeds/ipydrawio/issues/44
---
### ipydrawio 1.1.0 ### ipydrawio 1.1.0
- new documentation site at https://ipydrawio.rtfd.io [#40] - new documentation site at https://ipydrawio.rtfd.io [#40]
@ -228,8 +233,6 @@
[#40]: https://github.com/deathbeds/ipydrawio/pull/40 [#40]: https://github.com/deathbeds/ipydrawio/pull/40
[#41]: https://github.com/deathbeds/ipydrawio/pull/41 [#41]: https://github.com/deathbeds/ipydrawio/pull/41
---
### ipydrawio 1.0.1 ### ipydrawio 1.0.1
- [#32] on-disk file paths are shorter to avoid Windows issues - [#32] on-disk file paths are shorter to avoid Windows issues
@ -255,8 +258,6 @@
[#31]: https://github.com/deathbeds/ipydrawio/issues/31 [#31]: https://github.com/deathbeds/ipydrawio/issues/31
[#32]: https://github.com/deathbeds/ipydrawio/issues/32 [#32]: https://github.com/deathbeds/ipydrawio/issues/32
---
### ipydrawio 1.0.0 ### ipydrawio 1.0.0
- ipywidgets support - ipywidgets support
@ -294,8 +295,6 @@
[#21]: https://github.com/deathbeds/ipydrawio/issues/21 [#21]: https://github.com/deathbeds/ipydrawio/issues/21
[#22]: https://github.com/deathbeds/ipydrawio/pull/22 [#22]: https://github.com/deathbeds/ipydrawio/pull/22
---
### ipydrawio 1.0.0a0 ### ipydrawio 1.0.0a0
- ipywidgets support - ipywidgets support
@ -316,8 +315,6 @@
#### @deathbeds/ipydrawio-pdf 1.0.0-alpha0 #### @deathbeds/ipydrawio-pdf 1.0.0-alpha0
---
## Historic Releases ## Historic Releases
For pre-releases of the previously-named package, see the [old CHANGELOG][] For pre-releases of the previously-named package, see the [old CHANGELOG][]
@ -325,7 +322,7 @@ For pre-releases of the previously-named package, see the [old CHANGELOG][]
[old changelog]: https://github.com/deathbeds/ipydrawio/tree/3a577ac/CHANGELOG.md [old changelog]: https://github.com/deathbeds/ipydrawio/tree/3a577ac/CHANGELOG.md
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -2,12 +2,15 @@
## Help Wanted ## Help Wanted
- tackling [roadmap](./docs/ROADMAP.ipynb) issues - tackling [roadmap] issues
- improving testing - improving testing
- improving (self-hosted) documentation - improving (self-hosted) documentation
- improving the binder demo - improving the binder demo
- improving [continuous integration](./github/workflows/ci.yml) and - improving [continuous integration][ci] and [developer experience][dodo]
[developer experience](./dodo.py)
[roadmap]: https://github.com/deathbeds/ipydrawio/blob/master/ROADMAP.md
[ci]: https://github.com/deathbeds/ipydrawio/blob/master/.github/workflows/ci.yml
[dodo]: https://github.com/deathbeds/ipydrawio/blob/master/dodo.py
## Prerequisites ## Prerequisites
@ -105,7 +108,7 @@ doit dist
- [ ] update release procedures - [ ] update release procedures
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -123,10 +123,9 @@ browser, powered by [@jgraph/draw-image-export2], `puppeteer`, and `nodejs`.
- **native dependencies** as required to appease `puppeteer` - **native dependencies** as required to appease `puppeteer`
- if running in `docker`, this can be a bit trial-and-error - if running in `docker`, this can be a bit trial-and-error
- for more, see the [binder][apt-txt] and CI. - for more, see the [binder][apt-txt] and CI.
- `nodejs>10,<14` from `conda` or your system package manager - `nodejs>=18,<19` from `conda` or your system package manager
- **NOTE**: this relies on being able to install `puppeteer` (and other **arbitrary - **NOTE**: this relies on being able to install `puppeteer` (and other **arbitrary
dependencies** with `jlpm` for now **when first used** dependencies** with `jlpm` for now **when first used**
- _we'll figure out a better approach soon enough_
- `pip install ipydrawio-export` or `conda install -c conda-forge ipydrawio-export` - `pip install ipydrawio-export` or `conda install -c conda-forge ipydrawio-export`
> For example to install all the dependencies: > For example to install all the dependencies:
@ -135,6 +134,21 @@ browser, powered by [@jgraph/draw-image-export2], `puppeteer`, and `nodejs`.
> conda install -yc conda-forge ipydrawio-export ipydrawio-mathjax > conda install -yc conda-forge ipydrawio-export ipydrawio-mathjax
> ``` > ```
Optionally, pre-install the dependencies:
```bash
jupyter ipydrawio-export provision
```
> By default this will install to `{JUPYTER_DATA_DIR}/ipydrawio_export`, but can be
> tuned with:
>
> - the `$IPYDRAWIO_DATA_DIR` environment variable
> - `IPyDrawioExportManager.drawio_export_workdir` in `jupyter_config.json`
>
> Additionally, the (large) chromium browser download can be tuned with the
> `$IPYDRAWIO_PUPPETEER_CACHE_DIR` or `$PUPPETEER_CACHE_DIR` environment variables.
Once installed, you can use the in-browser tools _Export Diagram as PDF_ as well as the Once installed, you can use the in-browser tools _Export Diagram as PDF_ as well as the
command line: command line:
@ -162,7 +176,7 @@ The original source code vendored in this package from:
- [@jgraph/draw-image-export2][] - [@jgraph/draw-image-export2][]
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -24,7 +24,7 @@
- [ ] richer notebook integration with "live" updating - [ ] richer notebook integration with "live" updating
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,4 +1,4 @@
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,4 +1,4 @@
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
*** Comments *** *** Comments ***
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
"""do out-of-band things with the export server""" """do out-of-band things with the export server."""
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -18,6 +18,6 @@ import requests
def get_ipydrawio_export_status(url): def get_ipydrawio_export_status(url):
"""get the ipydrawio export status""" """Get the ipydrawio export status."""
r = requests.get(url) r = requests.get(url)
return r.json() return r.json()

Wyświetl plik

@ -1,6 +1,6 @@
"""get a random port""" """get a random port."""
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -35,12 +35,15 @@ def get_unused_port() -> int:
def wait_for_url_status( def wait_for_url_status(
url: str, status_code: int, interval_sec: float = 0.1, attempts: int = 100 url: str,
status_code: int,
interval_sec: float = 0.1,
attempts: int = 100,
) -> bool: ) -> bool:
"""Attempt to fetch from the URL until, or raise an""" """Attempt to fetch from the URL until, or raise an."""
response = None response = None
for i in range(attempts): for _i in range(attempts):
try: try:
response = urllib.request.urlopen(url) response = urllib.request.urlopen(url)
if response.status == status_code: if response.status == status_code:
@ -52,7 +55,7 @@ def wait_for_url_status(
if not response or response.status != status_code: if not response or response.status != status_code:
raise RuntimeError( raise RuntimeError(
f"{url} did return {status_code} within {interval_sec * attempts}s" f"{url} did return {status_code} within {interval_sec * attempts}s",
) )
return True return True

Wyświetl plik

@ -1,4 +1,4 @@
{% set version = "1.2.3" %} {% set version = "1.3.0" %}
{% set build_number = 0 %} {% set build_number = 0 %}
@ -39,9 +39,9 @@ build:
requirements: requirements:
host: host:
- pip - pip
- python >=3.7 - python >=3.8
run: run:
- python >=3.7 - python >=3.8
test: test:
commands: commands:
@ -58,10 +58,11 @@ outputs:
requirements: requirements:
host: host:
- pip - pip
- python >=3.7 - python >=3.8
run: run:
- ipywidgets >=7.6,<9 - ipywidgets >=7.6,<9
- python >=3.7 - jsonschema
- python >=3.8
test: test:
source_files: source_files:
- ipydrawio-widgets/tests - ipydrawio-widgets/tests
@ -91,13 +92,13 @@ outputs:
requirements: requirements:
host: host:
- pip - pip
- python >=3.7 - python >=3.8
run: run:
- {{ pin_subpackage("ipydrawio-widgets", max_pin="x.x.x") }} - {{ pin_subpackage("ipydrawio-widgets", max_pin="x.x.x") }}
- jupyterlab ==3.* - jupyterlab ==3.*
- jupyterlab_widgets >=1 - jupyterlab_widgets >=1
- lxml - lxml
- python >=3.7 - python >=3.8
test: test:
source_files: source_files:
- ipydrawio/tests - ipydrawio/tests
@ -138,10 +139,10 @@ outputs:
requirements: requirements:
host: host:
- pip - pip
- python >=3.7 - python >=3.8
run: run:
- {{ pin_subpackage("ipydrawio", max_pin="x.x.x") }} - {{ pin_subpackage("ipydrawio", max_pin="x.x.x") }}
- python >=3.7 - python >=3.8
test: test:
source_files: source_files:
- ipydrawio-mathjax/tests - ipydrawio-mathjax/tests
@ -151,6 +152,7 @@ outputs:
- m2-grep # [win] - m2-grep # [win]
- pip - pip
- pytest - pytest
- pytest-jupyter-server
commands: commands:
- pip check - pip check
- jupyter labextension list - jupyter labextension list
@ -177,14 +179,14 @@ outputs:
requirements: requirements:
host: host:
- pip - pip
- python >=3.7 - python >=3.8
run: run:
- {{ pin_subpackage("ipydrawio", max_pin="x.x.x") }} - {{ pin_subpackage("ipydrawio", max_pin="x.x.x") }}
- lxml - lxml
- nodejs - nodejs
- pillow - pillow
- pypdf2 - pypdf >=3.5
- python >=3.7 - python >=3.8
- requests_cache - requests_cache
test: test:
source_files: source_files:
@ -195,6 +197,7 @@ outputs:
- pip - pip
- pytest-console-scripts # [unix] - pytest-console-scripts # [unix]
- pytest-tornasync # [unix] - pytest-tornasync # [unix]
- pytest-jupyter-server # [unix]
- m2-grep # [win] - m2-grep # [win]
commands: commands:
- pip check - pip check
@ -213,6 +216,7 @@ outputs:
license_file: license_file:
- ipydrawio-export/LICENSE.txt - ipydrawio-export/LICENSE.txt
- ipydrawio-export/_/ipydrawio-pdf/static/third-party-licenses.json - ipydrawio-export/_/ipydrawio-pdf/static/third-party-licenses.json
- ipydrawio-export/src/ipydrawio_export/vendor/draw-image-export2/LICENSE
about: about:
home: https://github.com/deathbeds/ipydrawio home: https://github.com/deathbeds/ipydrawio

Wyświetl plik

@ -1,23 +1,22 @@
{ {
"LiteBuildConfig": { "LiteBuildConfig": {
"federated_extensions": [ "federated_extensions": [
"../py_packages/ipydrawio/dist/ipydrawio-1.2.3-py3-none-any.whl", "../py_packages/ipydrawio/dist/ipydrawio-1.3.0-py3-none-any.whl",
"https://conda.anaconda.org/conda-forge/noarch/bqplot-0.12.36-pyhd8ed1ab_0.tar.bz2", "https://conda.anaconda.org/conda-forge/noarch/bqplot-0.12.38-pyhd8ed1ab_0.conda",
"https://conda.anaconda.org/conda-forge/noarch/jupyterlab-tour-3.1.4-pyhd8ed1ab_0.tar.bz2", "https://conda.anaconda.org/conda-forge/noarch/jupyterlab-tour-3.1.4-pyhd8ed1ab_0.tar.bz2",
"https://conda.anaconda.org/conda-forge/noarch/jupyterlab-webrtc-docprovider-0.1.1-pyhd8ed1ab_0.tar.bz2", "https://conda.anaconda.org/conda-forge/noarch/jupyterlab-webrtc-docprovider-0.1.1-pyhd8ed1ab_0.tar.bz2",
"https://conda.anaconda.org/conda-forge/noarch/jupyterlab_widgets-3.0.3-pyhd8ed1ab_0.tar.bz2", "https://conda.anaconda.org/conda-forge/noarch/jupyterlab_widgets-3.0.7-pyhd8ed1ab_0.conda",
"https://conda.anaconda.org/conda-forge/noarch/wxyz_datagrid-0.5.1-pyhd8ed1ab_0.tar.bz2", "https://conda.anaconda.org/conda-forge/noarch/jupyterlite-javascript-kernel-0.1.0-pyhd8ed1ab_0.conda",
"https://conda.anaconda.org/conda-forge/noarch/wxyz_json_schema_form-0.5.1-pyhd8ed1ab_0.tar.bz2", "https://conda.anaconda.org/conda-forge/noarch/jupyterlite-pyodide-kernel-0.0.6-pyhd8ed1ab_0.conda"
"https://conda.anaconda.org/conda-forge/noarch/wxyz_lab-0.5.1-pyhd8ed1ab_0.tar.bz2",
"https://conda.anaconda.org/conda-forge/noarch/wxyz_svg-0.5.1-pyhd8ed1ab_0.tar.bz2"
], ],
"ignore_sys_prefix": true, "ignore_sys_prefix": true,
"lite_dir": ".", "lite_dir": ".",
"output_archive": "../build/demo/ipydrawio-lite-1.2.3.tgz", "output_archive": "../build/demo/ipydrawio-lite-1.3.0.tgz",
"output_dir": "../build/demo", "output_dir": "../build/demo"
},
"PipliteAddon": {
"piplite_urls": [ "piplite_urls": [
"../py_packages/ipydrawio-widgets/dist/ipydrawio_widgets-1.2.3-py3-none-any.whl", "../py_packages/ipydrawio-widgets/dist/ipydrawio_widgets-1.3.0-py3-none-any.whl"
"../demo/mocks/widgetsnbextension/dist/widgetsnbextension-4.0.2-py3-none-any.whl"
] ]
} }
} }

Wyświetl plik

@ -1,29 +0,0 @@
BSD 3-Clause License
Copyright (c) 2022, JupyterLite Contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Wyświetl plik

@ -1,4 +0,0 @@
# widgetsnbextension mock
This is an widgetsnbextension mock that provides nothing. It's only there so that
`piplite.install('widgetsnbextension')` does not fail (for ipywidgets support)

Wyświetl plik

@ -1,18 +0,0 @@
[build-system]
requires = ["flit_core >=3.7.1,<4"]
build-backend = "flit_core.buildapi"
[project]
name = "widgetsnbextension"
authors = [
{name = "JupyterLite Contributors"},
]
readme = "README.md"
requires-python = ">=3.10,<3.11"
dynamic = ["version", "description"]
classifiers = [
"License :: OSI Approved :: BSD License",
]
[project.urls]
Source = "https://github.com/jupyterlite/jupyterlite"

Wyświetl plik

@ -1,3 +0,0 @@
"""A widgetsnbextension mock"""
__version__ = "4.0.2"

Wyświetl plik

@ -17,7 +17,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from IPython.display import display, update_display" "from IPython.display import display"
] ]
}, },
{ {
@ -56,9 +56,9 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"def display_drawio(xml, **kwargs):\n", "def display_drawio(xml, **kwargs):\n",
" \"\"\" Send some xml to the frontend\n", " \"\"\"Send some xml to the frontend\n",
" \n", "\n",
" Get a handle to update later by calling `display_drawio` with `display_id=True` \n", " Get a handle to update later by calling `display_drawio` with `display_id=True`\n",
" \"\"\"\n", " \"\"\"\n",
" return display({MIMETYPE: xml}, raw=True, **kwargs)" " return display({MIMETYPE: xml}, raw=True, **kwargs)"
] ]
@ -97,9 +97,12 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"handle = display_drawio(\"\", metadata={\n", "handle = display_drawio(\n",
" MIMETYPE: dict(height=\"200px\", drawioUrlParams=dict(ui=\"dark\", chrome=0))\n", " \"\",\n",
"})" " metadata={\n",
" MIMETYPE: {\"height\": \"200px\", \"drawioUrlParams\": {\"ui\": \"dark\", \"chrome\": 0}},\n",
" },\n",
")"
] ]
} }
], ],

Wyświetl plik

@ -19,8 +19,8 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"try: await __import__(\"piplite\").install('ipydrawio-widgets'); \n", "if __name__ == \"__main__\" and \"pyodide\" in __import__(\"sys\").modules:\n",
"except: pass" " %pip install -q ipydrawio-widgets"
] ]
}, },
{ {
@ -30,12 +30,22 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from ipywidgets import HBox, VBox, Textarea, jslink, jsdlink, FloatSlider, IntSlider, Checkbox, Text, SelectMultiple, Accordion\n",
"from lxml import etree\n",
"from traitlets import observe, link, dlink\n",
"from ipydrawio_widgets import Diagram\n", "from ipydrawio_widgets import Diagram\n",
"from ipywidgets import (\n",
" Accordion,\n",
" Checkbox,\n",
" FloatSlider,\n",
" HBox,\n",
" IntSlider,\n",
" SelectMultiple,\n",
" Text,\n",
" Textarea,\n",
" VBox,\n",
" jslink,\n",
")\n",
"from traitlets import dlink, link\n",
"\n", "\n",
"diagram = Diagram(layout=dict(min_height=\"80vh\", flex=\"1\"))\n", "diagram = Diagram(layout={\"min_height\": \"80vh\", \"flex\": \"1\"})\n",
"box = HBox([diagram])\n", "box = HBox([diagram])\n",
"box" "box"
] ]
@ -59,7 +69,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"Diagram(source=diagram.source, layout=dict(min_height=\"400px\"))" "Diagram(source=diagram.source, layout={\"min_height\": \"400px\"})"
] ]
}, },
{ {
@ -69,7 +79,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"diagram.source.value = '''<mxfile version=\"13.6.10\">\n", "diagram.source.value = \"\"\"<mxfile version=\"13.6.10\">\n",
" <diagram id=\"x\" name=\"Page-1\">\n", " <diagram id=\"x\" name=\"Page-1\">\n",
" <mxGraphModel dx=\"1164\" dy=\"293\" grid=\"1\" gridSize=\"10\" guides=\"1\" tooltips=\"1\" connect=\"1\" arrows=\"1\" fold=\"1\" page=\"1\" pageScale=\"1\" pageWidth=\"850\" pageHeight=\"1100\" math=\"0\" shadow=\"0\">\n", " <mxGraphModel dx=\"1164\" dy=\"293\" grid=\"1\" gridSize=\"10\" guides=\"1\" tooltips=\"1\" connect=\"1\" arrows=\"1\" fold=\"1\" page=\"1\" pageScale=\"1\" pageWidth=\"850\" pageHeight=\"1100\" math=\"0\" shadow=\"0\">\n",
" <root>\n", " <root>\n",
@ -97,7 +107,7 @@
" </root>\n", " </root>\n",
" </mxGraphModel>\n", " </mxGraphModel>\n",
" </diagram>\n", " </diagram>\n",
"</mxfile>'''" "</mxfile>\"\"\""
] ]
}, },
{ {
@ -147,7 +157,9 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"zoom = FloatSlider(description=\"zoom\", min=0.01)\n", "zoom = FloatSlider(description=\"zoom\", min=0.01)\n",
"scroll_x, scroll_y = [FloatSlider(description=f\"scroll {x}\", min=-1e5, max=1e5) for x in \"xy\"]\n", "scroll_x, scroll_y = (\n",
" FloatSlider(description=f\"scroll {x}\", min=-1e5, max=1e5) for x in \"xy\"\n",
")\n",
"current_page = IntSlider(description=\"page\")\n", "current_page = IntSlider(description=\"page\")\n",
"jslink((diagram, \"zoom\"), (zoom, \"value\"))\n", "jslink((diagram, \"zoom\"), (zoom, \"value\"))\n",
"jslink((diagram, \"scroll_x\"), (scroll_x, \"value\"))\n", "jslink((diagram, \"scroll_x\"), (scroll_x, \"value\"))\n",
@ -170,7 +182,11 @@
"dlink((diagram, \"cell_ids\"), (selected_cells, \"options\"))\n", "dlink((diagram, \"cell_ids\"), (selected_cells, \"options\"))\n",
"link((diagram, \"selected_cells\"), (selected_cells, \"value\"))\n", "link((diagram, \"selected_cells\"), (selected_cells, \"value\"))\n",
"\n", "\n",
"controls.children = [VBox([zoom, scroll_x, scroll_y, current_page]), VBox([selected_cells]), value]\n", "controls.children = [\n",
" VBox([zoom, scroll_x, scroll_y, current_page]),\n",
" VBox([selected_cells]),\n",
" value,\n",
"]\n",
"controls._titles = {\"0\": \"ui\", \"1\": \"selection\", \"2\": \"value\"}\n", "controls._titles = {\"0\": \"ui\", \"1\": \"selection\", \"2\": \"value\"}\n",
"\n", "\n",
"HBox([selected_cells])" "HBox([selected_cells])"
@ -194,23 +210,29 @@
"source": [ "source": [
"page_format = {\n", "page_format = {\n",
" k: IntSlider(description=k, value=v, min=0, max=1e5)\n", " k: IntSlider(description=k, value=v, min=0, max=1e5)\n",
" for k,v in diagram.page_format.items()\n", " for k, v in diagram.page_format.items()\n",
"}\n", "}\n",
"\n", "\n",
"\n",
"def update_format(*_):\n", "def update_format(*_):\n",
" diagram.page_format = {\n", " diagram.page_format = {k: v.value for k, v in page_format.items()}\n",
" k: v.value for k, v in page_format.items()\n", "\n",
" }\n",
"\n", "\n",
"def update_sliders(*_):\n", "def update_sliders(*_):\n",
" for k, v in page_format.items():\n", " for k, v in page_format.items():\n",
" v.value = diagram.page_format[k]\n", " v.value = diagram.page_format[k]\n",
" \n", "\n",
"\n",
"[v.observe(update_format, \"value\") for k, v in page_format.items()]\n", "[v.observe(update_format, \"value\") for k, v in page_format.items()]\n",
"[diagram.observe(update_sliders, \"page_format\")]\n", "[diagram.observe(update_sliders, \"page_format\")]\n",
"\n", "\n",
"\n", "\n",
"controls.children = [VBox([zoom, scroll_x, scroll_y, current_page]), VBox([selected_cells]), VBox([*page_format.values()]), value]\n", "controls.children = [\n",
" VBox([zoom, scroll_x, scroll_y, current_page]),\n",
" VBox([selected_cells]),\n",
" VBox([*page_format.values()]),\n",
" value,\n",
"]\n",
"controls._titles = {\"0\": \"ui\", \"1\": \"selection\", \"2\": \"page\", \"3\": \"value\"}" "controls._titles = {\"0\": \"ui\", \"1\": \"selection\", \"2\": \"page\", \"3\": \"value\"}"
] ]
}, },
@ -238,8 +260,14 @@
"jslink((diagram, \"grid_size\"), (grid_size, \"value\"))\n", "jslink((diagram, \"grid_size\"), (grid_size, \"value\"))\n",
"jslink((diagram, \"grid_color\"), (grid_color, \"value\"))\n", "jslink((diagram, \"grid_color\"), (grid_color, \"value\"))\n",
"\n", "\n",
"controls.children = [VBox([zoom, scroll_x, scroll_y, current_page]), VBox([selected_cells]), VBox([*page_format.values()]), VBox([ grid_enabled, grid_size, grid_color]), value]\n", "controls.children = [\n",
"controls._titles = {\"0\": \"ui\", \"1\": \"selection\", \"2\": \"page\", \"3\":\"grid\", \"4\": \"value\"}" " VBox([zoom, scroll_x, scroll_y, current_page]),\n",
" VBox([selected_cells]),\n",
" VBox([*page_format.values()]),\n",
" VBox([grid_enabled, grid_size, grid_color]),\n",
" value,\n",
"]\n",
"controls._titles = {\"0\": \"ui\", \"1\": \"selection\", \"2\": \"page\", \"3\": \"grid\", \"4\": \"value\"}"
] ]
} }
], ],
@ -259,7 +287,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.11.0" "version": "3.11.3"
} }
}, },
"nbformat": 4, "nbformat": 4,

33
docs/_static/anvil.svg vendored 100644
Wyświetl plik

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg4"
version="1.1"
viewBox="0 0 24 24">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<path
style="fill:#ffffff"
d="M 8.206,5.866 8.211,6.262 H 6.754 L 6.76,6.917 V 6.922 L 0.002,6.924 V 7.135 L 0,7.973 0.02,8.014 c 0.212,0.467 0.663,0.901 1.257,1.313 0.594,0.411 1.335,0.796 2.145,1.13 1.62,0.664 3.502,1.12 5.006,1.1 0.746,-0.01 1.265,0.228 1.62,0.672 0.341,0.426 0.51,1.092 0.524,1.92 l -2.632,2.09 0.008,1.896 H 20.29 l -0.004,-1.76 -2.63,-2.22 c 0.055,-2.013 0.708,-3.443 1.777,-4.405 1.087,-0.979 2.61,-1.49 4.37,-1.616 L 23.998,8.119 24,5.872 Z m 0.009,5.222 c -5.4766667,8.608 -2.7383333,4.304 0,0 z"
id="path4533" />
<path
fill="#616161"
id="path2"
d="M8.206 5.866l.005.396H6.754l.006.655v.005l-6.758.002v.211L0 7.973l.02.041c.212.467.663.901 1.257 1.313.594.411 1.335.796 2.145 1.13 1.62.664 3.502 1.12 5.006 1.1.746-.01 1.265.228 1.62.672.341.426.51 1.092.524 1.92L7.94 16.239l.008 1.896H20.29l-.004-1.76-2.63-2.22c.055-2.013.708-3.443 1.777-4.405 1.087-.979 2.61-1.49 4.37-1.616l.195-.015L24 5.872zm.425.422l14.946.006-.004 1.457c-1.737.155-3.29.666-4.424 1.685-.912.822-1.433 2.062-1.691 3.534l-1.617.004.002.422 1.535-.004c-.027.226-.113.4-.123.64l-.893-.003-.002.422.995.004 2.138 1.802-2.941.002c-.724-.675-1.552-1.116-2.416-1.158-.817-.04-1.638.324-2.387 1.04l-2.978-.024 2.248-1.781v-.102c.002-.943-.2-1.72-.64-2.269-.396-.496-1.007-.749-1.741-.79l-.008-4.49h.008zm-1.45.396h1.026l.008 4.404c-1.387-.02-3.125-.404-4.631-1.023-.787-.324-1.507-.698-2.066-1.086C.968 8.6.587 8.203.424 7.86v-.514l6.336-.002v2.16h.422v-2.16h.004l-.004-.435v-.226zm6.935 8.839c.75.037 1.503.436 2.18 1.078l-.002 1.112h-4.345l-.006-1.2c.706-.717 1.443-1.026 2.173-.99zM8.36 16.537l3.16.023.006 1.153h-3.16zm11.5.142l.002 1.034h-3.148V16.68z" />
</svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.3 KiB

Wyświetl plik

@ -1,5 +1,5 @@
/** /**
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -3,8 +3,6 @@
href="{{ pathto('demo/index') }}" href="{{ pathto('demo/index') }}"
class="btn btn-primary" class="btn btn-primary"
target="_blank" target="_blank"
data-toggle="tooltip"
data-placement="right"
title="Try IPyDrawio in your browser. Right now." title="Try IPyDrawio in your browser. Right now."
id="demo-room-button" id="demo-room-button"
> >
@ -24,8 +22,6 @@
<br/> <br/>
or <a or <a
href="{{ pathto(demo_tarball, True) }}" href="{{ pathto(demo_tarball, True) }}"
data-toggle="tooltip"
data-placement="bottom"
title="Download the app archive" title="Download the app archive"
> >
<i class="fas fa-download"></i> <i class="fas fa-download"></i>
@ -46,7 +42,6 @@
$("#demo-app-label").text(useRetro ? ` in RetroLab` : ''); $("#demo-app-label").text(useRetro ? ` in RetroLab` : '');
$("#demo-room-label").text(room ? ` with ${room}` : ''); $("#demo-room-label").text(room ? ` with ${room}` : '');
} }
$('[data-toggle="tooltip"]').tooltip();
$('#demo-app').on('change', updateUrl); $('#demo-app').on('change', updateUrl);
$("#demo-room-name").on('input', updateUrl); $("#demo-room-name").on('input', updateUrl);
});</script> });</script>

Wyświetl plik

@ -3,7 +3,7 @@
``` ```
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -3,7 +3,7 @@
``` ```
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -6,7 +6,7 @@ changelog
``` ```
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

52
docs/api/export.md 100644
Wyświetl plik

@ -0,0 +1,52 @@
# Export
## Constants
```{eval-rst}
.. currentmodule:: ipydrawio_export
.. automodule:: ipydrawio_export.constants
```
## Manager
```{eval-rst}
.. currentmodule:: ipydrawio_export
.. automodule:: ipydrawio_export.manager
```
## App
```{eval-rst}
.. currentmodule:: ipydrawio_export
.. automodule:: ipydrawio_export.app
```
## Handlers
```{eval-rst}
.. currentmodule:: ipydrawio_export
.. automodule:: ipydrawio_export.handlers
```
## Extension
```{eval-rst}
.. currentmodule:: ipydrawio_export
.. automodule:: ipydrawio_export.serverextension
```
<!--
# Copyright 2023 ipydrawio contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-->

Wyświetl plik

@ -1,13 +1,15 @@
# API # API
```{toctree} ```{toctree}
:maxdepth: 2
schema schema
widgets widgets
export
ts/index ts/index
``` ```
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,4 +1,12 @@
# Copyright 2022 ipydrawio contributors # Widgets
```{eval-rst}
.. currentmodule:: ipydrawio_widgets
.. automodule:: ipydrawio_widgets.widget_diagram
```
<!--
# Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -11,11 +19,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
-->
[flake8]
max-line-length = 88
ignore = E203, E501, W503
[isort]
profile = black
multi_line_output = 3

Wyświetl plik

@ -1,9 +0,0 @@
=======
Widgets
=======
.. py:currentmodule:: ipydrawio_widgets
.. automodule:: ipydrawio_widgets.widget_diagram
:members:
:undoc-members:

Wyświetl plik

@ -1,5 +1,5 @@
"""ReadTheDocs-compatible sphinx configuration""" """ReadTheDocs-compatible sphinx configuration."""
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -17,33 +17,24 @@ import datetime
import json import json
import os import os
import re import re
import subprocess
import sys
from pathlib import Path from pathlib import Path
from sphinx.application import Sphinx from sphinx.application import Sphinx
HERE = Path(__file__).parent HERE = Path(__file__).parent
RTD = json.loads(os.environ.get("READTHEDOCS", "False").lower()) RTD = json.loads(os.environ.get("READTHEDOCS", "False").lower())
NOW = datetime.datetime.now(tz=datetime.timezone.utc).date()
sys.path += [str(HERE / "vendor")]
ROOT = HERE.parent ROOT = HERE.parent
APP_PKG = ROOT / "packages/ipydrawio/package.json" APP_PKG = ROOT / "packages/ipydrawio/package.json"
APP_DATA = json.loads(APP_PKG.read_text(encoding="utf-8")) APP_DATA = json.loads(APP_PKG.read_text(encoding="utf-8"))
RTD = json.loads(os.environ.get("READTHEDOCS", "False").lower()) RTD = json.loads(os.environ.get("READTHEDOCS", "False").lower())
RTD_TASKS = [
"build",
"setup:pip:check",
"docs:typedoc:mystify",
"demo:stage*",
"demo",
]
# metadata # metadata
author = APP_DATA["author"] author = APP_DATA["author"]
project = author.replace("Contributors", "").strip() project = author.replace("Contributors", "").strip()
copyright = f"{datetime.date.today().year}, {author}" copyright = f"{NOW.year}, {author}"
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = APP_DATA["version"] release = APP_DATA["version"]
@ -55,14 +46,17 @@ version = ".".join(release.rsplit(".", 1))
extensions = [ extensions = [
"myst_nb", "myst_nb",
"sphinx.ext.intersphinx", "sphinx.ext.intersphinx",
"sphinx.ext.autosectionlabel",
"sphinx.ext.autodoc", "sphinx.ext.autodoc",
"sphinx_copybutton",
# for routing # for routing
"sphinxext.rediraffe", "sphinxext.rediraffe",
"sphinx-jsonschema", "sphinx-jsonschema",
"autodoc_traits", "autodoc_traits",
] ]
# content
autosummary_generate = True
autosectionlabel_prefix_document = True autosectionlabel_prefix_document = True
myst_heading_anchors = 3 myst_heading_anchors = 3
suppress_warnings = ["autosectionlabel.*"] suppress_warnings = ["autosectionlabel.*"]
@ -72,6 +66,14 @@ rediraffe_redirects = {
"demo/retro/index": "_static/retro/tree/index", "demo/retro/index": "_static/retro/tree/index",
} }
autodoc_typehints = "none"
autodoc_default_options = {
"members": True,
"show-inheritance": True,
"undoc-members": True,
}
inheritance_alias = {}
# files # files
templates_path = ["_templates"] templates_path = ["_templates"]
html_favicon = "_static/favicon.ico" html_favicon = "_static/favicon.ico"
@ -96,17 +98,36 @@ html_css_files = [
html_theme = "pydata_sphinx_theme" html_theme = "pydata_sphinx_theme"
html_logo = "_static/logo.svg" html_logo = "_static/logo.svg"
html_theme_options = { html_theme_options = {
"github_url": APP_DATA["repository"]["url"],
"use_edit_page_button": True, "use_edit_page_button": True,
# "navbar_start": ["navbar-logo.html", "launch.html"], "icon_links": [
{
"name": "PyPI",
"url": "https://pypi.org/project/ipydrawio",
"icon": "fa-brands fa-python",
},
{
"name": "Conda Forge",
"url": "https://github.com/conda-forge/ipydrawio-feedstock",
"icon": "./_static/anvil.svg",
"type": "local",
},
{
"name": "GitHub",
"url": APP_DATA["repository"]["url"],
"icon": "fa-brands fa-github",
},
],
"pygment_light_style": "gotthard-light",
"pygment_dark_style": "gotthard-dark",
} }
html_sidebars = { html_sidebars = {
"**": [ "**": [
"demo.html", "demo.html",
"search-field.html", "search-field.html",
"sidebar-nav-bs.html", "sidebar-nav-bs.html",
"sidebar-ethical-ads.html", "sidebar-ethical-ads.html",
] ],
} }
html_context = { html_context = {
@ -124,6 +145,10 @@ intersphinx_mapping = {
"ipywidgets": ("https://ipywidgets.readthedocs.io/en/stable/", None), "ipywidgets": ("https://ipywidgets.readthedocs.io/en/stable/", None),
} }
suppress_warnings = [
"mystnb.unknown_mime_type",
]
def clean_schema(app: Sphinx, error): def clean_schema(app: Sphinx, error):
if error: if error:
@ -135,14 +160,5 @@ def clean_schema(app: Sphinx, error):
schema_html.write_text(new_text, encoding="utf-8") schema_html.write_text(new_text, encoding="utf-8")
def before_rtd_build(app: Sphinx, error):
"""performs the full frontend build, and ensures the typedoc"""
for task in RTD_TASKS:
print(f"running doit {task}", flush=True)
subprocess.check_call(["doit", task], cwd=str(ROOT))
def setup(app): def setup(app):
app.connect("build-finished", clean_schema) app.connect("build-finished", clean_schema)
if RTD:
app.connect("config-inited", before_rtd_build)

Wyświetl plik

@ -18,7 +18,7 @@ displays] and [widgets].
``` ```
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
# ReadTheDocs-ready environment, assuming CONDA_USE_MAMBA feature flag # ReadTheDocs-ready environment, assuming CONDA_USE_MAMBA feature flag
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -23,19 +23,22 @@ channels:
dependencies: dependencies:
### ipydrawio-docs-deps ### ### ipydrawio-docs-deps ###
- autodoc-traits
- docutils >=0.18.1 - docutils >=0.18.1
- jupyter-server-mathjax - jupyter-server-mathjax
- jupyterlab-myst - jupyterlite-core ==0.1.0
- jupyterlite-core-with-libarchive
- jupyterlite-pyodide-kernel ==0.0.6
- myst-nb - myst-nb
- pkginfo - pkginfo
- pydata-sphinx-theme >=0.10.1,<0.11.0 - pydata-sphinx-theme >=0.13.3,<0.14.0
- pytest-check-links - pytest-check-links
- python-libarchive-c
- sphinx >=5,<6 - sphinx >=5,<6
- sphinx-copybutton
- sphinx-design
- sphinx-jsonschema - sphinx-jsonschema
- sphinxext-rediraffe - sphinxext-rediraffe
- ssort
- pip:
- jupyterlite ==0.1.0b14
### ipydrawio-docs-deps ### ### ipydrawio-docs-deps ###
@ -45,15 +48,15 @@ dependencies:
# core # core
- doit - doit
- nodejs >=16,<17 - nodejs >=18,<19
- python # this gets patched in ci - python # this gets patched in ci
# run # run
- ipywidgets >=7.6,<9 - ipywidgets >=7.6,<9
- jupyterlab >=3.5.0,<4.0.0a0 - jupyterlab >=3.6.3,<4.0.0a0
- jupyterlab_widgets >=1 - jupyterlab_widgets >=1
- lxml - lxml
- pillow - pillow
- pypdf2 - pypdf >=3.5
- requests_cache - requests_cache
# building # building
- flit >=3.7.1 - flit >=3.7.1
@ -61,17 +64,18 @@ dependencies:
- twine >=3.7.1 - twine >=3.7.1
- wheel - wheel
# linting # linting
- black - black-jupyter
- flake8 - nbqa
- isort >=5
- pyflakes
- pyyaml - pyyaml
- robotframework-lint
- robotframework-tidy - robotframework-tidy
- robotframework-robocop
- ruff
- ssort
# unit testing # unit testing
- pytest - pytest
- pytest-console-scripts - pytest-console-scripts
- pytest-html - pytest-html
- pytest-jupyter-server
- pytest-tornasync - pytest-tornasync
- pytest-xdist - pytest-xdist
# acceptance testing # acceptance testing

Wyświetl plik

@ -14,9 +14,17 @@ Install `ipydrawio` (and optionally `ipydrawio-export`) with `pip`, `mamba`, or
```bash ```bash
pip install ipydrawio[all] pip install ipydrawio[all]
# or ```
or...
```bash
mamba install -c conda-forge ipydrawio # ipydrawio-export mamba install -c conda-forge ipydrawio # ipydrawio-export
# or ```
or...
```bash
conda install -c conda-forge ipydrawio # ipydrawio-export conda install -c conda-forge ipydrawio # ipydrawio-export
``` ```
@ -42,8 +50,6 @@ Click the _Try IPyDrawio Now_ button to launch a new browser tab running IPyDraw
JupyterLite. It contains all of the example _Diagrams_ from this documentation site, and JupyterLite. It contains all of the example _Diagrams_ from this documentation site, and
some notebooks that show what's posssible. some notebooks that show what's posssible.
[demo]: ./demo/index
--- ---
## Features ## Features
@ -54,7 +60,7 @@ some notebooks that show what's posssible.
## More Screenshots and Examples ## More Screenshots and Examples
> these are editable SVG files made with IPyDrawio, and can be found in the [demo]. > these are editable SVG files made with IPyDrawio, and can be found in the demo.
### What can you draw with IPyDrawio ### What can you draw with IPyDrawio
@ -76,7 +82,7 @@ about/contributing
``` ```
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -291,8 +291,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import lxml.etree as ET\n", "from pathlib import Path\n",
"from pathlib import Path" "\n",
"import lxml.etree as ET"
] ]
}, },
{ {
@ -313,7 +314,7 @@
"packages = {\n", "packages = {\n",
" \"#dae8fc\": \"ipydrawio\",\n", " \"#dae8fc\": \"ipydrawio\",\n",
" \"#f8cecc\": \"ipydrawio_export\",\n", " \"#f8cecc\": \"ipydrawio_export\",\n",
" \"#d5e8d4\": \"ipydrawio_mathjax\"\n", " \"#d5e8d4\": \"ipydrawio_mathjax\",\n",
"}" "}"
] ]
}, },
@ -326,9 +327,7 @@
"source": [ "source": [
"ships = {\n", "ships = {\n",
" py_pkg: {\n", " py_pkg: {\n",
" js_pkg[\"dest\"]\n", " js_pkg[\"dest\"] for js_pkg in __import__(py_pkg)._jupyter_labextension_paths()\n",
" for js_pkg\n",
" in __import__(py_pkg)._jupyter_labextension_paths()\n",
" }\n", " }\n",
" for fill, py_pkg in packages.items()\n", " for fill, py_pkg in packages.items()\n",
"}" "}"
@ -343,21 +342,21 @@
"source": [ "source": [
"def test_deployment(\n", "def test_deployment(\n",
" ns=\"@deathbeds/\",\n", " ns=\"@deathbeds/\",\n",
" diagram=\"../../_static/tutorials/designing-jupyter-extensions/deployment.dio.svg\"\n", " diagram=\"../../_static/tutorials/designing-jupyter-extensions/deployment.dio.svg\",\n",
"):\n", "):\n",
" deployment = Path(diagram)\n", " deployment = Path(diagram)\n",
" et = ET.fromstring(deployment.read_text(encoding=\"utf-8\"))\n", " et = ET.fromstring(deployment.read_text(encoding=\"utf-8\"))\n",
" # get everything with a data-label, which gets preserved\n", " # get everything with a data-label, which gets preserved\n",
" should_ship_in = {\n", " should_ship_in = {\n",
" f\"\"\"{ns}{e.attrib[\"data-label\"]}\"\"\":\n", " f\"\"\"{ns}{e.attrib[\"data-label\"]}\"\"\": packages.get(e.xpath(\"./*[1]/@fill\")[0])\n",
" packages.get(e.xpath(\"./*[1]/@fill\")[0])\n",
" for e in et.xpath(\"//*[@data-label]\")\n", " for e in et.xpath(\"//*[@data-label]\")\n",
" }\n", " }\n",
" for py_package, ships_exts in ships.items():\n", " for py_package, ships_exts in ships.items():\n",
" print(py_package)\n", " print(py_package)\n",
" print(\"... observed\", sorted(ships_exts))\n", " print(\"... observed\", sorted(ships_exts))\n",
" should_ship_exts = {\n", " should_ship_exts = {\n",
" js_name for js_name, py_name in should_ship_in.items()\n", " js_name\n",
" for js_name, py_name in should_ship_in.items()\n",
" if py_name == py_package\n", " if py_name == py_package\n",
" }\n", " }\n",
" print(\"... expected\", sorted(should_ship_exts))\n", " print(\"... expected\", sorted(should_ship_exts))\n",

Wyświetl plik

@ -7,7 +7,7 @@ working-with-custom-libraries/index
``` ```
<!-- <!--
# Copyright 2022 ipydrawio contributors # Copyright 2023 ipydrawio contributors
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.

Wyświetl plik

@ -16,10 +16,16 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "ff64bdc4-2dd5-4738-affc-36dab7c82584", "id": "ff64bdc4-2dd5-4738-affc-36dab7c82584",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"import base64, json, urllib.parse, zlib\n", "import base64\n",
"import json\n",
"import urllib.parse\n",
"import zlib\n",
"\n",
"import ipydrawio" "import ipydrawio"
] ]
}, },
@ -36,7 +42,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "8c582ec1-23ca-4e76-8733-cf8d8d7d8b46", "id": "8c582ec1-23ca-4e76-8733-cf8d8d7d8b46",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"library = [\n", "library = [\n",
@ -68,7 +76,7 @@
" \"title\": \"Exit\",\n", " \"title\": \"Exit\",\n",
" \"xml\": '<mxGraphModel><root><mxCell id=\"0\"/><mxCell id=\"1\" parent=\"0\"/><object label=\"\" type=\"Exit\" id=\"2\"><mxCell style=\"rhombus;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object></root></mxGraphModel>',\n", " \"xml\": '<mxGraphModel><root><mxCell id=\"0\"/><mxCell id=\"1\" parent=\"0\"/><object label=\"\" type=\"Exit\" id=\"2\"><mxCell style=\"rhombus;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object></root></mxGraphModel>',\n",
" },\n", " },\n",
"]\n" "]"
] ]
}, },
{ {
@ -91,18 +99,26 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "3e9a519c-a868-4d71-885e-fcafe41915fa", "id": "3e9a519c-a868-4d71-885e-fcafe41915fa",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"zlib_opts = dict(wbits=-15)\n", "zlib_opts = {\"wbits\": -15}\n",
"\n",
"\n", "\n",
"def inflate(deflated):\n", "def inflate(deflated):\n",
" infl = zlib.decompressobj(**zlib_opts)\n", " infl = zlib.decompressobj(**zlib_opts)\n",
" return urllib.parse.unquote(infl.decompress(base64.b64decode(deflated)) + infl.flush())\n", " return urllib.parse.unquote(\n",
" infl.decompress(base64.b64decode(deflated)) + infl.flush(),\n",
" )\n",
"\n",
"\n", "\n",
"def deflate(inflated):\n", "def deflate(inflated):\n",
" defl = zlib.compressobj(**zlib_opts)\n", " defl = zlib.compressobj(**zlib_opts)\n",
" return base64.b64encode(defl.compress(urllib.parse.quote(inflated).encode(\"utf-8\")) + defl.flush()).decode('utf-8')" " return base64.b64encode(\n",
" defl.compress(urllib.parse.quote(inflated).encode(\"utf-8\")) + defl.flush(),\n",
" ).decode(\"utf-8\")"
] ]
}, },
{ {
@ -117,12 +133,14 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "63445943-ecea-441e-87f5-7d2f361b7c4d", "id": "63445943-ecea-441e-87f5-7d2f361b7c4d",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"library_json = json.dumps(\n", "library_json = json.dumps(\n",
" [dict(shape.items(), xml=deflate(shape[\"xml\"])) for shape in library],\n", " [dict(shape.items(), xml=deflate(shape[\"xml\"])) for shape in library],\n",
" separators=(\",\", \":\")\n", " separators=(\",\", \":\"),\n",
")\n", ")\n",
"library_json" "library_json"
] ]
@ -141,7 +159,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "82d193a9-2366-4df4-9263-84b65fa96c68", "id": "82d193a9-2366-4df4-9263-84b65fa96c68",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"library_xml = f\"\"\"<mxlibrary>{library_json}</mxlibrary><!-- /my library -->\"\"\"\n", "library_xml = f\"\"\"<mxlibrary>{library_json}</mxlibrary><!-- /my library -->\"\"\"\n",
@ -170,18 +190,14 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "3f062362-8691-42d9-b9d7-f4a29cf6c405", "id": "3f062362-8691-42d9-b9d7-f4a29cf6c405",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"library_data_uri = f\"data:application/xml,{library_xml}\"" "library_data_uri = f\"data:application/xml,{library_xml}\""
] ]
}, },
{
"cell_type": "markdown",
"id": "c59eeed7-8599-429e-a869-3964b4709964",
"metadata": {},
"source": []
},
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "ca0d0acc-7186-4f81-83cf-fd93da83f59c", "id": "ca0d0acc-7186-4f81-83cf-fd93da83f59c",
@ -203,11 +219,16 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "5a89ad37-caf4-4174-90f0-ba51f7c98c3b", "id": "5a89ad37-caf4-4174-90f0-ba51f7c98c3b",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"url_params = dict(ipydrawio.Diagram._default_url_params(None))\n", "url_params = dict(ipydrawio.Diagram._default_url_params(None))\n",
"url_params.update(clibs=f\"U{library_data_uri}\", stealth=\"0\",)\n", "url_params.update(\n",
" clibs=f\"U{library_data_uri}\",\n",
" stealth=\"0\",\n",
")\n",
"url_params" "url_params"
] ]
}, },
@ -225,7 +246,9 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "938af1fe-a2b5-42a0-beee-c93d910b7dfd", "id": "938af1fe-a2b5-42a0-beee-c93d910b7dfd",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"url_params.update(ui=\"min\", libs=\"0\", p=\"\")" "url_params.update(ui=\"min\", libs=\"0\", p=\"\")"
@ -243,10 +266,12 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "91835331-2f68-48af-9ca1-c2512f25ded3", "id": "91835331-2f68-48af-9ca1-c2512f25ded3",
"metadata": {}, "metadata": {
"tags": []
},
"outputs": [], "outputs": [],
"source": [ "source": [
"d = ipydrawio.Diagram(url_params=url_params, layout=dict(height=\"800px\"))\n", "d = ipydrawio.Diagram(url_params=url_params, layout={\"height\": \"800px\"})\n",
"d" "d"
] ]
}, },
@ -267,12 +292,12 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"d.source.value = '''<mxfile version=\"15.8.7\" type=\"embed\">\n", "d.source.value = \"\"\"<mxfile version=\"15.8.7\" type=\"embed\">\n",
" <diagram id=\"x\" name=\"My Diagram\">\n", " <diagram id=\"x\" name=\"My Diagram\">\n",
" <mxGraphModel dx=\"1687\" dy=\"681\" grid=\"1\" gridSize=\"10\" guides=\"1\" tooltips=\"1\" connect=\"1\" arrows=\"1\" fold=\"1\" page=\"1\" pageScale=\"1\" pageWidth=\"850\" pageHeight=\"1100\" math=\"0\" shadow=\"0\"><root><mxCell id=\"0\"/><mxCell id=\"1\" parent=\"0\"/><object label=\"apple\" type=\"Source\" interArrivalTime=\"\" id=\"2\"><mxCell style=\"rhombus;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"100\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object><object label=\"banana\" type=\"Queue\" capacity=\"\" id=\"3\"><mxCell style=\"ellipse;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"250\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object><object label=\"cherry\" type=\"Machine\" processingTime=\"\" id=\"4\"><mxCell style=\"whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"385\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object><object label=\"date\" type=\"Exit\" id=\"5\"><mxCell style=\"rhombus;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"510\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object></root>\n", " <mxGraphModel dx=\"1687\" dy=\"681\" grid=\"1\" gridSize=\"10\" guides=\"1\" tooltips=\"1\" connect=\"1\" arrows=\"1\" fold=\"1\" page=\"1\" pageScale=\"1\" pageWidth=\"850\" pageHeight=\"1100\" math=\"0\" shadow=\"0\"><root><mxCell id=\"0\"/><mxCell id=\"1\" parent=\"0\"/><object label=\"apple\" type=\"Source\" interArrivalTime=\"\" id=\"2\"><mxCell style=\"rhombus;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"100\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object><object label=\"banana\" type=\"Queue\" capacity=\"\" id=\"3\"><mxCell style=\"ellipse;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"250\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object><object label=\"cherry\" type=\"Machine\" processingTime=\"\" id=\"4\"><mxCell style=\"whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"385\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object><object label=\"date\" type=\"Exit\" id=\"5\"><mxCell style=\"rhombus;whiteSpace=wrap;html=1;\" vertex=\"1\" parent=\"1\"><mxGeometry x=\"510\" y=\"90\" width=\"80\" height=\"80\" as=\"geometry\"/></mxCell></object></root>\n",
" </mxGraphModel>\n", " </mxGraphModel>\n",
" </diagram>\n", " </diagram>\n",
"</mxfile>'''" "</mxfile>\"\"\""
] ]
} }
], ],

Wyświetl plik

@ -1,130 +0,0 @@
"""autodoc extension for traits
Copyright (c) 2013, Jason Grout
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of the PyThreeJS development team nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
from collections import OrderedDict
from traitlets import TraitType, Undefined, Container, Dict, Any, HasTraits
from sphinx.ext.autodoc import ClassDocumenter, AttributeDocumenter
def dict_info(trait):
try:
trait_base = trait._value_trait
except AttributeError:
trait_base = trait._trait
try:
traits = trait._per_key_traits
except AttributeError:
traits = trait._traits
if traits is None and (trait_base is None or isinstance(trait_base, Any)):
value_string = 'elements of any type'
else:
parts = []
if traits:
parts.append('the following types: %r' % {k: v.info() for k,v in traits})
if trait_base:
parts.append('values that are: %s' % trait_base.info())
value_string = 'elements with ' + ', and '.join(parts)
return '{} with {}'.format(trait.info(), value_string)
def extended_trait_info(trait):
if isinstance(trait, Dict):
return dict_info(trait)
elif isinstance(trait, Container):
if trait._trait is None:
return '{} of any type'.format(trait.info())
return '{} with values that are: {}'.format(trait.info(), trait._trait.info())
return trait.info()
class HasTraitsDocumenter(ClassDocumenter):
"""Specialized Documenter subclass for traits"""
objtype = 'hastraits'
directivetype = 'class'
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
return isinstance(member, HasTraits)
def get_object_members(self, want_all):
"""Add traits to members list"""
check, members = super().get_object_members(want_all)
get_traits = self.object.class_own_traits if self.options.inherited_members \
else self.object.class_traits
members_new = OrderedDict()
for m in members:
members_new[m[0]] = m[1]
traits = tuple(get_traits().items())
for name, trait in traits:
if name not in members_new:
# Don't add a member that would normally be filtered
continue
# pass # FIXME: Debugging
# put help in __doc__ where autodoc will look for it
trait.__doc__ = trait.help or extended_trait_info(getattr(self.object, name))
members_new[name] = trait
return check, [kv for kv in members_new.items()]
class TraitDocumenter(AttributeDocumenter):
objtype = 'trait'
directivetype = 'attribute'
member_order = 1
priority = 100
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
return isinstance(member, TraitType)
def format_name(self):
return self.objpath[-1]
def add_directive_header(self, sig):
default = self.object.default_value
if default is Undefined:
default_s = ''
else:
default_s = repr(default)
sig = ' = {}({})'.format(
self.object.__class__.__name__,
default_s,
)
return super().add_directive_header(sig)
def setup(app):
app.add_autodocumenter(HasTraitsDocumenter)
app.add_autodocumenter(TraitDocumenter)

863
dodo.py

Plik diff jest za duży Load Diff

Wyświetl plik

@ -1,6 +0,0 @@
{
"lerna": "6.0.1",
"npmClient": "jlpm",
"useWorkspaces": true,
"version": "independent"
}

Wyświetl plik

@ -43,7 +43,12 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import requests, IPython.display as D, pathlib as P, networkx as nx, jinja2\n", "import pathlib as P\n",
"\n",
"import IPython.display as D\n",
"import jinja2\n",
"import networkx as nx\n",
"import requests\n",
"from graphviz2drawio import graphviz2drawio" "from graphviz2drawio import graphviz2drawio"
] ]
}, },
@ -69,8 +74,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"### it's really not very pretty\n", "### it's really not very pretty"
"# D.Markdown(f\"```xml\\n{dio.read_text()}\\n```\")"
] ]
}, },
{ {
@ -88,12 +92,12 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"default_params = dict(\n", "default_params = {\n",
" format=\"pdf\",\n", " \"format\": \"pdf\",\n",
" xml=dio.read_text(),\n", " \"xml\": dio.read_text(),\n",
" allPages=\"1\",\n", " \"allPages\": \"1\",\n",
" base64=\"1\"\n", " \"base64\": \"1\",\n",
")" "}"
] ]
}, },
{ {
@ -125,10 +129,13 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"def show_pdf(**params):\n", "def show_pdf(**params):\n",
" pdf_text = get_pdf(**params) \n", " pdf_text = get_pdf(**params)\n",
" return D.HTML(f\"\"\"\n", " return D.HTML(\n",
" f\"\"\"\n",
" <iframe src=\"data:application/pdf;base64,{pdf_text}\" width=\"100%\" height=\"600px\"></iframe>\n", " <iframe src=\"data:application/pdf;base64,{pdf_text}\" width=\"100%\" height=\"600px\"></iframe>\n",
" \"\"\")\n", " \"\"\",\n",
" )\n",
"\n",
"\n", "\n",
"show_pdf()" "show_pdf()"
] ]
@ -171,6 +178,8 @@
"source": [ "source": [
"def show_pdf_from_dot(dot=some_dot, **params):\n", "def show_pdf_from_dot(dot=some_dot, **params):\n",
" return show_pdf(xml=graphviz2drawio.convert(dot), **params)\n", " return show_pdf(xml=graphviz2drawio.convert(dot), **params)\n",
"\n",
"\n",
"show_pdf_from_dot()" "show_pdf_from_dot()"
] ]
}, },
@ -205,6 +214,8 @@
"source": [ "source": [
"def show_pdf_from_networkx(graph=a_graph, **params):\n", "def show_pdf_from_networkx(graph=a_graph, **params):\n",
" return show_pdf_from_dot(str(graph))\n", " return show_pdf_from_dot(str(graph))\n",
"\n",
"\n",
"show_pdf_from_networkx()" "show_pdf_from_networkx()"
] ]
}, },
@ -222,7 +233,8 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"tmpl = jinja2.Template(\"\"\"\n", "tmpl = jinja2.Template(\n",
" \"\"\"\n",
"graph g {\n", "graph g {\n",
" layout=circo\n", " layout=circo\n",
" {% for i in range(n) %}\n", " {% for i in range(n) %}\n",
@ -237,7 +249,8 @@
" }\n", " }\n",
" {% endfor %}\n", " {% endfor %}\n",
"}\n", "}\n",
"\"\"\")\n" "\"\"\",\n",
")"
] ]
}, },
{ {

Wyświetl plik

@ -13,16 +13,25 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import base64, html, urllib.parse, pathlib as P, tempfile, asyncio, IPython, json\n", "import base64\n",
"import IPython.display as D, jinja2, babel.support as B\n", "import json\n",
"import PyPDF2, traitlets as T, ipywidgets as W, tornado.ioloop, lxml.etree as E\n", "import pathlib as P\n",
"from io import BytesIO\n", "import tempfile\n",
"import urllib.parse\n", "import urllib.parse\n",
"from PIL import Image\n",
"from nbconvert.filters.markdown_mistune import markdown2html_mistune\n",
"from tornado.concurrent import run_on_executor\n",
"from concurrent.futures import ThreadPoolExecutor\n", "from concurrent.futures import ThreadPoolExecutor\n",
"import requests, requests_cache" "from io import BytesIO\n",
"\n",
"import ipywidgets as W\n",
"import jinja2\n",
"import lxml.etree as E\n",
"import PyPDF2\n",
"import requests\n",
"import requests_cache\n",
"import tornado.ioloop\n",
"import traitlets as T\n",
"from nbconvert.filters.markdown_mistune import markdown2html_mistune\n",
"from PIL import Image\n",
"from tornado.concurrent import run_on_executor"
] ]
}, },
{ {
@ -48,21 +57,21 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"class Slides(W.HTML):\n", "class Slides(W.HTML):\n",
" \"\"\" some number of slides, as PDF\n", " \"\"\"some number of slides, as PDF\"\"\"\n",
" \"\"\"\n", "\n",
" pdf = T.Unicode()\n", " pdf = T.Unicode()\n",
" error = T.Unicode()\n", " error = T.Unicode()\n",
" \n", "\n",
" def __init__(self, *args, **kwargs):\n", " def __init__(self, *args, **kwargs):\n",
" if not kwargs.get(\"layout\"):\n", " if not kwargs.get(\"layout\"):\n",
" kwargs[\"layout\"] = dict(\n", " kwargs[\"layout\"] = {\n",
" display = \"flex\",\n", " \"display\": \"flex\",\n",
" flex_flow = \"column wrap\",\n", " \"flex_flow\": \"column wrap\",\n",
" flex = \"1\",\n", " \"flex\": \"1\",\n",
" height = \"100%\",\n", " \"height\": \"100%\",\n",
" )\n", " }\n",
" super().__init__(*args, **kwargs)\n", " super().__init__(*args, **kwargs)\n",
" \n", "\n",
" @T.observe(\"pdf\", \"error\")\n", " @T.observe(\"pdf\", \"error\")\n",
" def _on_pdf(self, change):\n", " def _on_pdf(self, change):\n",
" if self.error:\n", " if self.error:\n",
@ -71,8 +80,8 @@
" url = f\"data:application/pdf;base64,{self.pdf}\"\n", " url = f\"data:application/pdf;base64,{self.pdf}\"\n",
" self.value = f\"\"\"\n", " self.value = f\"\"\"\n",
" <a href=\"{url}\">Preview</a>\n", " <a href=\"{url}\">Preview</a>\n",
" <iframe \n", " <iframe\n",
" src=\"{url}\" \n", " src=\"{url}\"\n",
" style=\"border: 0; min-width: 400px; min-height: 400px; width: 100%; height: 100%;\">\n", " style=\"border: 0; min-width: 400px; min-height: 400px; width: 100%; height: 100%;\">\n",
" </iframe>\n", " </iframe>\n",
" \"\"\"" " \"\"\""
@ -105,19 +114,16 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"class DrawioSlides(Slides):\n", "class DrawioSlides(Slides):\n",
" \"\"\" Slides built with drawio-export from drawio XML\n", " \"\"\"Slides built with drawio-export from drawio XML\"\"\"\n",
" \"\"\"\n", "\n",
" executor = ThreadPoolExecutor(max_workers=1)\n", " executor = ThreadPoolExecutor(max_workers=1)\n",
" ipynb = T.Unicode()\n", " ipynb = T.Unicode()\n",
" xml = T.Union([T.Unicode(), T.Bytes()])\n", " xml = T.Union([T.Unicode(), T.Bytes()])\n",
" params = T.Dict()\n", " params = T.Dict()\n",
" url = T.Unicode(default_value=\"http://localhost:8000\")\n", " url = T.Unicode(default_value=\"http://localhost:8000\")\n",
" \n", "\n",
" CORE_PARAMS = dict(\n", " CORE_PARAMS = {\"format\": \"pdf\", \"base64\": \"1\"}\n",
" format=\"pdf\",\n", "\n",
" base64=\"1\"\n",
" )\n",
" \n",
" @run_on_executor\n", " @run_on_executor\n",
" def update_pdf(self):\n", " def update_pdf(self):\n",
" # this really needs to be a queue\n", " # this really needs to be a queue\n",
@ -130,20 +136,17 @@
" xml = base64.b64encode(self.xml).decode(\"utf-8\")\n", " xml = base64.b64encode(self.xml).decode(\"utf-8\")\n",
" try:\n", " try:\n",
" r = requests.post(\n", " r = requests.post(\n",
" self.url, \n", " self.url,\n",
" timeout=None,\n", " timeout=None,\n",
" data=dict(\n", " data=dict(xml=xml, **self.params, **self.CORE_PARAMS),\n",
" xml=xml, \n", " )\n",
" **self.params, \n",
" **self.CORE_PARAMS\n",
" ))\n",
" if r.status_code != 200:\n", " if r.status_code != 200:\n",
" self.error = r.text\n", " self.error = r.text\n",
" else:\n", " else:\n",
" self.pdf = r.text\n", " self.pdf = r.text\n",
" except Exception as err:\n", " except Exception as err:\n",
" self.error = str(err)\n", " self.error = str(err)\n",
" \n", "\n",
" @T.observe(\"ipynb\")\n", " @T.observe(\"ipynb\")\n",
" def _on_ipynb(self, change=None):\n", " def _on_ipynb(self, change=None):\n",
" self.error = \"\"\n", " self.error = \"\"\n",
@ -151,8 +154,7 @@
" self.xml = json.loads(self.ipynb)[\"metadata\"][\"jupyterlab-drawio\"][\"xml\"]\n", " self.xml = json.loads(self.ipynb)[\"metadata\"][\"jupyterlab-drawio\"][\"xml\"]\n",
" except Exception as err:\n", " except Exception as err:\n",
" self.error = str(err)\n", " self.error = str(err)\n",
" \n", "\n",
" \n",
" @T.observe(\"xml\")\n", " @T.observe(\"xml\")\n",
" def _on_xml(self, change=None):\n", " def _on_xml(self, change=None):\n",
" tornado.ioloop.IOLoop.current().add_callback(self.update_pdf)" " tornado.ioloop.IOLoop.current().add_callback(self.update_pdf)"
@ -285,28 +287,32 @@
"class TemplatedDrawioSlides(DrawioSlides):\n", "class TemplatedDrawioSlides(DrawioSlides):\n",
" template = T.Unicode()\n", " template = T.Unicode()\n",
" context = T.Dict()\n", " context = T.Dict()\n",
" \n", "\n",
" AMP = \"&\"\n", " AMP = \"&\"\n",
" _AMP_ = \"_____AMP_____\"\n", " _AMP_ = \"_____AMP_____\"\n",
"\n", "\n",
" @T.observe(\"context\", \"template\")\n", " @T.observe(\"context\", \"template\")\n",
" def _on_context(self, change):\n", " def _on_context(self, change):\n",
" env = jinja2.Environment(\n", " env = jinja2.Environment(\n",
" extensions=['jinja2.ext.i18n', 'jinja2.ext.autoescape'],\n", " extensions=[\"jinja2.ext.i18n\", \"jinja2.ext.autoescape\"],\n",
" autoescape=jinja2.select_autoescape(['html', 'xml'])\n", " autoescape=jinja2.select_autoescape([\"html\", \"xml\"]),\n",
" )\n",
"\n",
" self.xml = self.smudge(\n",
" env.from_string(self.clean(self.template)).render(\n",
" **{\n",
" key: self.markdown(value)\n",
" for key, value in (self.context or {}).items()\n",
" },\n",
" ),\n",
" )\n", " )\n",
"\n", "\n",
" self.xml = self.smudge(env.from_string(self.clean(self.template)).render(**{\n",
" key: self.markdown(value)\n",
" for key, value in (self.context or {}).items()\n",
" }))\n",
" \n",
" def clean(self, txt):\n", " def clean(self, txt):\n",
" return txt.replace(self.AMP, self._AMP_)\n", " return txt.replace(self.AMP, self._AMP_)\n",
"\n", "\n",
" def smudge(self, txt):\n", " def smudge(self, txt):\n",
" return txt.replace(self._AMP_, self.AMP)\n", " return txt.replace(self._AMP_, self.AMP)\n",
" \n", "\n",
" def markdown(self, md):\n", " def markdown(self, md):\n",
" return markdown2html_mistune(md).replace(self.AMP, self._AMP_)" " return markdown2html_mistune(md).replace(self.AMP, self._AMP_)"
] ]
@ -332,11 +338,11 @@
} }
], ],
"source": [ "source": [
"TEMPLATE = P.Path(\"testfiles/template deck.dio\") \n", "TEMPLATE = P.Path(\"testfiles/template deck.dio\")\n",
"title = TemplatedDrawioSlides(template=TEMPLATE.read_text(), context=dict(\n", "title = TemplatedDrawioSlides(\n",
" hero=\"<h1>???</h1>\",\n", " template=TEMPLATE.read_text(),\n",
" title=\"_No title here yet..._\"\n", " context={\"hero\": \"<h1>???</h1>\", \"title\": \"_No title here yet..._\"},\n",
"))\n", ")\n",
"title" "title"
] ]
}, },
@ -355,10 +361,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"title.context = {\n", "title.context = {\"title\": \"The _title_ can contain `Markdown`\", \"hero\": logo}"
" \"title\": \"The _title_ can contain `Markdown`\",\n",
" \"hero\": logo\n",
"}"
] ]
}, },
{ {
@ -371,12 +374,13 @@
"for i in range(4):\n", "for i in range(4):\n",
" ideas += [\n", " ideas += [\n",
" TemplatedDrawioSlides(\n", " TemplatedDrawioSlides(\n",
" template=TEMPLATE.read_text(), \n", " template=TEMPLATE.read_text(),\n",
" context=dict(\n", " context={\n",
" title=f\"# Idea {i + 1}\",\n", " \"title\": f\"# Idea {i + 1}\",\n",
" abstract=f\"This is idea {i + 1}. It's better than [idea {i}](#idea-{i})\",\n", " \"abstract\": f\"This is idea {i + 1}. It's better than [idea {i}](#idea-{i})\",\n",
" hero=(logo + \"\\n\\n\") * (1 + 1) \n", " \"hero\": (logo + \"\\n\\n\") * (1 + 1),\n",
" ))\n", " },\n",
" ),\n",
" ]" " ]"
] ]
}, },
@ -402,8 +406,10 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"deck = W.HBox([title, how_it_works, *ideas, diagram_notebook, diagram_png, diagram_svg], \n", "deck = W.HBox(\n",
" layout=dict(display=\"flex\", flex_flow=\"row wrap\"))\n", " [title, how_it_works, *ideas, diagram_notebook, diagram_png, diagram_svg],\n",
" layout={\"display\": \"flex\", \"flex_flow\": \"row wrap\"},\n",
")\n",
"# deck" "# deck"
] ]
}, },
@ -425,32 +431,32 @@
"class Deck(W.HBox):\n", "class Deck(W.HBox):\n",
" composite = T.Unicode()\n", " composite = T.Unicode()\n",
" preview = T.Instance(Slides)\n", " preview = T.Instance(Slides)\n",
" \n", "\n",
" def __init__(self, *args, **kwargs):\n", " def __init__(self, *args, **kwargs):\n",
" if \"layout\" not in kwargs:\n", " if \"layout\" not in kwargs:\n",
" kwargs[\"layout\"] = dict(display=\"flex\", flex_flow=\"row wrap\")\n", " kwargs[\"layout\"] = {\"display\": \"flex\", \"flex_flow\": \"row wrap\"}\n",
" super().__init__(*args, **kwargs)\n", " super().__init__(*args, **kwargs)\n",
" \n", "\n",
" @T.default(\"preview\")\n", " @T.default(\"preview\")\n",
" def _default_preview(self):\n", " def _default_preview(self):\n",
" slides = Slides()\n", " slides = Slides()\n",
" T.dlink((self, \"composite\"), (slides, \"pdf\"))\n", " T.dlink((self, \"composite\"), (slides, \"pdf\"))\n",
" self.update_composite()\n", " self.update_composite()\n",
" return slides\n", " return slides\n",
" \n", "\n",
" @T.observe(\"children\")\n", " @T.observe(\"children\")\n",
" def _on_children(self, change):\n", " def _on_children(self, change):\n",
" self.update_composite()\n", " self.update_composite()\n",
" \n", "\n",
" def extract_diagrams(self, child):\n", " def extract_diagrams(self, child):\n",
" if isinstance(child.xml, str):\n", " if isinstance(child.xml, str):\n",
" node = E.fromstring(child.xml)\n", " node = E.fromstring(child.xml)\n",
" elif isinstance(child.xml, bytes):\n", " elif isinstance(child.xml, bytes):\n",
" img = Image.open(BytesIO(child.xml))\n", " img = Image.open(BytesIO(child.xml))\n",
" node = E.fromstring(urllib.parse.unquote(img.info[\"mxfile\"]))\n", " node = E.fromstring(urllib.parse.unquote(img.info[\"mxfile\"]))\n",
" \n", "\n",
" tag = node.tag\n", " tag = node.tag\n",
" \n", "\n",
" if tag == \"mxfile\":\n", " if tag == \"mxfile\":\n",
" for diagram in node.xpath(\"//diagram\"):\n", " for diagram in node.xpath(\"//diagram\"):\n",
" yield diagram\n", " yield diagram\n",
@ -462,7 +468,7 @@
" diagrams = E.fromstring(node.attrib[\"content\"]).xpath(\"//diagram\")\n", " diagrams = E.fromstring(node.attrib[\"content\"]).xpath(\"//diagram\")\n",
" for diagram in diagrams:\n", " for diagram in diagrams:\n",
" yield diagram\n", " yield diagram\n",
" \n", "\n",
" def update_composite(self):\n", " def update_composite(self):\n",
" tree = E.fromstring(\"\"\"<mxfile version=\"13.3.6\"></mxfile>\"\"\")\n", " tree = E.fromstring(\"\"\"<mxfile version=\"13.3.6\"></mxfile>\"\"\")\n",
" with tempfile.TemporaryDirectory() as td:\n", " with tempfile.TemporaryDirectory() as td:\n",
@ -471,8 +477,10 @@
" for i, child in enumerate(self.children):\n", " for i, child in enumerate(self.children):\n",
" for diagram in self.extract_diagrams(child):\n", " for diagram in self.extract_diagrams(child):\n",
" tree.append(diagram)\n", " tree.append(diagram)\n",
" next_pdf = (tdp / f\"doc-{i}.pdf\")\n", " next_pdf = tdp / f\"doc-{i}.pdf\"\n",
" wrote = next_pdf.write_bytes(base64.b64decode(child.pdf.encode(\"utf-8\")))\n", " wrote = next_pdf.write_bytes(\n",
" base64.b64decode(child.pdf.encode(\"utf-8\")),\n",
" )\n",
" if wrote:\n", " if wrote:\n",
" merger.append(PyPDF2.PdfFileReader(str(next_pdf)))\n", " merger.append(PyPDF2.PdfFileReader(str(next_pdf)))\n",
" output_pdf = tdp / \"output.pdf\"\n", " output_pdf = tdp / \"output.pdf\"\n",

Wyświetl plik

@ -16,6 +16,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import pandas\n", "import pandas\n",
"\n",
"%config InlineBackend.figure_formats = ['svg']" "%config InlineBackend.figure_formats = ['svg']"
] ]
}, },

Wyświetl plik

@ -28,6 +28,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import pandas\n", "import pandas\n",
"\n",
"%config InlineBackend.figure_formats = ['svg']" "%config InlineBackend.figure_formats = ['svg']"
] ]
}, },
@ -48,24 +49,16 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from pathlib import Path\n",
"import requests\n",
"import copy\n", "import copy\n",
"import os\n",
"import html\n",
"import difflib\n", "import difflib\n",
"from pygments import highlight\n", "import html\n",
"from pygments.lexers import get_lexer_by_name\n", "import os\n",
"from pygments.formatters import HtmlFormatter\n", "from pathlib import Path\n",
"from lxml.builder import E\n",
"from uuid import uuid4\n", "from uuid import uuid4\n",
"import IPython\n",
"import bleach\n",
"import black\n",
"\n", "\n",
"from nbconvert.exporters.html import TemplateExporter\n", "import black\n",
"from nbconvert.filters import markdown2html_mistune\n", "import bleach\n",
"from jinja2 import DictLoader" "import IPython"
] ]
}, },
{ {
@ -75,7 +68,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from ipydrawio_widgets import Diagram" "import lxml.etree as ET"
] ]
}, },
{ {
@ -95,7 +88,8 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import lxml.etree as ET" "import nbformat\n",
"import requests"
] ]
}, },
{ {
@ -115,8 +109,20 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import nbformat\n", "from ipydrawio_widgets import Diagram\n",
"this_notebook = nbformat.reads(Path(os.environ.get(\"NOTEBOOK\", \"Notebook to Diagram.ipynb\")).read_text(encoding=\"utf-8\"), as_version=4)\n", "from lxml.builder import E\n",
"from nbconvert.exporters.html import TemplateExporter\n",
"from nbconvert.filters import markdown2html_mistune\n",
"from pygments import highlight\n",
"from pygments.formatters import HtmlFormatter\n",
"from pygments.lexers import get_lexer_by_name\n",
"\n",
"this_notebook = nbformat.reads(\n",
" Path(os.environ.get(\"NOTEBOOK\", \"Notebook to Diagram.ipynb\")).read_text(\n",
" encoding=\"utf-8\",\n",
" ),\n",
" as_version=4,\n",
")\n",
"this_notebook.cells[0]" "this_notebook.cells[0]"
] ]
}, },
@ -138,6 +144,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"from ipydrawio.constants import A_SHORT_DRAWIO\n", "from ipydrawio.constants import A_SHORT_DRAWIO\n",
"\n",
"A_SHORT_DRAWIO" "A_SHORT_DRAWIO"
] ]
}, },
@ -148,7 +155,8 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"def a_style(**kwargs): return dict(style=\"\".join([f\"{k}={v};\" for k, v in kwargs.items()]))" "def a_style(**kwargs):\n",
" return {\"style\": \"\".join([f\"{k}={v};\" for k, v in kwargs.items()])}"
] ]
}, },
{ {
@ -169,27 +177,30 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"def a_note_style(**kwargs):\n", "def a_note_style(**kwargs):\n",
" _defaults_ = kwargs.pop(\"_defaults_\", dict(\n", " _defaults_ = kwargs.pop(\n",
" shape=\"note\",\n", " \"_defaults_\",\n",
" backgroundOutline=1,\n", " {\n",
" darkOpacity=0.05,\n", " \"shape\": \"note\",\n",
" fillColor=\"#FFF9B2\",\n", " \"backgroundOutline\": 1,\n",
" strokeColor=\"none\",\n", " \"darkOpacity\": 0.05,\n",
" fillStyle=\"solid\",\n", " \"fillColor\": \"#FFF9B2\",\n",
" direction=\"west\",\n", " \"strokeColor\": \"none\",\n",
" gradientDirection=\"north\",\n", " \"fillStyle\": \"solid\",\n",
" gradientColor=\"#FFF2A1\",\n", " \"direction\": \"west\",\n",
" sketch=1,\n", " \"gradientDirection\": \"north\",\n",
" shadow=1,\n", " \"gradientColor\": \"#FFF2A1\",\n",
" size=20,\n", " \"sketch\": 1,\n",
" fontSize=24,\n", " \"shadow\": 1,\n",
" jiggle=2,\n", " \"size\": 20,\n",
" pointerEvents=1,\n", " \"fontSize\": 24,\n",
" hachureGap=4,\n", " \"jiggle\": 2,\n",
" whiteSpace=\"wrap\",\n", " \"pointerEvents\": 1,\n",
" fontFamily=\"Architects Daughter\",\n", " \"hachureGap\": 4,\n",
" fontSource=\"https%3A%2F%2Ftools-static.wmflabs.org%2Ffontcdn%2Fcss%3Ffamily%3DArchitects%2BDaughter\"\n", " \"whiteSpace\": \"wrap\",\n",
" ))\n", " \"fontFamily\": \"Architects Daughter\",\n",
" \"fontSource\": \"https%3A%2F%2Ftools-static.wmflabs.org%2Ffontcdn%2Fcss%3Ffamily%3DArchitects%2BDaughter\",\n",
" },\n",
" )\n",
" style = dict(**_defaults_)\n", " style = dict(**_defaults_)\n",
" style.update(**kwargs)\n", " style.update(**kwargs)\n",
" return a_style(**style)" " return a_style(**style)"
@ -203,9 +214,10 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"def a_note_geometry(**kwargs):\n", "def a_note_geometry(**kwargs):\n",
" _defaults_ = kwargs.get(\"_defaults_\", dict(\n", " _defaults_ = kwargs.get(\n",
" x=\"0\", y=\"0\", width=\"500\", height=\"300\", **{\"as\": \"geometry\"}\n", " \"_defaults_\",\n",
" ))\n", " dict(x=\"0\", y=\"0\", width=\"500\", height=\"300\", **{\"as\": \"geometry\"}),\n",
" )\n",
" mx_kwargs = dict(_defaults_)\n", " mx_kwargs = dict(_defaults_)\n",
" mx_kwargs.pop(\"defaults\", None)\n", " mx_kwargs.pop(\"defaults\", None)\n",
" mx_kwargs.update(**kwargs)\n", " mx_kwargs.update(**kwargs)\n",
@ -221,10 +233,13 @@
"source": [ "source": [
"def a_note(value=None, geometry=None, vertex=\"1\", parent=\"1\", **kwargs):\n", "def a_note(value=None, geometry=None, vertex=\"1\", parent=\"1\", **kwargs):\n",
" value = value or kwargs.pop(\"value\", None)\n", " value = value or kwargs.pop(\"value\", None)\n",
" _defaults_ = kwargs.pop(\"_defaults_\", dict(\n", " _defaults_ = kwargs.pop(\n",
" id=f\"{uuid4()}\",\n", " \"_defaults_\",\n",
" value=value,\n", " {\n",
" ))\n", " \"id\": f\"{uuid4()}\",\n",
" \"value\": value,\n",
" },\n",
" )\n",
" mx_kwargs = dict(_defaults_)\n", " mx_kwargs = dict(_defaults_)\n",
" mx_kwargs.update(**kwargs)\n", " mx_kwargs.update(**kwargs)\n",
" style = mx_kwargs.pop(\"style\", {})\n", " style = mx_kwargs.pop(\"style\", {})\n",
@ -245,10 +260,12 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"A_CARD = (\"\"\"\n", "A_CARD = (\n",
" \"\"\"\n",
"<mxCell id=\"64\" value=\"CARD A\" style=\"shape=note;backgroundOutline=1;darkOpacity=0.05;fillColor=#FFF9B2;strokeColor=none;fillStyle=solid;direction=west;gradientDirection=north;gradientColor=#FFF2A1;sketch=1;shadow=1;size=20;fontSize=24;jiggle=2;pointerEvents=1;hachureGap=4;whiteSpace=wrap;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ftools-static.wmflabs.org%2Ffontcdn%2Fcss%3Ffamily%3DArchitects%2BDaughter;\" vertex=\"1\" parent=\"1\">\n", "<mxCell id=\"64\" value=\"CARD A\" style=\"shape=note;backgroundOutline=1;darkOpacity=0.05;fillColor=#FFF9B2;strokeColor=none;fillStyle=solid;direction=west;gradientDirection=north;gradientColor=#FFF2A1;sketch=1;shadow=1;size=20;fontSize=24;jiggle=2;pointerEvents=1;hachureGap=4;whiteSpace=wrap;fontFamily=Architects Daughter;fontSource=https%3A%2F%2Ftools-static.wmflabs.org%2Ffontcdn%2Fcss%3Ffamily%3DArchitects%2BDaughter;\" vertex=\"1\" parent=\"1\">\n",
" <mxGeometry x=\"0\" y=\"0\" width=\"500\" height=\"300\" as=\"geometry\"/>\n", " <mxGeometry x=\"0\" y=\"0\" width=\"500\" height=\"300\" as=\"geometry\"/>\n",
"</mxCell>\"\"\").strip()" "</mxCell>\"\"\"\n",
").strip()"
] ]
}, },
{ {
@ -299,7 +316,7 @@
"class MXTools:\n", "class MXTools:\n",
" page_height = 850\n", " page_height = 850\n",
" page_width = 1100\n", " page_width = 1100\n",
" \n", "\n",
" def empty_mx(self):\n", " def empty_mx(self):\n",
" return E.mxfile(\n", " return E.mxfile(\n",
" E.diagram(\n", " E.diagram(\n",
@ -324,15 +341,15 @@
" math=\"0\",\n", " math=\"0\",\n",
" shadow=\"0\",\n", " shadow=\"0\",\n",
" ),\n", " ),\n",
" id=\"x\", \n", " id=\"x\",\n",
" name=\"Page-1\"\n", " name=\"Page-1\",\n",
" ),\n", " ),\n",
" version=\"14.6.11\",\n", " version=\"14.6.11\",\n",
" )\n", " )\n",
"\n", "\n",
" def style(self, **kwargs):\n", " def style(self, **kwargs):\n",
" return dict(style=\";\".join([f\"{k}={v}\" for k, v in kwargs.items()]) + \";\")\n", " return {\"style\": \";\".join([f\"{k}={v}\" for k, v in kwargs.items()]) + \";\"}\n",
" \n", "\n",
" @property\n", " @property\n",
" def text_style(self):\n", " def text_style(self):\n",
" return self.style(\n", " return self.style(\n",
@ -343,9 +360,9 @@
" whiteSpace=\"wrap\",\n", " whiteSpace=\"wrap\",\n",
" fillColor=\"black\",\n", " fillColor=\"black\",\n",
" strokeColor=\"none\",\n", " strokeColor=\"none\",\n",
" html=\"1\"\n", " html=\"1\",\n",
" )\n", " )\n",
" \n", "\n",
" def svg_style(self, svg):\n", " def svg_style(self, svg):\n",
" return self.style(\n", " return self.style(\n",
" shape=\"image\",\n", " shape=\"image\",\n",
@ -354,7 +371,7 @@
" verticalAlign=\"top\",\n", " verticalAlign=\"top\",\n",
" aspect=\"fixed\",\n", " aspect=\"fixed\",\n",
" imageAspect=0,\n", " imageAspect=0,\n",
" image=f\"data:image/svg+xml,{svg}\"\n", " image=f\"data:image/svg+xml,{svg}\",\n",
" )" " )"
] ]
}, },
@ -366,10 +383,10 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"DEFAULT_FORMATTER = HtmlFormatter(\n", "DEFAULT_FORMATTER = HtmlFormatter(\n",
" noclasses=True, \n", " noclasses=True,\n",
" style=\"monokai\", \n", " style=\"monokai\",\n",
" wrapcode=True, \n", " wrapcode=True,\n",
" cssstyles='background: rgba(0,0,0,0.9); padding: 0.1em 0.5em; border-radius: 0.5em'\n", " cssstyles=\"background: rgba(0,0,0,0.9); padding: 0.1em 0.5em; border-radius: 0.5em\",\n",
")" ")"
] ]
}, },
@ -382,7 +399,6 @@
"source": [ "source": [
"class NoteCellExporter(TemplateExporter, MXTools):\n", "class NoteCellExporter(TemplateExporter, MXTools):\n",
" export_from_notebook = \"Diagram\"\n", " export_from_notebook = \"Diagram\"\n",
" # todo: traitliet\n",
" formatter = DEFAULT_FORMATTER\n", " formatter = DEFAULT_FORMATTER\n",
" lexer = get_lexer_by_name(\"ipython\")\n", " lexer = get_lexer_by_name(\"ipython\")\n",
"\n", "\n",
@ -390,20 +406,20 @@
" \"\"\"\n", " \"\"\"\n",
" The new file extension is ``.test_ext``\n", " The new file extension is ``.test_ext``\n",
" \"\"\"\n", " \"\"\"\n",
" return '.dio'\n", " return \".dio\"\n",
"\n", "\n",
" def from_notebook_node(self, nb, resources=None, **kw):\n", " def from_notebook_node(self, nb, resources=None, **kw):\n",
" nb_copy = copy.deepcopy(nb)\n", " nb_copy = copy.deepcopy(nb)\n",
" resources = self._init_resources(resources)\n", " resources = self._init_resources(resources)\n",
"\n", "\n",
" if 'language' in nb['metadata']:\n", " if \"language\" in nb[\"metadata\"]:\n",
" resources['language'] = nb['metadata']['language'].lower()\n", " resources[\"language\"] = nb[\"metadata\"][\"language\"].lower()\n",
"\n", "\n",
" # Preprocess\n", " # Preprocess\n",
" nb_copy, resources = self._preprocess(nb_copy, resources)\n", " nb_copy, resources = self._preprocess(nb_copy, resources)\n",
"\n", "\n",
" tree = self.empty_mx()\n", " tree = self.empty_mx()\n",
" root = tree.xpath(\"//root\")\n", " tree.xpath(\"//root\")\n",
" prev = tree.xpath(\"//mxCell\")[-1]\n", " prev = tree.xpath(\"//mxCell\")[-1]\n",
" prev_id = 1\n", " prev_id = 1\n",
" col = 0\n", " col = 0\n",
@ -411,12 +427,16 @@
" w = 500\n", " w = 500\n",
" h = 300\n", " h = 300\n",
" p = 25\n", " p = 25\n",
" card_geo = lambda: dict(\n", "\n",
" x=f\"{col * (w + p)}\", y=f\"{row * (h + p)}\", \n", " def card_geo():\n",
" width=f\"{w}\", height=f\"{h}\",\n", " return dict(\n",
" **{\"as\": \"geometry\"}\n", " x=f\"{col * (w + p)}\",\n",
" )\n", " y=f\"{row * (h + p)}\",\n",
" \n", " width=f\"{w}\",\n",
" height=f\"{h}\",\n",
" **{\"as\": \"geometry\"},\n",
" )\n",
"\n",
" for cell in nb_copy[\"cells\"]:\n", " for cell in nb_copy[\"cells\"]:\n",
" if cell[\"cell_type\"] == \"markdown\":\n", " if cell[\"cell_type\"] == \"markdown\":\n",
" row += 1\n", " row += 1\n",
@ -424,12 +444,12 @@
" mxc = a_note(\n", " mxc = a_note(\n",
" value=self.markdown_escaped(cell),\n", " value=self.markdown_escaped(cell),\n",
" id=f\"{prev_id + 1}\",\n", " id=f\"{prev_id + 1}\",\n",
" style=dict(\n", " style={\n",
" html=\"1\",\n", " \"html\": \"1\",\n",
" fontFamily=\"Architects Daughter\",\n", " \"fontFamily\": \"Architects Daughter\",\n",
" fontSource=\"https://tools-static.wmflabs.org/fontcdn/css?family=Architects+Daughter\",\n", " \"fontSource\": \"https://tools-static.wmflabs.org/fontcdn/css?family=Architects+Daughter\",\n",
" ),\n", " },\n",
" geometry=dict(y=f\"{row * (h + p)}\", x=f\"{col * (w + p)}\")\n", " geometry={\"y\": f\"{row * (h + p)}\", \"x\": f\"{col * (w + p)}\"},\n",
" )\n", " )\n",
" prev.addnext(mxc)\n", " prev.addnext(mxc)\n",
" prev = mxc\n", " prev = mxc\n",
@ -438,9 +458,11 @@
" elif cell[\"cell_type\"] == \"code\":\n", " elif cell[\"cell_type\"] == \"code\":\n",
" mxc = E.mxCell(\n", " mxc = E.mxCell(\n",
" a_note_geometry(**card_geo()),\n", " a_note_geometry(**card_geo()),\n",
" id=f\"{prev_id + 1}\", parent=\"1\", vertex=\"1\",\n", " id=f\"{prev_id + 1}\",\n",
" parent=\"1\",\n",
" vertex=\"1\",\n",
" value=self.source_escaped(cell),\n", " value=self.source_escaped(cell),\n",
" **self.text_style\n", " **self.text_style,\n",
" )\n", " )\n",
" prev.addnext(mxc)\n", " prev.addnext(mxc)\n",
" prev = mxc\n", " prev = mxc\n",
@ -453,34 +475,36 @@
" if svg:\n", " if svg:\n",
" mxc = E.mxCell(\n", " mxc = E.mxCell(\n",
" a_note_geometry(**card_geo()),\n", " a_note_geometry(**card_geo()),\n",
" id=f\"{prev_id + 1}\", parent=\"1\", vertex=\"1\",\n", " id=f\"{prev_id + 1}\",\n",
" parent=\"1\",\n",
" vertex=\"1\",\n",
" value=\"\",\n", " value=\"\",\n",
" **self.svg_style(self.svg_escaped(svg))\n", " **self.svg_style(self.svg_escaped(svg)),\n",
" )\n", " )\n",
" prev.addnext(mxc)\n", " prev.addnext(mxc)\n",
" prev = mxc\n", " prev = mxc\n",
" prev_id += 1\n", " prev_id += 1\n",
" col += 1\n", " col += 1\n",
" return ET.tostring(tree, encoding=str, pretty_print=True).replace(\"&amp;\", \"&\"), resources\n", " return (\n",
"\n", " ET.tostring(tree, encoding=str, pretty_print=True).replace(\"&amp;\", \"&\"),\n",
" resources,\n",
" )\n",
"\n", "\n",
" def source_escaped(self, cell):\n", " def source_escaped(self, cell):\n",
" try:\n", " try:\n",
" source = black.format_str(cell.source, mode=black.FileMode(line_length=60))\n", " source = black.format_str(cell.source, mode=black.FileMode(line_length=60))\n",
" except:\n", " except:\n",
" source = cell.source\n", " source = cell.source\n",
" return html.escape(\n", " return html.escape(highlight(source, self.lexer, self.formatter))\n",
" highlight(\n",
" source,\n",
" self.lexer,\n",
" self.formatter\n",
" )\n",
" )\n",
"\n", "\n",
" allowed_tags = {\n", " allowed_tags = {\n",
" *bleach.sanitizer.ALLOWED_TAGS,\n", " *bleach.sanitizer.ALLOWED_TAGS,\n",
" *{f\"h{i}\" for i in range(7)},\n", " *{f\"h{i}\" for i in range(7)},\n",
" \"div\", \"pre\", \"span\", \"blockquote\", \"strong\"\n", " \"div\",\n",
" \"pre\",\n",
" \"span\",\n",
" \"blockquote\",\n",
" \"strong\",\n",
" } ^ {\"a\"}\n", " } ^ {\"a\"}\n",
"\n", "\n",
" def markdown_escaped(self, cell):\n", " def markdown_escaped(self, cell):\n",
@ -488,8 +512,8 @@
" bleach.clean(\n", " bleach.clean(\n",
" markdown2html_mistune(cell.source),\n", " markdown2html_mistune(cell.source),\n",
" tags=self.allowed_tags,\n", " tags=self.allowed_tags,\n",
" strip=True\n", " strip=True,\n",
" )\n", " ),\n",
" )\n", " )\n",
"\n", "\n",
" def svg_escaped(self, some_data):\n", " def svg_escaped(self, some_data):\n",
@ -514,8 +538,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"export_diagram = NoteCellExporter()\n", "export_diagram = NoteCellExporter()\n",
"(body, resources) = export_diagram.from_notebook_node(this_notebook)\n", "(body, resources) = export_diagram.from_notebook_node(this_notebook)"
"# print(body)"
] ]
}, },
{ {
@ -527,7 +550,7 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"diagram = Diagram(layout=dict(height=\"400px\", width=\"100%\"))\n", "diagram = Diagram(layout={\"height\": \"400px\", \"width\": \"100%\"})\n",
"new_params = dict(**diagram.url_params)\n", "new_params = dict(**diagram.url_params)\n",
"new_params.update(ui=\"sketch\", format=\"0\")\n", "new_params.update(ui=\"sketch\", format=\"0\")\n",
"diagram.url_params = new_params\n", "diagram.url_params = new_params\n",

Wyświetl plik

@ -19,16 +19,15 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"import json\n", "import json\n",
"from pathlib import Path\n",
"import lxml.etree as ET\n",
"import IPython\n",
"import subprocess\n",
"from copy import deepcopy\n",
"import tempfile\n",
"import pandas\n",
"import bleach\n",
"import re\n", "import re\n",
"import ipywidgets as W" "import subprocess\n",
"import tempfile\n",
"from copy import deepcopy\n",
"from pathlib import Path\n",
"\n",
"import IPython\n",
"import lxml.etree as ET\n",
"import pandas"
] ]
}, },
{ {
@ -110,7 +109,11 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"h_url_params = paths[0]\n", "h_url_params = paths[0]\n",
"IPython.display.IFrame(f\"/files/{h_url_params}\", height='600px\" style=\"height: 100%;', width=\"100%\")" "IPython.display.IFrame(\n",
" f\"/files/{h_url_params}\",\n",
" height='600px\" style=\"height: 100%;',\n",
" width=\"100%\",\n",
")"
] ]
}, },
{ {
@ -175,16 +178,22 @@
" tdp = Path(td)\n", " tdp = Path(td)\n",
" html = tdp / \"test1.html\"\n", " html = tdp / \"test1.html\"\n",
" md = tdp / \"test1.md\"\n", " md = tdp / \"test1.md\"\n",
" html.write_text(f'<ul>{ET.tostring(li.getparent(), encoding=str, pretty_print=True)}</ul>')\n", " html.write_text(\n",
" f\"<ul>{ET.tostring(li.getparent(), encoding=str, pretty_print=True)}</ul>\",\n",
" )\n",
" args = [\"pandoc\", html, \"-f\", \"html\", \"-t\", \"commonmark\", \"-s\", \"-o\", md]\n", " args = [\"pandoc\", html, \"-f\", \"html\", \"-t\", \"commonmark\", \"-s\", \"-o\", md]\n",
" subprocess.check_call([*map(str, args)])\n", " subprocess.check_call([*map(str, args)])\n",
" body = \" \".join([line.strip() for line in md.read_text().splitlines()])\n", " body = \" \".join([line.strip() for line in md.read_text().splitlines()])\n",
" body = re.sub(r'\\[(.*)?\\]\\((.*?)\\)', r'_\\1_', body)[2:].strip()\n", " body = re.sub(r\"\\[(.*)?\\]\\((.*?)\\)\", r\"_\\1_\", body)[2:].strip()\n",
" print(f'`{li.text}`')\n", " print(f\"`{li.text}`\")\n",
" body = body.replace(f'`{li.text}`:', f\"{li.text.split('=')[1]}:\")\n", " body = body.replace(f\"`{li.text}`:\", f\"{li.text.split('=')[1]}:\")\n",
" print(\"\\t\", body)\n", " print(\"\\t\", body)\n",
" return body\n", " return body\n",
"IPython.display.Markdown(f'''> _this is the description of **`{li.text.split(\"=\")[0]}`**_\\n> ```md\\n{one_md_desc(li)}\\n```''')" "\n",
"\n",
"IPython.display.Markdown(\n",
" f\"\"\"> _this is the description of **`{li.text.split(\"=\")[0]}`**_\\n> ```md\\n{one_md_desc(li)}\\n```\"\"\",\n",
")"
] ]
}, },
{ {
@ -197,7 +206,7 @@
"url_params = {\n", "url_params = {\n",
" x.text.split(\"=\")[0]: {\"description\": one_md_desc(x)}\n", " x.text.split(\"=\")[0]: {\"description\": one_md_desc(x)}\n",
" for x in li_elements\n", " for x in li_elements\n",
" if '&' not in x.text\n", " if \"&\" not in x.text\n",
"}\n", "}\n",
"IPython.display.JSON(url_params)" "IPython.display.JSON(url_params)"
] ]
@ -309,10 +318,17 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"df_old = pandas.DataFrame([\n", "df_old = (\n",
" {\"id\": k, **v}\n", " pandas.DataFrame(\n",
" for k, v in SCHEMA[\"definitions\"][\"drawio-url-params\"][\"properties\"].items()\n", " [\n",
"]).sort_values(\"id\").set_index([\"id\"]).fillna(\"\")\n", " {\"id\": k, **v}\n",
" for k, v in SCHEMA[\"definitions\"][\"drawio-url-params\"][\"properties\"].items()\n",
" ],\n",
" )\n",
" .sort_values(\"id\")\n",
" .set_index([\"id\"])\n",
" .fillna(\"\")\n",
")\n",
"df_old" "df_old"
] ]
}, },
@ -368,7 +384,7 @@
" if \"description\" in v:\n", " if \"description\" in v:\n",
" v[\"description\"] += \" **NEW `14.6.10`**\"\n", " v[\"description\"] += \" **NEW `14.6.10`**\"\n",
" new_df[k] = v\n", " new_df[k] = v\n",
"for k in sorted(set([*cleaned_df_old, *cleaned_df])):\n", "for k in sorted({*cleaned_df_old, *cleaned_df}):\n",
" if k in new_df:\n", " if k in new_df:\n",
" continue\n", " continue\n",
" new_df[k] = {**cleaned_df_old[k]}\n", " new_df[k] = {**cleaned_df_old[k]}\n",
@ -391,12 +407,13 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"before_i18n, after_i18n = new_df[\"lang\"][\"description\"].split('*i18n*,')\n", "before_i18n, after_i18n = new_df[\"lang\"][\"description\"].split(\"*i18n*,\")\n",
"locales = sorted([\n", "locales = sorted(\n",
" lang.replace('`', '').strip().split(\":\")[0].strip()\n", " [\n",
" for lang in\n", " lang.replace(\"`\", \"\").strip().split(\":\")[0].strip()\n",
" new_df[\"lang\"][\"description\"].split('*i18n*,')[1].split(',')\n", " for lang in new_df[\"lang\"][\"description\"].split(\"*i18n*,\")[1].split(\",\")\n",
"])" " ],\n",
")"
] ]
}, },
{ {
@ -406,7 +423,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"new_df[\"lang\"][\"description\"] = f'''{before_i18n} *i18n* {\", \".join(locales)}'''\n", "new_df[\"lang\"][\"description\"] = f\"\"\"{before_i18n} *i18n* {\", \".join(locales)}\"\"\"\n",
"new_df[\"lang\"][\"examples\"] = locales" "new_df[\"lang\"][\"examples\"] = locales"
] ]
}, },
@ -425,11 +442,9 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"new_df[\"configure\"][\"$ref\"] = \\\n", "new_df[\"configure\"][\"$ref\"] = new_df[\"pwa\"][\"$ref\"] = new_df[\"returnbounds\"][\n",
" new_df[\"pwa\"][\"$ref\"] = \\\n", " \"$ref\"\n",
" new_df[\"returnbounds\"][\"$ref\"] = \\\n", "] = new_df[\"svg-warning\"][\"$ref\"] = \"#/definitions/off-switch\""
" new_df[\"svg-warning\"][\"$ref\"] = \\\n",
" \"#/definitions/off-switch\""
] ]
}, },
{ {
@ -439,8 +454,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"new_df[\"hide-pages\"][\"$ref\"] = \\\n", "new_df[\"hide-pages\"][\"$ref\"] = \"#/definitions/on-off-switch\""
" \"#/definitions/on-off-switch\""
] ]
}, },
{ {
@ -450,8 +464,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"new_df[\"math-output\"][\"examples\"] = \\\n", "new_df[\"math-output\"][\"examples\"] = [\"html\"]"
" [\"html\"]"
] ]
}, },
{ {
@ -461,8 +474,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"new_df[\"ui\"][\"examples\"] = \\\n", "new_df[\"ui\"][\"examples\"] = [\"min\", \"atlas\", \"dark\", \"sketch\"]"
" [\"min\", \"atlas\", \"dark\", \"sketch\"]"
] ]
}, },
{ {
@ -495,7 +507,10 @@
"NEW_SCHEMA = deepcopy(SCHEMA)\n", "NEW_SCHEMA = deepcopy(SCHEMA)\n",
"NEW_SCHEMA[\"definitions\"][\"drawio-url-params\"][\"properties\"] = new_df\n", "NEW_SCHEMA[\"definitions\"][\"drawio-url-params\"][\"properties\"] = new_df\n",
"NEW_SCHEMA_PATH = SCHEMA_PATH.parent / f\"{SCHEMA_PATH.name}.proposed.json\"\n", "NEW_SCHEMA_PATH = SCHEMA_PATH.parent / f\"{SCHEMA_PATH.name}.proposed.json\"\n",
"NEW_SCHEMA_PATH.write_text(json.dumps(NEW_SCHEMA, indent=2, sort_keys=True), encoding=\"utf-8\")\n", "NEW_SCHEMA_PATH.write_text(\n",
" json.dumps(NEW_SCHEMA, indent=2, sort_keys=True),\n",
" encoding=\"utf-8\",\n",
")\n",
"!jlpm --silent prettier --write {ROOT}/packages/ipydrawio/schema/plugin.json.proposed.json\n", "!jlpm --silent prettier --write {ROOT}/packages/ipydrawio/schema/plugin.json.proposed.json\n",
"!git diff --color-words --no-index {ROOT}/packages/ipydrawio/schema/plugin.json {ROOT}/packages/ipydrawio/schema/plugin.json.proposed.json" "!git diff --color-words --no-index {ROOT}/packages/ipydrawio/schema/plugin.json {ROOT}/packages/ipydrawio/schema/plugin.json.proposed.json"
] ]

Wyświetl plik

@ -2,7 +2,7 @@
"private": true, "private": true,
"name": "-ipydrawio-root-", "name": "-ipydrawio-root-",
"scripts": { "scripts": {
"bootstrap": "jlpm --prefer-offline && lerna bootstrap", "bootstrap": "jlpm --prefer-offline --ignore-optional",
"deduplicate": "yarn-deduplicate -s fewer --fail", "deduplicate": "yarn-deduplicate -s fewer --fail",
"eslint": "cd packages && eslint --cache --fix --ext .js,.ts,.tsx */src", "eslint": "cd packages && eslint --cache --fix --ext .js,.ts,.tsx */src",
"eslint:check": "cd packages && eslint --cache --ext .js,.ts,.tsx */src" "eslint:check": "cd packages && eslint --cache --ext .js,.ts,.tsx */src"
@ -15,22 +15,23 @@
"json-schema": ">=0.4.0" "json-schema": ">=0.4.0"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.8.1", "@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^4.8.1", "@typescript-eslint/parser": "^5.54.0",
"eslint": "^7.14.0", "eslint": "^8.35.0",
"eslint-config-prettier": "^6.15.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^24.1.3", "eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.21.5", "eslint-plugin-react": "^7.32.2",
"file-loader": "^6.2.0",
"json-schema-to-typescript": "^11.0.2", "json-schema-to-typescript": "^11.0.2",
"lerna": "^6.0.1", "prettier": "^2.8.4",
"prettier": "^2.1.1", "prettier-package-json": "^2.8.0",
"prettier-package-json": "^2.7.0", "prettier-plugin-sort-json": "^1.0.0",
"prettier-plugin-sort-json": "^0.0.2", "typedoc": "^0.23.26",
"typedoc": "^0.23.20", "typedoc-plugin-markdown": "^3.14.0",
"typedoc-plugin-markdown": "^3.13.6", "typescript": "~4.9.4",
"typescript": "~4.8.4", "webpack": "^5.75.0",
"yarn-deduplicate": "^3.1.0" "yarn-deduplicate": "^6.0.1"
}, },
"prettier": { "prettier": {
"singleQuote": true, "singleQuote": true,

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -12,5 +12,20 @@
"@deathbeds/ipydrawio-notebook": "file:../ipydrawio-notebook", "@deathbeds/ipydrawio-notebook": "file:../ipydrawio-notebook",
"@deathbeds/ipydrawio-pdf": "file:../ipydrawio-pdf", "@deathbeds/ipydrawio-pdf": "file:../ipydrawio-pdf",
"@deathbeds/ipydrawio-webpack": "file:../ipydrawio-webpack" "@deathbeds/ipydrawio-webpack": "file:../ipydrawio-webpack"
},
"scripts_doit": {
"build": {
"file_dep": [
"../*/src/**/*.ts",
"../*/src/tsconfig.json",
"../*/style/**/*.*",
"../*/tsconfig.json",
"../tsconfigbase.json"
],
"targets": [
".root.tsbuildinfo",
".src.tsbuildinfo"
]
}
} }
} }

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -20,7 +20,7 @@ This work is licensed under the [Apache-2.0] License.
[apache-2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt [apache-2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "@deathbeds/ipydrawio-jupyter-templates", "name": "@deathbeds/ipydrawio-jupyter-templates",
"version": "1.2.3", "version": "1.3.0",
"description": "Jupyter Templates for IPyDrawio", "description": "Jupyter Templates for IPyDrawio",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "IPyDrawio Contributors", "author": "IPyDrawio Contributors",
@ -19,12 +19,11 @@
"scripts": {}, "scripts": {},
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"dependencies": { "dependencies": {
"@deathbeds/ipydrawio": "^1.2.2", "@deathbeds/ipydrawio": "^1.3.0",
"@jupyterlab/application": "^3.1.0" "@jupyterlab/application": "^3.1.0"
}, },
"peerDependencies": {},
"devDependencies": { "devDependencies": {
"@jupyterlab/builder": "^3.4.0" "@jupyterlab/builder": "^3.6.1"
}, },
"keywords": [ "keywords": [
"ipydrawio", "ipydrawio",

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
/** /**
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -21,7 +21,7 @@ The vendored [@jgraph/drawio](https://github.com/jgraph/drawio) is also licensed
the [Apache-2.0] license. the [Apache-2.0] license.
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,4 +1,4 @@
// Copyright 2022 ipydrawio contributors // Copyright 2023 ipydrawio contributors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -12,14 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
let DEBUG = false;
const plugin = { const plugin = {
id: '@deathbeds/ipydrawio-mathjax:plugin', id: '@deathbeds/ipydrawio-mathjax:plugin',
activate: async () => { activate: async () => {
if (DEBUG) { //
await import('./_static');
}
}, },
autoStart: true, autoStart: true,
}; };

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "@deathbeds/ipydrawio-mathjax", "name": "@deathbeds/ipydrawio-mathjax",
"version": "1.2.3", "version": "1.3.0",
"description": "MathJax for ipydrawio", "description": "MathJax for ipydrawio",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "IPyDrawio Contributors", "author": "IPyDrawio Contributors",
@ -15,11 +15,11 @@
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
"dependencies": { "dependencies": {
"@deathbeds/ipydrawio-webpack": "^20.5.301", "@deathbeds/ipydrawio-webpack": "^21.1.400",
"@jupyterlab/application": "^3.1.0" "@jupyterlab/application": "^3.1.0"
}, },
"devDependencies": { "devDependencies": {
"@jupyterlab/builder": "^3.4.0" "@jupyterlab/builder": "^3.6.1"
}, },
"keywords": [ "keywords": [
"drawio", "drawio",

Wyświetl plik

@ -1,4 +1,4 @@
// Copyright 2022 ipydrawio contributors // Copyright 2023 ipydrawio contributors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -12,16 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
const CopyPlugin = require('copy-webpack-plugin');
module.exports = { module.exports = {
optimization: { optimization: {
minimize: false, minimize: false,
}, },
module: { plugins: [new CopyPlugin({ patterns: [{ from: 'dio/**/*', to: '.'}] })],
rules: [
{
test: /dio\/.*/,
type: 'asset/resource',
},
],
},
}; };

Wyświetl plik

@ -19,7 +19,7 @@ See the [project repo](https://github.com/deathbeds/ipydrawio) for more informat
This work is licensed under the [Apache-2.0] License. This work is licensed under the [Apache-2.0] License.
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "@deathbeds/ipydrawio-notebook", "name": "@deathbeds/ipydrawio-notebook",
"version": "1.2.3", "version": "1.3.0",
"homepage": "https://ipydrawio.rtfd.io", "homepage": "https://ipydrawio.rtfd.io",
"bugs": { "bugs": {
"url": "https://github.com/deathbeds/ipydrawio/issues" "url": "https://github.com/deathbeds/ipydrawio/issues"
@ -10,12 +10,12 @@
"{lib,schema,style,src}/**/*.{ts,tsx,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,css}" "{lib,schema,style,src}/**/*.{ts,tsx,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,css}"
], ],
"dependencies": { "dependencies": {
"@deathbeds/ipydrawio": "^1.2.2", "@deathbeds/ipydrawio": "^1.3.0",
"@jupyterlab/application": "^3.1.0", "@jupyterlab/application": "^3.1.0",
"@jupyterlab/notebook": "^3.1.0" "@jupyterlab/notebook": "^3.1.0"
}, },
"devDependencies": { "devDependencies": {
"@jupyterlab/builder": "^3.4.0" "@jupyterlab/builder": "^3.6.1"
}, },
"jupyterlab": { "jupyterlab": {
"extension": "lib/plugin.js", "extension": "lib/plugin.js",

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,5 +1,5 @@
/* /*
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -19,7 +19,7 @@ See the [project repo](https://github.com/deathbeds/ipydrawio) for more informat
This work is licensed under the [Apache-2.0] License. This work is licensed under the [Apache-2.0] License.
``` ```
Copyright 2022 ipydrawio contributors Copyright 2023 ipydrawio contributors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "@deathbeds/ipydrawio-pdf", "name": "@deathbeds/ipydrawio-pdf",
"version": "1.2.3", "version": "1.3.0",
"homepage": "https://ipydrawio.rtfd.io", "homepage": "https://ipydrawio.rtfd.io",
"bugs": { "bugs": {
"url": "https://github.com/deathbeds/ipydrawio/issues" "url": "https://github.com/deathbeds/ipydrawio/issues"
@ -13,8 +13,8 @@
"@jupyterlab/application": "^3.1.0" "@jupyterlab/application": "^3.1.0"
}, },
"devDependencies": { "devDependencies": {
"@deathbeds/ipydrawio": "^1.2.2", "@deathbeds/ipydrawio": "^1.3.0",
"@jupyterlab/builder": "^3.4.0" "@jupyterlab/builder": "^3.6.1"
}, },
"jupyterlab": { "jupyterlab": {
"extension": "lib/plugin.js", "extension": "lib/plugin.js",

Some files were not shown because too many files have changed in this diff Show More