diff --git a/.binder/environment.yml b/.binder/environment.yml index 5a217c38..ac64993e 100644 --- a/.binder/environment.yml +++ b/.binder/environment.yml @@ -1,58 +1,86 @@ -name: ipydrawio +# a heavy demo environment for interactive testing + +# Copyright 2021 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. + +name: ipydrawio-demo channels: - conda-forge - nodefaults dependencies: + # demo toys + - bqplot + - graphviz2drawio + - jupyter-lsp-python-plugins + - jupyter-videochat + - jupyterlab-classic + - jupyterlab-lsp + - jupyterlab-tour + - matplotlib-base + - nbgitpuller + - networkx + - pygraphviz + - python-graphviz + - segno + - shapely + - tabulate + - wxyz_datagrid + - wxyz_json_schema_form + - wxyz_lab + - wxyz_svg + # TODO: get on conda-forge + # - qrcode-artistic + + ### ipydrawio-dev-deps ### + + # core + - doit + - nodejs >=12,!=13.*,<15 + - python # this gets patched in ci + # run - ipywidgets >=7.6 + - jedi <0.18.0 - jupyterlab >=3.0.13,<4.0.0a0 - jupyterlab_widgets >=1 - lxml - - networkx - - nodejs >=12,<13.0.0a0 - - pandas - pillow - pypdf2 - - shapely - - tabulate - # linting and testing - - babel + - requests_cache + # building + - pip + - twine + - wheel + # linting - black - - doit - flake8 - - httpx - - isort <5 - - json-e + - isort >=5 - pyflakes + - robotframework-lint + # unit testing - pytest - pytest-console-scripts - pytest-cov - pytest-tornasync - - requests_cache + # acceptance testing + - firefox =78 + - geckodriver >=0.28.0 - robotframework >=4 - - robotframework-lint - - robotframework-jupyterlibrary - robotframework-pabot - # python cruft - - python >=3.8,<3.9.0a0 - - pip - - twine - - wheel - # demo toys - - bqplot - - graphviz2drawio - - jupyter-lsp-python-plugins - - jupyter-videochat - - jupyterlab-classic - - jupyterlab-lsp - - matplotlib-base - - nbgitpuller - - pygraphviz - - python-graphviz - - wxyz_datagrid - - wxyz_lab - # for ipython - - jedi <0.18.0 - # binder pins - - jupyter_telemetry >=0.1.0 # ick, but fails pip check + - robotframework-seleniumlibrary + # reporting + - codecov + + ### ipydrawio-dev-deps ### diff --git a/.binder/labextensions.txt b/.binder/labextensions.txt deleted file mode 100644 index e50c893e..00000000 --- a/.binder/labextensions.txt +++ /dev/null @@ -1,3 +0,0 @@ -@jupyter-widgets/jupyterlab-manager -@jupyterlab/toc -bqplot diff --git a/.binder/postBuild b/.binder/postBuild index f415ae30..ec2b38a0 100755 --- a/.binder/postBuild +++ b/.binder/postBuild @@ -1,22 +1,37 @@ #!/usr/bin/env python -from pathlib import Path + +# Copyright 2021 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. + +import shutil import subprocess import sys -import shutil +from pathlib import Path + +SETTINGS = Path(sys.prefix) / "share/jupyter/lab/settings" +SETTINGS.mkdir(parents=True, exist_ok=True) + + +def doit(*args): + return subprocess.call(["doit", *args]) -doit = lambda *args: subprocess.call(["doit", *args]) doit("list", "--all", "--status") doit("-n4") doit("list", "--all", "--status") -SETTINGS = Path(sys.prefix) / "share/jupyter/lab/settings" -SETTINGS.mkdir(parents=True, exist_ok=True) - shutil.copy2(".binder/overrides.json", SETTINGS / "overrides.json") -shutil.copy2( - ".binder/jupyter_notebook_config.json", - "jupyter_notebook_config.json" -) +shutil.copy2(".binder/jupyter_notebook_config.json", "jupyter_notebook_config.json") sys.exit(doit()) diff --git a/.github/environment.yml b/.github/environment.yml index 089263f6..2b5253c3 100644 --- a/.github/environment.yml +++ b/.github/environment.yml @@ -1,36 +1,63 @@ -name: ipydrawio +# a sufficient environment for acceptance testing + +# Copyright 2021 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. + +name: ipydrawio-dev channels: - conda-forge - nodefaults dependencies: - - black - - codecov + ### ipydrawio-dev-deps ### + + # core - doit - - firefox =78 - - flake8 - - geckodriver >=0.28.0 + - nodejs >=12,!=13.*,<15 + - python # this gets patched in ci + # run - ipywidgets >=7.6 - - isort >=5 - jedi <0.18.0 - jupyterlab >=3.0.13,<4.0.0a0 - jupyterlab_widgets >=1 - lxml - - nodejs >=12,<13.0.0a0 - pillow + - pypdf2 + - requests_cache + # building - pip + - twine + - wheel + # linting + - black + - flake8 + - isort >=5 - pyflakes - - pypdf2 + - robotframework-lint + # unit testing - pytest - pytest-console-scripts - pytest-cov - pytest-tornasync - - python - - requests_cache + # acceptance testing + - firefox =78 + - geckodriver >=0.28.0 - robotframework >=4 - - robotframework-lint - robotframework-pabot - robotframework-seleniumlibrary - - twine - - wheel + # reporting + - codecov + + ### ipydrawio-dev-deps ### diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee567c17..bbef9e25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,19 @@ +# main continuous integration workflow + +# Copyright 2021 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: push: branches: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d875585..1c27cbbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,3 +68,19 @@ For pre-releases of the previously-named package, see the [old CHANGELOG][] [old changelog]: https://github.com/deathbeds/ipydrawio/tree/3a577ac/CHANGELOG.md + +``` +Copyright 2021 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. +``` diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8a38a434..02816f43 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,3 +79,19 @@ doit dist npm logout ``` - [ ] handle `conda-forge` feedstock tasks + +``` +Copyright 2021 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. +``` diff --git a/README.md b/README.md index 78a90179..1674223c 100644 --- a/README.md +++ b/README.md @@ -60,11 +60,17 @@ pip install ipydrawio ipydrawio-export > please see _Diagram_ options available in the _Command Palette_ and > various _Main Menu_ menus. +## Configuring + +- Change the _Diagram Theme_ from the _Settings_ + +> Use _Advanced Settings_ to modify drawio embedding parameters + ### PDF: Lab and Server extensions `ipydrawio-export` can generate print-quality PDF. This approach relies on a -headless browser, powered by [@jgraph/draw-image-export2] and ultimately -`puppeteer` which in turn requires `nodejs`. +headless browser, powered by [@jgraph/draw-image-export2], `puppeteer`, and +`nodejs`. - **native dependencies** as required to appease `puppeteer` - if running in `docker`, this can be a bit trial-and-error @@ -105,6 +111,22 @@ The original source code vendored in this package from: - [@jgraph/drawio][] - [@jgraph/draw-image-export2][] +``` +Copyright 2021 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. +``` + [apache 2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt [@jgraph/drawio]: https://github.com/jgraph/drawio [@jgraph/draw-image-export2]: https://github.com/jgraph/draw-image-export2 diff --git a/ROADMAP.md b/ROADMAP.md index 0539ff8c..b2bcb726 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -22,3 +22,19 @@ - [ ] `jupyter-videochat` integration - [ ] `jupyter-mockups` with various lo-fi Jupyter client interfaces - [ ] richer notebook integration with "live" updating + +``` +Copyright 2021 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. +``` diff --git a/atest/Formats.robot b/atest/Formats.robot index df8ab562..a9a33515 100644 --- a/atest/Formats.robot +++ b/atest/Formats.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Documentation Are export formats sane? Resource _Keywords.robot diff --git a/atest/Media.robot b/atest/Media.robot index 345d121a..aa38fbdb 100644 --- a/atest/Media.robot +++ b/atest/Media.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Documentation Does the media type (mimerenderer) work? Resource _Keywords.robot diff --git a/atest/Settings.robot b/atest/Settings.robot index 6604258a..335e0cbf 100644 --- a/atest/Settings.robot +++ b/atest/Settings.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Documentation Are Diagram settings usable? Resource _Keywords.robot @@ -5,19 +19,19 @@ Library OperatingSystem Force Tags component:settings *** Test Cases *** -Use Min Theme +Min [Documentation] Does the min theme work? Validate a Diagram Theme min -Use Atlas Theme +Atlas [Documentation] Does the atlas theme work? Validate a Diagram Theme atlas -Use Dark Theme +Dark [Documentation] Does the dark theme work? Validate a Diagram Theme dark -Use Kenedy Theme +Kennedy [Documentation] Does the kennedy theme work? Validate a Diagram Theme kennedy @@ -25,7 +39,7 @@ Use Kenedy Theme Validate a Diagram Theme [Arguments] ${ui} [Documentation] Change the theme - Set Tags settings:urlParams:ui settings:urlParams:ui:${ui} + Set Tags settings:urlparams:ui settings:urlparams:ui:${ui} Set Screenshot Directory ${OUTPUT DIR}${/}settings${/}ui${/}${ui} Reset Plugin Settings Launch Untitled Diagram diff --git a/atest/Smoke.robot b/atest/Smoke.robot index 1889f51f..2874fe7d 100644 --- a/atest/Smoke.robot +++ b/atest/Smoke.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Documentation smoke tests Resource _Keywords.robot diff --git a/atest/Widget.robot b/atest/Widget.robot index c6de6d79..af6bcca0 100644 --- a/atest/Widget.robot +++ b/atest/Widget.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Documentation Does the Jupyter Widget work? Resource _Keywords.robot diff --git a/atest/_CodeMirror.robot b/atest/_CodeMirror.robot index 154f1120..85e8d1c7 100644 --- a/atest/_CodeMirror.robot +++ b/atest/_CodeMirror.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Documentation Common behaviors for CodeMirror instances diff --git a/atest/_Keywords.robot b/atest/_Keywords.robot index 5372f868..cc4901eb 100644 --- a/atest/_Keywords.robot +++ b/atest/_Keywords.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Resource _Variables.robot Library SeleniumLibrary @@ -284,4 +298,6 @@ Launch Untitled Diagram Click Element ${XP LAUNCH TAB} Wait Until Element is Enabled ${CSS LAUNCH DIO} Click Element ${CSS LAUNCH DIO} - Wait Until Element is Visible ${CSS DIO IFRAME} + Sleep 1s + Unselect Frame + Wait Until Element is Visible ${CSS DIO IFRAME} timeout=20s diff --git a/atest/_Notebook.robot b/atest/_Notebook.robot index b707700d..04a55b45 100644 --- a/atest/_Notebook.robot +++ b/atest/_Notebook.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Resource ./_Variables.robot Resource ./_CodeMirror.robot diff --git a/atest/_Variables.robot b/atest/_Variables.robot index fa5e8612..c693fb77 100644 --- a/atest/_Variables.robot +++ b/atest/_Variables.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Variables *** ${FIXTURES} ${CURDIR}${/}fixtures ${NBSERVER CONF} jupyter_notebook_config.json diff --git a/atest/__init__.robot b/atest/__init__.robot index 63be458d..439f02c0 100644 --- a/atest/__init__.robot +++ b/atest/__init__.robot @@ -1,3 +1,17 @@ +# Copyright 2021 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. + *** Settings *** Documentation IPyDrawio Resource _Keywords.robot diff --git a/atest/pdf.py b/atest/pdf.py index dabeab62..4cf28ef4 100644 --- a/atest/pdf.py +++ b/atest/pdf.py @@ -1,5 +1,19 @@ -""" do out-of-band things with the export server -""" +"""do out-of-band things with the export server""" + +# Copyright 2021 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. + import requests diff --git a/atest/ports.py b/atest/ports.py index 439227b6..743e3a2c 100644 --- a/atest/ports.py +++ b/atest/ports.py @@ -1,5 +1,19 @@ -""" get a random port -""" +"""get a random port""" + +# Copyright 2021 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. + import socket diff --git a/dodo.py b/dodo.py index adaec967..ff1595ea 100644 --- a/dodo.py +++ b/dodo.py @@ -14,6 +14,21 @@ doit -n8 lint """ + +# Copyright 2021 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. + import shutil import subprocess import time @@ -56,6 +71,23 @@ def task_dist(): ) +def task_env(): + def _update_binder(): + comment = " ### ipydrawio-dev-deps ###" + old_binder = P.ENV_BINDER.read_text(encoding="utf-8").split(comment) + ci = P.ENV_CI.read_text(encoding="utf-8").split(comment) + P.ENV_BINDER.write_text( + "\n".join([old_binder[0], comment, ci[1], comment, old_binder[2]]) + ) + + yield dict( + name="binder", + file_dep=[P.ENV_CI], + actions=[_update_binder], + targets=[P.ENV_BINDER], + ) + + def task_submodules(): """ensure submodules are available""" subs = subprocess.check_output(["git", "submodule"]).decode("utf-8").splitlines() @@ -143,6 +175,7 @@ def task_setup(): [ *P.LAB_EXT, "develop", + "--debug", "--overwrite", ".", ], @@ -582,6 +615,7 @@ def task_test(): *P.PY_SRC[pkg], P.PY_SETUP_CFG[pkg], *P.PY_TEST_DEP.get(pkg, []), + P.OK_PROVISION, P.OK_PIP_CHECK, ], actions=[PythonInteractiveAction(_pytest(setup))], diff --git a/packages/.eslintrc.js b/packages/.eslintrc.js index 67e21afb..252d605b 100644 --- a/packages/.eslintrc.js +++ b/packages/.eslintrc.js @@ -1,3 +1,19 @@ +/* + Copyright 2021 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. +*/ + module.exports = { env: { browser: true, diff --git a/packages/_meta/src/index.ts b/packages/_meta/src/index.ts index 45de3d93..bd15740d 100644 --- a/packages/_meta/src/index.ts +++ b/packages/_meta/src/index.ts @@ -1,17 +1,19 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 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. +*/ + import '@deathbeds/ipydrawio'; import '@deathbeds/ipydrawio-pdf'; import '@deathbeds/ipydrawio-notebook'; diff --git a/packages/ipydrawio-notebook/README.md b/packages/ipydrawio-notebook/README.md index 6d8e65ad..26606766 100644 --- a/packages/ipydrawio-notebook/README.md +++ b/packages/ipydrawio-notebook/README.md @@ -17,4 +17,20 @@ information. This work is licensed under the [Apache-2.0] License. +``` +Copyright 2021 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. +``` + [apache-2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt diff --git a/packages/ipydrawio-notebook/src/index.ts b/packages/ipydrawio-notebook/src/index.ts index a1d810a5..8ca3dec6 100644 --- a/packages/ipydrawio-notebook/src/index.ts +++ b/packages/ipydrawio-notebook/src/index.ts @@ -1,2 +1,18 @@ +/* + Copyright 2021 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. +*/ + export * from './tokens'; export * from './io'; diff --git a/packages/ipydrawio-notebook/src/io.ts b/packages/ipydrawio-notebook/src/io.ts index b3c0ae13..200edb55 100644 --- a/packages/ipydrawio-notebook/src/io.ts +++ b/packages/ipydrawio-notebook/src/io.ts @@ -1,3 +1,19 @@ +/* + Copyright 2021 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. +*/ + import { ReadonlyPartialJSONObject } from '@lumino/coreutils'; import { NotebookModel } from '@jupyterlab/notebook'; import { Contents } from '@jupyterlab/services'; diff --git a/packages/ipydrawio-notebook/src/plugin.ts b/packages/ipydrawio-notebook/src/plugin.ts index 3df956ec..a6e2bf28 100644 --- a/packages/ipydrawio-notebook/src/plugin.ts +++ b/packages/ipydrawio-notebook/src/plugin.ts @@ -1,16 +1,18 @@ -// Copyright 2021 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. +/* + Copyright 2021 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. +*/ import { JupyterLab, JupyterFrontEndPlugin } from '@jupyterlab/application'; diff --git a/packages/ipydrawio-notebook/src/tokens.ts b/packages/ipydrawio-notebook/src/tokens.ts index 67e60b09..6dc94ba3 100644 --- a/packages/ipydrawio-notebook/src/tokens.ts +++ b/packages/ipydrawio-notebook/src/tokens.ts @@ -1,3 +1,19 @@ +/* + Copyright 2021 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. +*/ + export const NS = '@deathbeds/ipydrawio-notebook'; export const PLUGIN_ID = `${NS}:plugin`; export const CMD_NS = 'ipydrawio'; diff --git a/packages/ipydrawio-notebook/src/toolbar.ts b/packages/ipydrawio-notebook/src/toolbar.ts index 693b2d01..94fe3f41 100644 --- a/packages/ipydrawio-notebook/src/toolbar.ts +++ b/packages/ipydrawio-notebook/src/toolbar.ts @@ -1,3 +1,19 @@ +/* + Copyright 2021 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. +*/ + import { IDisposable, DisposableDelegate } from '@lumino/disposable'; import { CommandRegistry } from '@lumino/commands'; diff --git a/packages/ipydrawio-pdf/README.md b/packages/ipydrawio-pdf/README.md index 83eda916..35090c7b 100644 --- a/packages/ipydrawio-pdf/README.md +++ b/packages/ipydrawio-pdf/README.md @@ -17,4 +17,20 @@ information. This work is licensed under the [Apache-2.0] License. +``` +Copyright 2021 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. +``` + [apache-2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt diff --git a/packages/ipydrawio-pdf/src/index.ts b/packages/ipydrawio-pdf/src/index.ts index 322e49c8..8ca3dec6 100644 --- a/packages/ipydrawio-pdf/src/index.ts +++ b/packages/ipydrawio-pdf/src/index.ts @@ -1,16 +1,18 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 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. +*/ + export * from './tokens'; export * from './io'; diff --git a/packages/ipydrawio-pdf/src/io.ts b/packages/ipydrawio-pdf/src/io.ts index e412347c..a8f03c2d 100644 --- a/packages/ipydrawio-pdf/src/io.ts +++ b/packages/ipydrawio-pdf/src/io.ts @@ -1,17 +1,19 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 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. +*/ + import { DRAWIO_ICON_CLASS_RE, DRAWIO_ICON_SVG, diff --git a/packages/ipydrawio-pdf/src/manager.ts b/packages/ipydrawio-pdf/src/manager.ts index 4b38a776..5bd20626 100644 --- a/packages/ipydrawio-pdf/src/manager.ts +++ b/packages/ipydrawio-pdf/src/manager.ts @@ -1,3 +1,19 @@ +/* + Copyright 2021 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. +*/ + import { PageConfig } from '@jupyterlab/coreutils'; import { ISettingRegistry } from '@jupyterlab/settingregistry'; diff --git a/packages/ipydrawio-pdf/src/plugin.ts b/packages/ipydrawio-pdf/src/plugin.ts index e3dbb256..980c5a57 100644 --- a/packages/ipydrawio-pdf/src/plugin.ts +++ b/packages/ipydrawio-pdf/src/plugin.ts @@ -1,17 +1,18 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 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. +*/ import { JupyterLab, JupyterFrontEndPlugin } from '@jupyterlab/application'; import { ICommandPalette } from '@jupyterlab/apputils'; diff --git a/packages/ipydrawio-pdf/src/status.tsx b/packages/ipydrawio-pdf/src/status.tsx index 5f9baefd..8272f9b2 100644 --- a/packages/ipydrawio-pdf/src/status.tsx +++ b/packages/ipydrawio-pdf/src/status.tsx @@ -1,17 +1,19 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 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. +*/ + import React from 'react'; import { VDomRenderer, VDomModel } from '@jupyterlab/apputils'; diff --git a/packages/ipydrawio-pdf/src/tokens.ts b/packages/ipydrawio-pdf/src/tokens.ts index 139160d4..3b130258 100644 --- a/packages/ipydrawio-pdf/src/tokens.ts +++ b/packages/ipydrawio-pdf/src/tokens.ts @@ -1,3 +1,19 @@ +/* + Copyright 2021 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. +*/ + export const NS = '@deathbeds/ipydrawio-pdf'; export const PLUGIN_ID = `${NS}:plugin`; export const CMD_NS = `ipydrawio-pdf`; diff --git a/packages/ipydrawio-webpack/README.md b/packages/ipydrawio-webpack/README.md index e6911bbf..8ad367fc 100644 --- a/packages/ipydrawio-webpack/README.md +++ b/packages/ipydrawio-webpack/README.md @@ -19,4 +19,20 @@ This work is licensed under the [Apache-2.0] License. The vendored [@jgraph/drawio](https://github.com/jgraph/drawio) is also licensed under the [Apache-2.0] license. +``` +Copyright 2021 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. +``` + [apache-2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt diff --git a/packages/ipydrawio-webpack/scripts/bump.py b/packages/ipydrawio-webpack/scripts/bump.py deleted file mode 100644 index 55834f26..00000000 --- a/packages/ipydrawio-webpack/scripts/bump.py +++ /dev/null @@ -1,2 +0,0 @@ -""" update _static.js so assets can be found when webpacked -""" diff --git a/packages/ipydrawio-webpack/scripts/patch.py b/packages/ipydrawio-webpack/scripts/patch.py index 473415ec..edd9a320 100644 --- a/packages/ipydrawio-webpack/scripts/patch.py +++ b/packages/ipydrawio-webpack/scripts/patch.py @@ -1,5 +1,19 @@ -""" patch drawio sources for embedding in JupyterLab -""" +""" patch drawio sources for embedding in JupyterLab""" + +# Copyright 2021 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. + import subprocess from pathlib import Path diff --git a/packages/ipydrawio-webpack/scripts/static.py b/packages/ipydrawio-webpack/scripts/static.py index 41128f45..2b5aaa73 100644 --- a/packages/ipydrawio-webpack/scripts/static.py +++ b/packages/ipydrawio-webpack/scripts/static.py @@ -1,3 +1,19 @@ +"""update the vendored drawio""" + +# Copyright 2021 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. + from fnmatch import fnmatch from pathlib import Path from pprint import pprint diff --git a/packages/ipydrawio/README.md b/packages/ipydrawio/README.md index fdb6d95b..b6a886c6 100644 --- a/packages/ipydrawio/README.md +++ b/packages/ipydrawio/README.md @@ -17,3 +17,19 @@ pip install ipydrawio This work is licensed under the [Apache-2.0] License. [apache-2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt + +``` +Copyright 2021 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. +``` diff --git a/packages/ipydrawio/src/document.ts b/packages/ipydrawio/src/document.ts index f754733b..1820108d 100644 --- a/packages/ipydrawio/src/document.ts +++ b/packages/ipydrawio/src/document.ts @@ -1,18 +1,21 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio contributors -// Copyright 2018 Wolf Vollprecht -// -// 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio contributors + Copyright 2018 Wolf Vollprecht + + 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. +*/ + import { ReadonlyPartialJSONObject } from '@lumino/coreutils'; import { PathExt } from '@jupyterlab/coreutils'; diff --git a/packages/ipydrawio/src/editor.ts b/packages/ipydrawio/src/editor.ts index 7d5f066b..1dcc1ef7 100644 --- a/packages/ipydrawio/src/editor.ts +++ b/packages/ipydrawio/src/editor.ts @@ -1,18 +1,21 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio contributors -// Copyright 2018 Wolf Vollprecht -// -// 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio contributors + Copyright 2018 Wolf Vollprecht + + 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. +*/ + import { PromiseDelegate } from '@lumino/coreutils'; import { Message } from '@lumino/messaging'; import { Signal } from '@lumino/signaling'; diff --git a/packages/ipydrawio/src/index.ts b/packages/ipydrawio/src/index.ts index abb0cd9e..59220f16 100644 --- a/packages/ipydrawio/src/index.ts +++ b/packages/ipydrawio/src/index.ts @@ -1,17 +1,20 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio contributors + Copyright 2018 Wolf Vollprecht + + 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. +*/ export * from './tokens'; export * from './io'; diff --git a/packages/ipydrawio/src/io.ts b/packages/ipydrawio/src/io.ts index bb09b42e..ece0daea 100644 --- a/packages/ipydrawio/src/io.ts +++ b/packages/ipydrawio/src/io.ts @@ -1,17 +1,20 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ + import { LabIcon } from '@jupyterlab/ui-components'; import DRAWIO_ICON_SVG from '../style/img/drawio.svg'; diff --git a/packages/ipydrawio/src/manager.ts b/packages/ipydrawio/src/manager.ts index c1dc86a0..592e8b9d 100644 --- a/packages/ipydrawio/src/manager.ts +++ b/packages/ipydrawio/src/manager.ts @@ -1,17 +1,20 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ + import { IWidgetTracker, WidgetTracker, diff --git a/packages/ipydrawio/src/mime.ts b/packages/ipydrawio/src/mime.ts index 2a01185a..1b6308ce 100644 --- a/packages/ipydrawio/src/mime.ts +++ b/packages/ipydrawio/src/mime.ts @@ -1,3 +1,20 @@ +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ + import { IRenderMime } from '@jupyterlab/rendermime-interfaces'; import { Panel, PanelLayout } from '@lumino/widgets'; import { ALL_MIME_FORMATS } from './io'; diff --git a/packages/ipydrawio/src/plugin.ts b/packages/ipydrawio/src/plugin.ts index 3ddec107..2a2fcb05 100644 --- a/packages/ipydrawio/src/plugin.ts +++ b/packages/ipydrawio/src/plugin.ts @@ -1,16 +1,20 @@ -// Copyright 2018 Wolf Vollprecht -// -// 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio contributors + Copyright 2018 Wolf Vollprecht + + 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. +*/ import { IStatusBar } from '@jupyterlab/statusbar'; import { Menu } from '@lumino/widgets'; diff --git a/packages/ipydrawio/src/status.tsx b/packages/ipydrawio/src/status.tsx index ff937064..66b37bc3 100644 --- a/packages/ipydrawio/src/status.tsx +++ b/packages/ipydrawio/src/status.tsx @@ -1,17 +1,20 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ + import React from 'react'; import { VDomRenderer, VDomModel } from '@jupyterlab/apputils'; diff --git a/packages/ipydrawio/src/tokens.ts b/packages/ipydrawio/src/tokens.ts index 61693db2..698cd6a7 100644 --- a/packages/ipydrawio/src/tokens.ts +++ b/packages/ipydrawio/src/tokens.ts @@ -1,17 +1,20 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio contributors + Copyright 2018 Wolf Vollprecht + + 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. +*/ import { Token } from '@lumino/coreutils'; import { Contents } from '@jupyterlab/services'; diff --git a/packages/ipydrawio/src/typings.d.ts b/packages/ipydrawio/src/typings.d.ts index 5ad43f73..1aa6dfce 100644 --- a/packages/ipydrawio/src/typings.d.ts +++ b/packages/ipydrawio/src/typings.d.ts @@ -1,17 +1,20 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ + declare module '*.svg' { const script: string; export default script; diff --git a/packages/ipydrawio/src/utils.ts b/packages/ipydrawio/src/utils.ts index 8966ebdc..15e0c432 100644 --- a/packages/ipydrawio/src/utils.ts +++ b/packages/ipydrawio/src/utils.ts @@ -1,17 +1,19 @@ -// Copyright 2021 ipydrawio contributors -// Copyright 2020 jupyterlab-drawio 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. +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ export function stripDataURI(raw: string) { return raw.split(',')[1]; diff --git a/packages/ipydrawio/src/widgetPlugin.ts b/packages/ipydrawio/src/widgetPlugin.ts index 7b9d6cd7..69dd1c3c 100644 --- a/packages/ipydrawio/src/widgetPlugin.ts +++ b/packages/ipydrawio/src/widgetPlugin.ts @@ -1,3 +1,20 @@ +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ + import { Application, IPlugin } from '@lumino/application'; import { Widget } from '@lumino/widgets'; diff --git a/packages/ipydrawio/src/widgets.ts b/packages/ipydrawio/src/widgets.ts index 34264269..03780e22 100644 --- a/packages/ipydrawio/src/widgets.ts +++ b/packages/ipydrawio/src/widgets.ts @@ -1,3 +1,20 @@ +/* + Copyright 2021 ipydrawio contributors + Copyright 2020 jupyterlab-drawio 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. +*/ + import { Throttler } from '@lumino/polling'; import { JSONExt } from '@lumino/coreutils'; diff --git a/packages/ipydrawio/style/index.css b/packages/ipydrawio/style/index.css index 457d44de..0599ea10 100644 --- a/packages/ipydrawio/style/index.css +++ b/packages/ipydrawio/style/index.css @@ -1,3 +1,23 @@ +/** + Copyright 2021 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. +**/ + +.jp-IPyDiagram .jp-Diagram { + position: absolute; +} + .jp-Diagram { background-color: var(--jp-layout-color1); } diff --git a/packages/ipydrawio/style/widget.css b/packages/ipydrawio/style/widget.css index 0a3a0f22..40726b51 100644 --- a/packages/ipydrawio/style/widget.css +++ b/packages/ipydrawio/style/widget.css @@ -1,3 +1,19 @@ +/** + Copyright 2021 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. +**/ + .jp-IPyDiagram .jp-Diagram { position: absolute; } diff --git a/py_packages/ipydrawio-export/README.md b/py_packages/ipydrawio-export/README.md index 87289a6d..c26dfcef 100644 --- a/py_packages/ipydrawio-export/README.md +++ b/py_packages/ipydrawio-export/README.md @@ -83,6 +83,22 @@ This work is licensed under the [Apache-2.0] License. The vendored code from [@jgraph/draw-image-export2][] is also licensed under the [Apache-2.0][draw2-license] License. +``` +Copyright 2021 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. +``` + [@jgraph/draw-image-export2]: https://github.com/jgraph/draw-image-export2 [apache-2.0]: https://github.com/deathbeds/ipydrawio/blob/master/py_packages/ipydrawio-export/LICENSE.txt diff --git a/py_packages/ipydrawio-export/setup.cfg b/py_packages/ipydrawio-export/setup.cfg index e7f73f3b..373a7395 100644 --- a/py_packages/ipydrawio-export/setup.cfg +++ b/py_packages/ipydrawio-export/setup.cfg @@ -1,3 +1,17 @@ +# Copyright 2021 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. + [metadata] name = ipydrawio-export description = PDF export for Drawio diagrams in JupyterLab @@ -61,6 +75,7 @@ ignore = E203 [tool:pytest] junit_family=xunit2 +script_launch_mode = subprocess addopts = -vv --tb long diff --git a/py_packages/ipydrawio-export/setup.py b/py_packages/ipydrawio-export/setup.py index c69849ce..8cb48052 100644 --- a/py_packages/ipydrawio-export/setup.py +++ b/py_packages/ipydrawio-export/setup.py @@ -1,29 +1,33 @@ -""" -Copyright 2021 ipydrawio contributors -Copyright 2020 jupyterlab-drawio 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. -""" -import re +"""dynamic setup information for setuptools, also see package.json and setup.cfg""" + +# Copyright 2021 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. + +import json from pathlib import Path HERE = Path(__file__).parent EXT = HERE / "src/ipydrawio_export/labextensions" -VERSION = HERE / "src/ipydrawio_export/_version.py" -EXT_FILES = {} +PDF = EXT / "@deathbeds/ipydrawio-pdf" + SHARE = "share/jupyter/labextensions" +__js__ = json.loads((PDF / "package.json").read_text(encoding="utf-8")) + +EXT_FILES = {} + for ext_path in [EXT] + [d for d in EXT.rglob("*") if d.is_dir()]: if ext_path == EXT: target = str(SHARE) @@ -48,10 +52,7 @@ import setuptools setuptools.setup( - version=re.findall( - r"""__version__\s*=\s*"([^"]+)""", - VERSION.read_text(encoding="utf-8") - )[0], + version=__js__["version"], data_files=[ *[(k, v) for k, v in EXT_FILES.items()], ], diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/__init__.py b/py_packages/ipydrawio-export/src/ipydrawio_export/__init__.py index 123c8e5d..a88e4658 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/__init__.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/__init__.py @@ -1,37 +1,25 @@ -""" -programmatic drawio export - -Copyright 2021 ipydrawio contributors -Copyright 2020 jupyterlab-drawio 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. -""" +"""programmatic drawio export""" + +# Copyright 2021 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. from pathlib import Path -from ._version import __version__ +from ._version import __js__, __version__ from .manager import DRAWIO_STATIC, IPyDrawioExportManager from .serverextension import load_jupyter_server_extension -__all__ = [ - "__version__", - "_jupyter_labextension_paths", - "_jupyter_server_extension_paths", - "IPyDrawioExportManager", - "load_jupyter_server_extension", - "DRAWIO_STATIC", -] - def _jupyter_labextension_paths(): """static paths to link for interactive installation""" @@ -49,3 +37,14 @@ def _jupyter_labextension_paths(): def _jupyter_server_extension_paths(): """python module to load as extension""" return [{"module": "ipydrawio_export"}] + + +__all__ = [ + "__js__", + "__version__", + "_jupyter_labextension_paths", + "_jupyter_server_extension_paths", + "DRAWIO_STATIC", + "IPyDrawioExportManager", + "load_jupyter_server_extension", +] diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/_version.py b/py_packages/ipydrawio-export/src/ipydrawio_export/_version.py index 3f6f4296..6692d238 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/_version.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/_version.py @@ -1,18 +1,31 @@ -""" -source of truth for ipydrawio-export version +""" source of truth for ipydrawio-export version""" -Copyright 2021 ipydrawio contributors +# Copyright 2021 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. -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 +import json +from pathlib import Path -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. -""" -__version__ = "1.0.0" +HERE = Path(__file__).parent + +__js__ = json.loads( + (HERE / "labextensions/@deathbeds/ipydrawio-pdf/package.json").read_text( + encoding="utf-8" + ) +) + +__version__ = __js__["version"] + +__all__ = ["__version__", "__js__"] diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/app.py b/py_packages/ipydrawio-export/src/ipydrawio_export/app.py index 3aa1d28e..0ff2feab 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/app.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/app.py @@ -1,26 +1,25 @@ -""" -CLI for ipydrawio-export +"""CLI for ipydrawio-export""" + +# Copyright 2021 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. -Copyright 2021 ipydrawio contributors -Copyright 2020 jupyterlab-drawio 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. -""" import base64 import json from pathlib import Path import traitlets as T +from jupyter_core.application import base_flags from tornado import ioloop from traitlets.config import Application @@ -64,11 +63,26 @@ def _stop(): class ProvisionApp(ManagedApp): """pre-provision drawio export tools""" + show_workdir = T.Bool(False).tag(config=True) + + flags = dict( + **base_flags, + workdir=( + {"ProvisionApp": {"show_workdir": True}}, + "Print the export working directory", + ), + ) + async def start_async(self): - try: - await self.drawio_manager.provision(force=True) - finally: + if self.show_workdir: + print(str(Path(self.drawio_manager.drawio_export_workdir).resolve())) self.stop() + return + else: # pragma: no cover + try: + await self.drawio_manager.provision(force=True) + finally: + self.stop() class PDFApp(ManagedApp): diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/constants.py b/py_packages/ipydrawio-export/src/ipydrawio_export/constants.py index 4c075ea8..120cbf48 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/constants.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/constants.py @@ -1,7 +1,33 @@ +"""constants for ipydrawio-export""" + +# Copyright 2021 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. + +# the header to look for in PNG metadata PNG_DRAWIO_INFO = "mxfile" # TODO: hoist this to `package.json` and consume directly DRAWIO_APP = ( "../labextensions/@deathbeds/ipydrawio-webpack/static/drawio/src/main/webapp" ) + +# key set in notebook#/metadata/ IPYNB_METADATA = "@deathbeds/ipydrawio" + +# environment variables +ENV_JUPYTER_DATA_DIR = "JUPYTER_DATA_DIR" +ENV_IPYDRAWIO_DATA_DIR = "IPYDRAWIO_DATA_DIR" + +# always appended to *_DATA_DIR +WORK_DIR = "ipydrawio_export" diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/handlers.py b/py_packages/ipydrawio-export/src/ipydrawio_export/handlers.py index 8b437f96..b6e5c791 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/handlers.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/handlers.py @@ -1,21 +1,19 @@ -""" -tornado handlers for managing and communicating with drawio export server +"""tornado handlers for managing and communicating with drawio export server""" + +# Copyright 2021 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. -Copyright 2021 ipydrawio contributors -Copyright 2020 jupyterlab-drawio 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. -""" from jupyter_server.base.handlers import JupyterHandler from jupyter_server.utils import url_path_join as ujoin from tornado.web import authenticated diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/manager.py b/py_packages/ipydrawio-export/src/ipydrawio_export/manager.py index b22c74f5..861b51bd 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/manager.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/manager.py @@ -1,21 +1,19 @@ -""" -the drawio export manager +"""drawio export manager""" + +# Copyright 2021 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. -Copyright 2021 ipydrawio contributors -Copyright 2020 jupyterlab-drawio 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. -""" import asyncio import atexit import os @@ -41,9 +39,15 @@ from traitlets import Bool, Dict, Instance, Int, Unicode, default from traitlets.config import LoggingConfigurable -from .constants import DRAWIO_APP, PNG_DRAWIO_INFO +from .constants import ( + DRAWIO_APP, + ENV_IPYDRAWIO_DATA_DIR, + ENV_JUPYTER_DATA_DIR, + PNG_DRAWIO_INFO, + WORK_DIR, +) -VEND = Path(__file__).parent / "vendor" / "draw-image-export2" +VEND = Path(__file__).parent / "vendor/draw-image-export2" DRAWIO_STATIC = (Path(get_app_dir()) / DRAWIO_APP).resolve() @@ -64,6 +68,7 @@ class IPyDrawioExportManager(LoggingConfigurable): drawio_export_workdir = Unicode().tag(config=True) pdf_cache = Unicode(allow_none=True).tag(config=True) attach_xml = Bool().tag(config=True) + attachment_name = Unicode("diagram.drawio").tag(config=True) is_provisioning = Bool(False) is_starting = Bool(False) init_wait_sec = Int(2).tag(config=True) @@ -136,15 +141,15 @@ def _default_core_params(self): def _default_drawio_export_workdir(self): data_root = Path(sys.prefix) / "share/jupyter" - if "JUPYTER_DATA_DIR" in os.environ: - data_root = Path(os.environ["JUPYTER_DATA_DIR"]) + if ENV_JUPYTER_DATA_DIR in os.environ: + data_root = Path(os.environ[ENV_JUPYTER_DATA_DIR]) - if "IPYDRAWIO_DATA_DIR" in os.environ: - data_root = Path(os.environ["IPYDRAWIO_DATA_DIR"]) + if ENV_IPYDRAWIO_DATA_DIR in os.environ: + data_root = Path(os.environ[ENV_IPYDRAWIO_DATA_DIR]) - workdir = str(data_root / "ipydrawio_export") + workdir = str(data_root if data_root.name == WORK_DIR else data_root / WORK_DIR) - self.log.debug(f"[ipydrawio] workdir: {workdir}") + self.log.debug(f"[ipydrawio-export] workdir: {workdir}") return workdir @default("attach_xml") @@ -191,7 +196,30 @@ def _pdf(self, pdf_request): retries -= 1 if res: - self.log.debug(f"[ipydrawio-export] PDF-in-text {len(res.text)} bytes") + self.log.debug(f"[ipydrawio-export] {len(res.text)} bytes") + + if pdf_text and self.attach_xml and self.attachments: + self.log.info( + f"[ipydrawio-export] attaching drawio XML as {self.attachment_name}" + ) + with tempfile.TemporaryDirectory() as td: + tdp = Path(td) + output_pdf = tdp / "original.pdf" + output_pdf.write_bytes(b64decode(pdf_text)) + final_pdf = tdp / "final.pdf" + final = PdfFileWriter() + final.appendPagesFromReader(PdfFileReader(str(output_pdf), "rb")) + xml = pdf_request["xml"] + if hasattr(xml, "encode"): + xml = xml.encode("utf-8") + final.addAttachment(self.attachment_name, xml) + with final_pdf.open("wb") as fpt: + final.write(fpt) + + pdf_text = b64encode(final_pdf.read_bytes()) + self.log.debug( + f"[ipydrawio-export] {len(pdf_text)} bytes (with attachment)" + ) return pdf_text @@ -240,9 +268,7 @@ def _merge(self, pdf_requests): for diagram in self.extract_diagrams(pdf_request): tree.append(diagram) next_pdf = tdp / f"doc-{i}.pdf" - wrote = next_pdf.write_bytes( - b64decode(pdf_request["pdf"].encode("utf-8")) - ) + wrote = next_pdf.write_bytes(b64decode(pdf_request["pdf"])) if wrote: merger.append(PdfFileReader(str(next_pdf))) output_pdf = tdp / "output.pdf" @@ -252,7 +278,7 @@ def _merge(self, pdf_requests): final = PdfFileWriter() final.appendPagesFromReader(PdfFileReader(str(output_pdf), "rb")) if self.attach_xml: - final.addAttachment("drawing.drawio", composite_xml.encode("utf-8")) + final.addAttachment(self.attachment_name, composite_xml.encode("utf-8")) with final_pdf.open("wb") as fpt: final.write(fpt) return b64encode(final_pdf.read_bytes()).decode("utf-8") @@ -313,23 +339,26 @@ def drawio_export_integrity(self): return self.drawio_export_node_modules / ".yarn-integrity" @run_on_executor - def provision(self, force=False): + def provision(self, force=False): # pragma: no cover self.is_provisioning = True if not self.drawio_export_app.exists(): if not self.drawio_export_app.parent.exists(): self.drawio_export_app.parent.mkdir(parents=True) - self.log.warning( - "initializing drawio export app %s", self.drawio_export_app + self.log.info( + "[ipydrawio-export] initializing drawio export app %s", + self.drawio_export_app, ) shutil.copytree(VEND, self.drawio_export_app) else: - self.log.warning( - "using existing drawio export folder %s", self.drawio_export_app + self.log.info( + "[ipydrawio-export] using existing drawio export folder %s", + self.drawio_export_app, ) if not self.drawio_export_node_modules.exists() or force: - self.log.warning( - "installing drawio export dependencies %s", self.drawio_export_app + self.log.info( + "[ipydrawio-export] installing drawio export dependencies %s", + self.drawio_export_app, ) subprocess.check_call( [str(JLPM), "--silent"], cwd=str(self.drawio_export_app) @@ -347,3 +376,16 @@ def get_unused_port(self): port = sock.getsockname()[1] sock.close() return port + + def attachments(self, pdf_path): + """iterate over the name, attachment pairs in the PDF""" + reader = PdfFileReader(str(pdf_path), "rb") + attachments = [] + try: + attachments = reader.trailer["/Root"]["/Names"]["/EmbeddedFiles"]["/Names"] + except KeyError: + pass + for i, name in enumerate(attachments, 1): + if not isinstance(name, str): + continue + yield name, attachments[i].getObject()["/EF"]["/F"].getData() diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/serverextension.py b/py_packages/ipydrawio-export/src/ipydrawio_export/serverextension.py index bc45a7f2..2e23245c 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/serverextension.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/serverextension.py @@ -1,21 +1,18 @@ -""" -add drawio support to the running jupyter notebook application - -Copyright 2021 ipydrawio contributors -Copyright 2020 jupyterlab-drawio 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. -""" +"""add drawio support to a running jupyter application""" + +# Copyright 2021 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. import traitlets diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/__init__.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/__init__.py index e69de29b..41c4cc4a 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/__init__.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/__init__.py @@ -0,0 +1,15 @@ +"""tests of ipydrawio-export""" + +# Copyright 2021 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. diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/conftest.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/conftest.py index c956a72f..d347c7e4 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/conftest.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/conftest.py @@ -1,9 +1,25 @@ +"""ipydrawio-export test environment""" + +# Copyright 2021 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. + import shutil from pathlib import Path import pytest -from ..app import PDFApp, ProvisionApp +from ..app import PDFApp FIXTURES = Path(__file__).parent / "fixtures" FIXTURE_FILES = sorted([f for f in FIXTURES.glob("*") if not f.is_dir()]) @@ -25,14 +41,6 @@ def export_app(tmp_path): app.drawio_manager.stop_server() -@pytest.fixture -def provision_app(tmp_path): - app = ProvisionApp() - app.drawio_manager.drawio_export_workdir = str(tmp_path) - yield app - app.drawio_manager.stop_server() - - @pytest.fixture def empty_dio(tmp_path): src = FIXTURES / "empty.dio" diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_app.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_app.py index 80dcfef7..8420918c 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_app.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_app.py @@ -1,4 +1,21 @@ +"""test basic app functionality""" + +# Copyright 2021 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. + + def test_app_args(export_app): - assert not export_app.dio_files + assert not export_app.dio_files, "shouldn't have any files by default" export_app.parse_command_line(["foo.dio"]) - assert export_app.dio_files + assert export_app.dio_files, "shouldn't have some files" diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_cli.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_cli.py index 8686b096..4a906ccf 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_cli.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_cli.py @@ -1,10 +1,28 @@ -import pytest +"""test basic CLI functionality""" + +# Copyright 2021 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. from .. import __version__ -@pytest.mark.script_launch_mode("subprocess") def test_cli_version(script_runner): ret = script_runner.run("jupyter", "ipydrawio-export", "--version") assert ret.success assert __version__ in ret.stdout + + +def test_cli_workdir(script_runner): + ret = script_runner.run("jupyter", "ipydrawio-export", "provision", "--workdir") + assert ret.success diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_meta.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_meta.py index 7bcb2cc0..c07d478b 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_meta.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_meta.py @@ -1,13 +1,37 @@ -from .. import __version__, _jupyter_labextension_paths, _jupyter_server_extension_paths +"""ipydrawio-export metadata tests""" + +# Copyright 2021 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. + +import ipydrawio_export def test_version(): - assert __version__ + assert ipydrawio_export.__version__, "no version" + + +def test_js(): + assert ipydrawio_export.__js__, "no js metadata" def test_magic_lab_extensions(): - assert len(_jupyter_labextension_paths()) == 1 + assert ( + len(ipydrawio_export._jupyter_labextension_paths()) == 1 + ), "too many/few labextensions" def test_magic_server_extensions(): - assert len(_jupyter_server_extension_paths()) == 1 + assert ( + len(ipydrawio_export._jupyter_server_extension_paths()) == 1 + ), "too many/few serverextensions" diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_pdf.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_pdf.py index a38b8a54..50d936a5 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_pdf.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_pdf.py @@ -1,17 +1,50 @@ +"""ipydrawio-export pdf tests""" + +# Copyright 2021 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. + +import pytest from PyPDF2 import PdfFileReader -def test_export_empty(export_app, any_diagram, tmp_path): +@pytest.mark.parametrize("attach_xml", [0, 1]) +def test_export_empty(tmp_path, export_app, any_diagram, attach_xml): + manager = export_app.drawio_manager + manager.attach_xml = bool(attach_xml) + export_app.dio_files = [any_diagram] export_app.start() + out = tmp_path / f"{any_diagram.stem}.pdf" reader = PdfFileReader(str(out), "rb") assert reader.getNumPages() == 1 + attachments = sorted(manager.attachments(out)) + assert len(attachments) == attach_xml + + +@pytest.mark.parametrize("attach_xml", [0, 1]) +def test_export_merged(tmp_path, export_app, empty_dio, svg, png, ipynb, attach_xml): + manager = export_app.drawio_manager + manager.attach_xml = bool(attach_xml) -def test_export_merged(export_app, empty_dio, svg, png, ipynb, tmp_path): export_app.dio_files = [empty_dio, svg, png, ipynb] export_app.start() + out = tmp_path / f"{empty_dio.stem}.pdf" reader = PdfFileReader(str(out), "rb") assert reader.getNumPages() == 4 + + attachments = sorted(manager.attachments(out)) + assert len(attachments) == attach_xml diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_provision.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_provision.py deleted file mode 100644 index c7d6842e..00000000 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_provision.py +++ /dev/null @@ -1,3 +0,0 @@ -def test_provision(provision_app, tmp_path): - provision_app.start() - assert [*tmp_path.glob("*")] diff --git a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_serverextension.py b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_serverextension.py index ef943db0..0b6ba533 100644 --- a/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_serverextension.py +++ b/py_packages/ipydrawio-export/src/ipydrawio_export/tests/test_serverextension.py @@ -1,3 +1,19 @@ +"""ipydrawio-export serverextension tests""" + +# Copyright 2021 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. + import asyncio from urllib.parse import urlencode diff --git a/py_packages/ipydrawio/README.md b/py_packages/ipydrawio/README.md index 78a90179..1674223c 100644 --- a/py_packages/ipydrawio/README.md +++ b/py_packages/ipydrawio/README.md @@ -60,11 +60,17 @@ pip install ipydrawio ipydrawio-export > please see _Diagram_ options available in the _Command Palette_ and > various _Main Menu_ menus. +## Configuring + +- Change the _Diagram Theme_ from the _Settings_ + +> Use _Advanced Settings_ to modify drawio embedding parameters + ### PDF: Lab and Server extensions `ipydrawio-export` can generate print-quality PDF. This approach relies on a -headless browser, powered by [@jgraph/draw-image-export2] and ultimately -`puppeteer` which in turn requires `nodejs`. +headless browser, powered by [@jgraph/draw-image-export2], `puppeteer`, and +`nodejs`. - **native dependencies** as required to appease `puppeteer` - if running in `docker`, this can be a bit trial-and-error @@ -105,6 +111,22 @@ The original source code vendored in this package from: - [@jgraph/drawio][] - [@jgraph/draw-image-export2][] +``` +Copyright 2021 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. +``` + [apache 2.0]: https://github.com/deathbeds/ipydrawio/blob/master/LICENSE.txt [@jgraph/drawio]: https://github.com/jgraph/drawio [@jgraph/draw-image-export2]: https://github.com/jgraph/draw-image-export2 diff --git a/py_packages/ipydrawio/setup.cfg b/py_packages/ipydrawio/setup.cfg index c59872fb..8f4ffdeb 100644 --- a/py_packages/ipydrawio/setup.cfg +++ b/py_packages/ipydrawio/setup.cfg @@ -1,3 +1,17 @@ +# Copyright 2021 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. + [metadata] name = ipydrawio description = Draw.io Diagrams as Jupyter Widgets diff --git a/py_packages/ipydrawio/setup.py b/py_packages/ipydrawio/setup.py index 181a8c41..11313378 100644 --- a/py_packages/ipydrawio/setup.py +++ b/py_packages/ipydrawio/setup.py @@ -1,29 +1,35 @@ -""" -Copyright 2021 ipydrawio contributors -Copyright 2020 jupyterlab-drawio 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. -""" +"""dynamic setup information for setuptools, also see package.json and setup.cfg""" + +# Copyright 2021 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. + import re from pathlib import Path +import json HERE = Path(__file__).parent + + EXT = HERE / "src/ipydrawio/labextensions" -VERSION = HERE / "src/ipydrawio/_version.py" +CORE = EXT / "@deathbeds/ipydrawio" -EXT_FILES = {} SHARE = "share/jupyter/labextensions" +__js__ = json.loads((CORE / "package.json").read_text(encoding="utf-8")) + +EXT_FILES = {} + for ext_path in [EXT] + [d for d in EXT.rglob("*") if d.is_dir()]: if ext_path == EXT: target = str(SHARE) @@ -44,10 +50,7 @@ import setuptools setuptools.setup( - version=re.findall( - r"""__version__\s*=\s*"([^"]+)""", - VERSION.read_text(encoding="utf-8") - )[0], + version=__js__["version"], data_files=[ *[(k, v) for k, v in EXT_FILES.items()], ], diff --git a/py_packages/ipydrawio/src/ipydrawio/__init__.py b/py_packages/ipydrawio/src/ipydrawio/__init__.py index a3749fc0..37abd1e4 100644 --- a/py_packages/ipydrawio/src/ipydrawio/__init__.py +++ b/py_packages/ipydrawio/src/ipydrawio/__init__.py @@ -1,6 +1,22 @@ +""""main importable for ipydrawio""" + +# Copyright 2021 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. + from pathlib import Path -from ._version import __version__ +from ._version import __js__, __version__ from .widget_diagram import Diagram @@ -16,4 +32,9 @@ def _jupyter_labextension_paths(): ] -__all__ = ["__version__", "_jupyter_labextension_paths", "Diagram"] +__all__ = [ + "__js__", + "__version__", + "_jupyter_labextension_paths", + "Diagram", +] diff --git a/py_packages/ipydrawio/src/ipydrawio/_version.py b/py_packages/ipydrawio/src/ipydrawio/_version.py index f5cd5c8b..04e13635 100644 --- a/py_packages/ipydrawio/src/ipydrawio/_version.py +++ b/py_packages/ipydrawio/src/ipydrawio/_version.py @@ -1,18 +1,31 @@ -""" -source of truth for ipydrawio version +"""source of truth for ipydrawio version""" -Copyright 2021 ipydrawio contributors +# Copyright 2021 ipydrawio contributors +# Copyright 2020 jupyterlab-drawio 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. -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 +import json +from pathlib import Path - http://www.apache.org/licenses/LICENSE-2.0 +HERE = Path(__file__).parent -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. -""" -__version__ = "1.0.0" +__js__ = json.loads( + (HERE / "labextensions/@deathbeds/ipydrawio/package.json").read_text( + encoding="utf-8" + ) +) + +__version__ = __js__["version"] + +__all__ = ["__version__", "__js__"] diff --git a/py_packages/ipydrawio/src/ipydrawio/constants.py b/py_packages/ipydrawio/src/ipydrawio/constants.py new file mode 100644 index 00000000..1295eb6c --- /dev/null +++ b/py_packages/ipydrawio/src/ipydrawio/constants.py @@ -0,0 +1,48 @@ +"""constants for ipydrawio""" + +# Copyright 2021 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. + +A_SHORT_DRAWIO = """ + + + + + + + + + +""" + +DEFAULT_PAGE_FORMAT = {"x": 0, "y": 0, "width": 850, "height": 1100} + +DEFAULT_URL_PARAMS = { + "gapi": 0, + "gl": 0, + "noExitBtn": 1, + "noSaveBtn": 1, + "od": 0, + "stealth": 1, + "tr": 0, + "ui": "min", + "format": 0, + "p": "ex;tips;svgdata;sql;anim;trees;replay;anon;flow;webcola;tags", +} + +DEFAULT_DRAWIO_CONFIG = { + "compressXml": False, + "showStartScreen": False, + "override": True, +} diff --git a/py_packages/ipydrawio/src/ipydrawio/tests/__init__.py b/py_packages/ipydrawio/src/ipydrawio/tests/__init__.py index e69de29b..756681e1 100644 --- a/py_packages/ipydrawio/src/ipydrawio/tests/__init__.py +++ b/py_packages/ipydrawio/src/ipydrawio/tests/__init__.py @@ -0,0 +1,15 @@ +"""tests for ipydrawio""" + +# Copyright 2021 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. diff --git a/py_packages/ipydrawio/src/ipydrawio/tests/conftest.py b/py_packages/ipydrawio/src/ipydrawio/tests/conftest.py index e69de29b..59028762 100644 --- a/py_packages/ipydrawio/src/ipydrawio/tests/conftest.py +++ b/py_packages/ipydrawio/src/ipydrawio/tests/conftest.py @@ -0,0 +1,15 @@ +"""test customizations""" + +# Copyright 2021 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. diff --git a/py_packages/ipydrawio/src/ipydrawio/tests/test_labextensions.py b/py_packages/ipydrawio/src/ipydrawio/tests/test_labextensions.py index 616aa05a..b158afa2 100644 --- a/py_packages/ipydrawio/src/ipydrawio/tests/test_labextensions.py +++ b/py_packages/ipydrawio/src/ipydrawio/tests/test_labextensions.py @@ -1,3 +1,19 @@ +"""minimal tests of metadata""" + +# Copyright 2021 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. + import ipydrawio @@ -5,5 +21,9 @@ def test_version(): assert ipydrawio.__version__ +def test_js(): + assert ipydrawio.__js__ + + def test_labextensions(): assert ipydrawio._jupyter_labextension_paths(), "no labextensions" diff --git a/py_packages/ipydrawio/src/ipydrawio/tests/test_widgets.py b/py_packages/ipydrawio/src/ipydrawio/tests/test_widgets.py index d733c730..d0cea0f4 100644 --- a/py_packages/ipydrawio/src/ipydrawio/tests/test_widgets.py +++ b/py_packages/ipydrawio/src/ipydrawio/tests/test_widgets.py @@ -1,3 +1,19 @@ +"""minimal widget import/invocation test""" + +# Copyright 2021 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. + import ipywidgets as W from ipydrawio import Diagram diff --git a/py_packages/ipydrawio/src/ipydrawio/widget_diagram.py b/py_packages/ipydrawio/src/ipydrawio/widget_diagram.py index 75a3a397..a1e46b6a 100644 --- a/py_packages/ipydrawio/src/ipydrawio/widget_diagram.py +++ b/py_packages/ipydrawio/src/ipydrawio/widget_diagram.py @@ -1,41 +1,33 @@ +""" jupyter widgets for drawio""" + +# Copyright 2021 ipydrawio contributors +# Copyright 2020 jupyterlab-drawio 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. + import ipywidgets as W import traitlets as T -module_name = "@deathbeds/ipydrawio" -module_version = "^1.0.0" - -A_SHORT_DRAWIO = """ - - - - - - - - - -""" - -DEFAULT_PAGE_FORMAT = {"x": 0, "y": 0, "width": 850, "height": 1100} - -DEFAULT_URL_PARAMS = { - "gapi": 0, - "gl": 0, - "noExitBtn": 1, - "noSaveBtn": 1, - "od": 0, - "stealth": 1, - "tr": 0, - "ui": "min", - "format": 0, - "p": "ex;tips;svgdata;sql;anim;trees;replay;anon;flow;webcola;tags", -} - -DEFAULT_DRAWIO_CONFIG = { - "compressXml": False, - "showStartScreen": False, - "override": True, -} +from ._version import __js__ +from .constants import ( + A_SHORT_DRAWIO, + DEFAULT_DRAWIO_CONFIG, + DEFAULT_PAGE_FORMAT, + DEFAULT_URL_PARAMS, +) + +module_name = __js__["name"] +module_version = "^{version}".format(**__js__) class DiagramBase(W.Widget): diff --git a/scripts/atest.py b/scripts/atest.py index 5885e45a..218628d3 100644 --- a/scripts/atest.py +++ b/scripts/atest.py @@ -1,3 +1,18 @@ +"""acceptance testing""" +# Copyright 2021 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. + import shutil import subprocess import sys diff --git a/scripts/integrity.py b/scripts/integrity.py index c7d6ddf8..5fc8783c 100644 --- a/scripts/integrity.py +++ b/scripts/integrity.py @@ -1,3 +1,19 @@ +"""ipydrawio repo integrity tests""" + +# Copyright 2021 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. + import sys import tarfile from pathlib import Path @@ -38,6 +54,17 @@ def test_drawio_versions(): assert pdv.startswith(dv), "drawio version out of sync" +@pytest.mark.parametrize("path", P.ALL_HEADERS) +def test_headers(path): + text = path.read_text(encoding="utf-8") + assert ( + "Copyright 2021 ipydrawio contributors" in text + ), f"{path.relative_to(P.ROOT)} needs copyright header" + assert ( + 'Licensed under the Apache License, Version 2.0 (the "License");' in text + ), f"{path.relative_to(P.ROOT)} needs license header" + + @pytest.mark.parametrize("key,tarball", [*P.JS_TARBALL.items(), *P.PY_SDIST.items()]) def test_tarball(key, tarball): with tarfile.open(str(tarball), "r") as tar: diff --git a/scripts/project.py b/scripts/project.py index 499e775d..3ec42229 100644 --- a/scripts/project.py +++ b/scripts/project.py @@ -2,10 +2,24 @@ this should not import anything not in py36+ stdlib, or any local paths """ + +# Copyright 2021 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. + import json import os import platform -import re import shutil import sys from pathlib import Path @@ -35,6 +49,8 @@ # demo BINDER = ROOT / ".binder" OVERRIDES = BINDER / "overrides.json" +POSTBUILD_PY = BINDER / "postBuild" +ENV_BINDER = BINDER / "environment.yml" # top-level stuff NODE_MODULES = ROOT / "node_modules" @@ -42,7 +58,6 @@ PACKAGES = ROOT / "packages" YARN_INTEGRITY = NODE_MODULES / ".yarn-integrity" YARN_LOCK = ROOT / "yarn.lock" -CI = ROOT / ".github" DODO = ROOT / "dodo.py" BUILD = ROOT / "build" DIST = ROOT / "dist" @@ -50,6 +65,10 @@ CHANGELOG = ROOT / "CHANGELOG.md" SETUP_CFG = ROOT / "setup.cfg" +# ci +CI = ROOT / ".github" +ENV_CI = CI / "environment.yml" + # tools PY = ["python"] PYM = [*PY, "-m"] @@ -153,26 +172,29 @@ PY_SETUP = {p.parent.name: p for p in (ROOT / "py_packages").glob("*/setup.py")} PY_SRC = {k: sorted((v.parent / "src").rglob("*.py")) for k, v in PY_SETUP.items()} PY_SETUP_CFG = {k: v.parent / "setup.cfg" for k, v in PY_SETUP.items()} + PY_VERSION = { - k: re.findall( - r"""__version__ = "([^"]+)""", - [vv for vv in v if vv.name == "_version.py"][0].read_text(), - )[0] - for k, v in PY_SRC.items() + "ipydrawio": JS_PKG_DATA["ipydrawio"]["version"], + "ipydrawio-export": JS_PKG_DATA["ipydrawio-pdf"]["version"], } IPD = PY_SETUP["ipydrawio"].parent IPDE = PY_SETUP["ipydrawio-export"].parent +IPD_VERSION = PY_VERSION["ipydrawio"] +IPDE_VERSION = PY_VERSION["ipydrawio-export"] + PY_SDIST = { - IPDE.name: IPDE / "dist" / f"{IPDE.name}-1.0.0.tar.gz", - IPD.name: IPD / "dist" / f"{IPD.name}-1.0.0.tar.gz", + IPDE.name: IPDE / "dist" / f"{IPDE.name}-{IPDE_VERSION}.tar.gz", + IPD.name: IPD / "dist" / f"{IPD.name}-{IPD_VERSION}.tar.gz", } PY_WHEEL = { IPDE.name: IPDE / "dist" - / f"""{IPDE.name.replace("-", "_")}-1.0.0-py3-none-any.whl""", - IPD.name: IPD / "dist" / f"""{IPD.name.replace("-", "_")}-1.0.0-py3-none-any.whl""", + / f"""{IPDE.name.replace("-", "_")}-{IPDE_VERSION}-py3-none-any.whl""", + IPD.name: IPD + / "dist" + / f"""{IPD.name.replace("-", "_")}-{IPD_VERSION}-py3-none-any.whl""", } PY_TEST_DEP = {} @@ -194,6 +216,7 @@ def NOT_LABEXTENSIONS(paths): *sum(JS_PY_SCRIPTS.values(), []), *sum(PY_SRC.values(), []), *BINDER.glob("*.py"), + POSTBUILD_PY, DODO, ] ALL_YML = [*ROOT.glob("*.yml"), *CI.rglob("*.yml"), *BINDER.glob("*.yml")] @@ -209,11 +232,22 @@ def NOT_LABEXTENSIONS(paths): *PACKAGES.glob("*/*.md"), *NOT_LABEXTENSIONS(PY_PACKAGES.glob("*/*.md")), ] +ALL_SETUP_CFG = [SETUP_CFG, *PY_SETUP_CFG.values()] ALL_JS = [PACKAGES / ".eslintrc.js"] ALL_TS = sum(JS_TSSRC.values(), []) ALL_CSS = sum(JS_STYLE.values(), []) ALL_ROBOT = [*ATEST.rglob("*.robot")] ALL_PRETTIER = [*ALL_YML, *ALL_JSON, *ALL_MD, *ALL_TS, *ALL_CSS, *ALL_JS] +ALL_HEADERS = [ + *ALL_SETUP_CFG, + *ALL_PY, + *ALL_TS, + *ALL_CSS, + *ALL_JS, + *ALL_MD, + *ALL_YML, + *ALL_ROBOT, +] ESLINTRC = PACKAGES / ".eslintrc.js" RFLINT_OPTS = sum( @@ -243,6 +277,8 @@ def NOT_LABEXTENSIONS(paths): *ALL_IPDW_JS, ] +# provisioning stuff +IPYDRAWIO_DATA_DIR = Path(sys.prefix) / "share/jupyter/ipydrawio_export" # built files OK_PIP_CHECK = BUILD / "pip.check.ok" @@ -292,3 +328,6 @@ def get_atest_stem(attempt=1, extra_args=None, browser=None): stem += "_dry_run" return stem + + +os.environ.update(IPYDRAWIO_DATA_DIR=str(IPYDRAWIO_DATA_DIR)) diff --git a/setup.cfg b/setup.cfg index f61dbdf1..2c50d983 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,17 @@ +# Copyright 2021 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. + [flake8] max-line-length = 88 ignore = E203, E501, W503 diff --git a/yarn.lock b/yarn.lock index 22cdbae1..eda24178 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2396,9 +2396,9 @@ backbone@1.2.3: underscore ">=1.7.0" balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== base64-js@^1.2.1, base64-js@^1.3.1: version "1.5.1" @@ -5560,17 +5560,17 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" -mime-db@1.46.0: - version "1.46.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.46.0.tgz#6267748a7f799594de3cbc8cde91def349661cee" - integrity sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ== +mime-db@1.47.0: + version "1.47.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.47.0.tgz#8cb313e59965d3c05cfbf898915a267af46a335c" + integrity sha512-QBmA/G2y+IfeS4oktet3qRZ+P5kPhCKRXxXnQEudYqUaEioAU1/Lq2us3D/t1Jfo4hE9REQPrbB7K5sOczJVIw== mime-types@^2.1.12, mime-types@^2.1.27, mime-types@~2.1.19: - version "2.1.29" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.29.tgz#1d4ab77da64b91f5f72489df29236563754bb1b2" - integrity sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ== + version "2.1.30" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.30.tgz#6e7be8b4c479825f85ed6326695db73f9305d62d" + integrity sha512-crmjA4bLtR8m9qLpHvgxSChT+XoSlZi8J4n/aIdn3z92e/U47Z0V/yl+Wh9W046GgFVAmoNR/fmdbZYcSSIUeg== dependencies: - mime-db "1.46.0" + mime-db "1.47.0" mimic-fn@^1.0.0: version "1.2.0" @@ -6418,9 +6418,9 @@ performance-now@^2.1.0: integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= picomatch@^2.0.5, picomatch@^2.2.1: - version "2.2.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" - integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + version "2.2.3" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.3.tgz#465547f359ccc206d3c48e46a1bcb89bf7ee619d" + integrity sha512-KpELjfwcCDUb9PeigTs2mBJzXUPzAuP2oPcA989He8Rte0+YUAjw1JVedDhuTKPkHjSYzMN3npC9luThGYEKdg== pify@^2.0.0, pify@^2.3.0: version "2.3.0" @@ -6974,9 +6974,9 @@ registry-url@^5.0.0: rc "^1.2.8" repeat-element@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" - integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== + version "1.1.4" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.4.tgz#be681520847ab58c7568ac75fbfad28ed42d39e9" + integrity sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ== repeat-string@^1.6.1: version "1.6.1"