Shorten some paths for Windows (#33)

pull/45/head v1.0.1
Nicholas Bollweg 2021-04-12 07:55:08 -04:00 zatwierdzone przez GitHub
rodzic 8031573d62
commit cbb744031f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
34 zmienionych plików z 3201 dodań i 2933 usunięć

Wyświetl plik

@ -34,6 +34,7 @@ dependencies:
- networkx
- pygraphviz
- python-graphviz
- qrcode-artistic
- segno
- shapely
- tabulate
@ -41,8 +42,6 @@ dependencies:
- wxyz_json_schema_form
- wxyz_lab
- wxyz_svg
# TODO: get on conda-forge
# - qrcode-artistic
### ipydrawio-dev-deps ###

Wyświetl plik

@ -0,0 +1,26 @@
# 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-conda-build
channels:
- conda-forge
- nodefaults
dependencies:
- boa
- conda-build
- doit

Wyświetl plik

@ -72,6 +72,7 @@ jobs:
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-${{ hashFiles('.github/pip-build.txt') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-pip-
- name: cache (node)
uses: actions/cache@v2
id: cache-node-modules
@ -127,6 +128,57 @@ jobs:
name: ipydrawio ${{ github.run_number }} dist
path: ./dist
conda-build:
needs: [build]
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: ['ubuntu', 'macos', 'windows']
steps:
- name: configure line endings
run: |
git config --global core.autocrlf false
- name: checkout
uses: actions/checkout@v2
- name: cache (conda)
uses: actions/cache@v2
with:
path: ~/conda_pkgs_dir
key: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-build-${{ hashFiles('.github/environment-conda-build.yml') }}
restore-keys: |
${{ env.CACHE_EPOCH }}-${{ runner.os }}-conda-build-
- name: install (conda)
uses: conda-incubator/setup-miniconda@v2
with:
condarc-file: .github/.condarc
environment-file: .github/environment-conda-build.yml
miniforge-variant: Mambaforge
use-mamba: true
- name: download (dist)
uses: actions/download-artifact@v2
with:
name: ipydrawio ${{ github.run_number }} dist
path: ./dist
- name: build (conda)
shell: bash -l {0}
env:
CONDA_BUILDERER: mambabuild
run: |
doit -s conda
- name: upload (conda)
uses: actions/upload-artifact@v2
with:
name: ipydrawio ${{ github.run_number }} conda
path: ./build/conda-bld
test:
needs: [build]
name: ${{ matrix.os }} ${{ matrix.python-version }}
@ -165,13 +217,13 @@ jobs:
with:
condarc-file: .github/.condarc
miniforge-variant: Mambaforge
miniforge-version: latest
python-version: ${{ matrix.python-version }}
environment-file: .github/environment.yml
use-only-tar-bz2: true
use-mamba: true
- uses: actions/download-artifact@v2
- name: download (dist)
uses: actions/download-artifact@v2
with:
name: ipydrawio ${{ github.run_number }} dist
path: ./dist

3
.gitignore vendored
Wyświetl plik

@ -12,7 +12,6 @@ __pycache__
*.tgz
*.tsbuildinfo
**/*DRAWIO_DEBUG*
**/labextensions/**
atest/output/
build/
dist/
@ -21,5 +20,7 @@ htmlcov/
node_modules/
py_packages/ipydrawio-export/ipydrawio-export-*
py_packages/ipydrawio/ipydrawio-*
py_packages/**/src/*/ext/
packages/ipydrawio-webpack/dio/
untitled*
Untitled*

2
.gitmodules vendored
Wyświetl plik

@ -1,4 +1,4 @@
[submodule "src/drawio"]
[submodule "packages/ipydrawio-webpack/drawio"]
path = packages/ipydrawio-webpack/drawio
url = https://github.com/jgraph/drawio.git
[submodule "py_packages/jupyter-drawio-export/src/jupyter_drawio_export/vendor/draw-image-export2"]

Wyświetl plik

@ -2,6 +2,33 @@
## Unreleased
### ipydrawio 1.0.1
- [#32] on-disk file paths are shorter to avoid Windows issues
- [#31] `install.json` is properly placed
### ipydrawio-export 1.0.1
- [#32] on-disk file paths are shorter to avoid Windows issues
- [#31] `install.json` is properly placed
### @deathbeds/ipydrawio 1.0.1
### @deathbeds/ipydrawio-notebook 1.0.1
### @deathbeds/ipydrawio-pdf 1.0.1
### @deathbeds/ipydrawio-webpack 14.5.901
- [#32] drawio assets are copied into a shorter path
- changing version scheme to allow for patch releases.
- going forward, the upstream patch release will be multiplied by 100
[#31]: https://github.com/deathbeds/ipydrawio/issues/31
[#32]: https://github.com/deathbeds/ipydrawio/issues/32
---
### ipydrawio 1.0.0
- ipywidgets support

Wyświetl plik

@ -66,19 +66,24 @@ doit dist
- [ ] validate on binder
- [ ] wait for a successful build of `master`
- [ ] download the `dist` archive and unpack somewhere (maybe a fresh `dist`)
- [ ] actually upload
- [ ] create a new release through the GitHub UI
- [ ] paste in the relevant CHANGELOG entries
- [ ] upload the artifacts
- [ ] actually upload to npm.com, pypi.org
```bash
export VERSION=<the next version>
cd dist
twine upload ipydrawio*
npm login
npm publish deathbeds-ipydrawio-$VERSION.tgz
npm publish deathbeds-ipydrawio-notebook-$VERSION.tgz
npm publish deathbeds-ipydrawio-pdf-$VERSION.tgz
npm publish deathbeds-ipydrawio-webpack-$VERSION.tgz
npm publish deathbeds-ipydrawio-webpack-$OTHER_VERSION.tgz
npm logout
```
- [ ] handle `conda-forge` feedstock tasks
- [ ] postmortem
- [ ] handle `conda-forge` feedstock tasks
- [ ] validate on binder via simplest-possible gists
- [ ] bump to next development version
```
Copyright 2021 ipydrawio contributors

Wyświetl plik

@ -0,0 +1,128 @@
{% set name = "ipydrawio" %}
{% set version = "1.0.1" %}
{% set build_number = 0 %}
{% set url_base = RECIPE_DIR.replace("\\", "/") + "/../dist" %}
{% if not url_base.startswith("/") %}
{% set url_base = "/" + url_base %}
{% endif %}
package:
name: {{ name }}-build
version: {{ version }}
source:
- folder: {{ name }}
url: file://{{ url_base }}/{{ name }}-{{ version }}.tar.gz
# url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
# sha256:
- folder: {{ name }}-export
url: file://{{ url_base }}/{{ name }}-export-{{ version }}.tar.gz
# url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}-export/{{ name }}-export-{{ version }}.tar.gz
# sha256:
build:
number: {{ build_number }}
noarch: python
requirements:
host:
- pip
- python >=3.6
run:
- python >=3.6
test:
commands:
- echo "tests in outputs"
outputs:
- name: {{ name }}
version: {{ version }}
build:
number: {{ build_number }}
noarch: python
script:
- cd {{ name }} && {{ PYTHON }} -m pip install . -vv --no-deps
requirements:
host:
- pip
- python >=3.6
run:
- ipywidgets >=7.6
- jupyterlab ==3.*
- jupyterlab_widgets >=1
- lxml
- python >=3.6
test:
imports:
- {{ name }}
requires:
- pip
- pytest-cov
commands:
- pip check
- jupyter labextension list
- jupyter labextension list 1>labextensions 2>&1
- cat labextensions | grep "@deathbeds/{{ name }}.*OK" # [unix]
- pytest -vv --pyargs {{ name }} --cov={{ name }} --cov-fail-under=100 --cov-report=term-missing:skip-covered
about:
home: https://github.com/deathbeds/{{ name }}
summary: Draw.io Diagrams as Jupyter Widgets
license: Apache-2.0
license_file: {{ name }}/LICENSE.txt
- name: {{ name }}-export
version: {{ version }}
build:
number: {{ build_number }}
noarch: python
script:
- cd {{ name }}-export && {{ PYTHON }} -m pip install . -vv --no-deps
entry_points:
- jupyter-{{ name }}-export = {{ name }}_export.app:main
requirements:
host:
- pip
- python >=3.6
run:
- {{ name }} =={{ version }}.*
- python >=3.6
- pillow
- pypdf2
- requests_cache
- nodejs
test:
imports:
- {{ name }}_export
requires:
- pip
- pytest-cov
- pytest-tornasync
- pytest-console-scripts
commands:
- pip check
- jupyter labextension list
- jupyter labextension list 1>labextensions 2>&1
- cat labextensions | grep "@deathbeds/{{ name }}-pdf.*OK" # [unix]
- jupyter serverextension list
- jupyter serverextension list 1>serverextensions 2>&1
- cat serverextensions | grep "{{ name }}_export.*OK" # [unix]
- pytest -vv --pyargs {{ name }}_export --script-launch-mode=subprocess --cov={{ name }}_export --cov-fail-under=96 --cov-report=term-missing:skip-covered
about:
home: https://github.com/deathbeds/{{ name }}
summary: PDF export for IPyDrawio
license: Apache-2.0
license_file: {{ name }}-export/LICENSE.txt
about:
home: https://github.com/deathbeds/{{ name }}
summary: Draw.io Diagrams as Jupyter Widgets
license: Apache-2.0
license_file: {{ name }}/LICENSE.txt
extra:
recipe-maintainers:
- bollwyvl

63
dodo.py
Wyświetl plik

@ -122,11 +122,10 @@ def task_setup():
for pkg, pkg_setup in P.PY_SETUP.items():
# TODO: refactor
ext_deps = [
pkg_setup.parent
/ "src"
/ pkg.replace("-", "_")
/ "labextensions"
/ P.JS_PKG_DATA[ext]["name"]
(
P.JS_PKG_JSON[ext].parent
/ P.JS_PKG_DATA[ext]["jupyterlab"]["outputDir"]
).resolve()
/ "package.json"
for ext, mod in P.JS_LABEXT_PY_HOST.items()
if mod == pkg_setup.parent.name
@ -377,9 +376,9 @@ if not P.TESTING_IN_CI:
if "jupyterlab" not in pkg_data:
continue
host = P.JS_LABEXT_PY_HOST[pkg]
host_mod = host.replace("-", "_")
host_ext = P.PY_PACKAGES / host / "src" / host_mod / "labextensions"
out_dir = (
P.JS_PKG_JSON[pkg].parent / pkg_data["jupyterlab"]["outputDir"]
).resolve()
yield _ok(
dict(
@ -392,19 +391,17 @@ if not P.TESTING_IN_CI:
)
],
file_dep=targets,
targets=[host_ext / f"""{pkg_data["name"]}/package.json"""],
targets=[out_dir / "package.json"],
),
P.OK_EXT_BUILD[pkg],
)
for py_pkg, py_setup in P.PY_SETUP.items():
py_mod = py_setup.parent.name.replace("-", "_")
ext_deps = [
py_setup.parent
/ "src"
/ py_mod
/ "labextensions"
/ P.JS_PKG_DATA[ext]["name"]
(
P.JS_PKG_JSON[ext].parent
/ P.JS_PKG_DATA[ext]["jupyterlab"]["outputDir"]
).resolve()
/ "package.json"
for ext, mod in P.JS_LABEXT_PY_HOST.items()
if mod == py_setup.parent.name
@ -475,6 +472,42 @@ if not P.TESTING_IN_CI:
)
def task_conda():
args = [
"conda",
P.CONDA_BUILDERER,
"-c",
"conda-forge",
]
yield dict(
name="build",
file_dep=[
P.RECIPE,
*[P.DIST / p.name for p in P.PY_SDIST.values()],
],
actions=[
[
*args,
"--no-test",
"--output-folder",
P.CONDA_BLD,
P.RECIPE.parent,
]
],
targets=[*P.CONDA_PKGS.values()],
)
yield _ok(
dict(
name="test",
file_dep=[*P.CONDA_PKGS.values()],
actions=[[*args, "--test", *P.CONDA_PKGS.values()]],
),
P.OK_CONDA_TEST,
)
if not P.TESTING_IN_CI:
def task_lab():

Wyświetl plik

@ -3,6 +3,7 @@ _meta/lib/**
ipydrawio-notebook/lib/**
ipydrawio-pdf/lib/**
ipydrawio-webpack/drawio/**
ipydrawio-webpack/dio/**
ipydrawio/lib/**
**/node_modules/**
**/drawio/**

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "@deathbeds/ipydrawio-notebook",
"version": "1.0.0",
"version": "1.0.1",
"dependencies": {
"@jupyterlab/application": "3",
"@jupyterlab/notebook": "3"
@ -10,7 +10,7 @@
"typescript": "~4.2.4"
},
"peerDependencies": {
"@deathbeds/ipydrawio": "^1.0.0"
"@deathbeds/ipydrawio": "^1.0.1"
},
"files": [
"{lib,schema,style,src}/**/*.{ts,tsx,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,css}",
@ -18,7 +18,7 @@
],
"jupyterlab": {
"extension": "lib/plugin.js",
"outputDir": "../../py_packages/ipydrawio/src/ipydrawio/labextensions/@deathbeds/ipydrawio-notebook",
"outputDir": "../../py_packages/ipydrawio/src/ipydrawio/ext/ipdnb",
"sharedPackages": {
"@deathbeds/ipydrawio": {
"bundled": false,

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "@deathbeds/ipydrawio-pdf",
"version": "1.0.0",
"version": "1.0.1",
"dependencies": {
"@jupyterlab/application": "3"
},
@ -9,7 +9,7 @@
"typescript": "~4.2.4"
},
"peerDependencies": {
"@deathbeds/ipydrawio": "^1.0.0"
"@deathbeds/ipydrawio": "^1.0.1"
},
"files": [
"{lib,schema,style,src}/**/*.{ts,tsx,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,css}",
@ -17,7 +17,7 @@
],
"jupyterlab": {
"extension": "lib/plugin.js",
"outputDir": "../../py_packages/ipydrawio-export/src/ipydrawio_export/labextensions/@deathbeds/ipydrawio-pdf",
"outputDir": "../../py_packages/ipydrawio-export/src/ipydrawio_export/ext/ipdpdf",
"sharedPackages": {
"@deathbeds/ipydrawio": {
"bundled": false,

Wyświetl plik

@ -1,22 +1,23 @@
*.tgz
**/.ipynb_checkpoints
drawio/.git*
drawio/.travis.yml
drawio/*.md
drawio/ChangeLog
drawio/etc/*
drawio/*/*.orig
drawio/*/*.json
drawio/src/main/java/*
drawio/src/main/webapp/connect/*
drawio/src/main/webapp/js/diagramly/*
drawio/src/main/webapp/math/jax/output/HTML-CSS/*
drawio/src/main/webapp/onedrive*
drawio/src/main/webapp/github*
drawio/src/main/webapp/dropbox*
drawio/src/main/webapp/WEB-INF/*
drawio/src/main/webapp/META-INF/*
drawio/src/main/webapp/yarn.lock
drawio/src/main/webapp/math/.travis.yml
dio/.git*
dio/*.json
dio/*.md
dio/*/.npmignore
dio/*/*.json
dio/*/*.orig
dio/connect/*
dio/dropbox*
dio/electron*
dio/git*.html
dio/github*
dio/js/diagramly/*
dio/math/.travis.yml
dio/math/jax/output/HTML-CSS/*
dio/META-INF/*
dio/onedrive*
dio/onedrive*.html
dio/WEB-INF/*
dio/yarn.lock
drawio/
scripts/*
drawio/*/.npmignore

Wyświetl plik

@ -4,5 +4,5 @@ import { URLExt, PageConfig } from '@jupyterlab/coreutils';
*/
export const DRAWIO_URL = URLExt.join(
PageConfig.getBaseUrl(),
'lab/extensions/@deathbeds/ipydrawio-webpack/static/drawio/src/main/webapp/index.html'
'lab/extensions/@deathbeds/ipydrawio-webpack/static/dio/index.html'
);

Wyświetl plik

@ -21,7 +21,7 @@
"name": "@deathbeds/ipydrawio-webpack",
"jupyterlab": {
"extension": "lib/plugin.js",
"outputDir": "../../py_packages/ipydrawio/src/ipydrawio/labextensions/@deathbeds/ipydrawio-webpack",
"outputDir": "../../py_packages/ipydrawio/src/ipydrawio/ext/ipdwp",
"webpackConfig": "./webpack.config.js",
"discovery": {
"server": {
@ -43,5 +43,5 @@
"build:pre": "python scripts/patch.py && python scripts/static.py"
},
"types": "lib/index.d.ts",
"version": "14.5.9"
"version": "14.5.901"
}

Wyświetl plik

@ -14,36 +14,38 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import subprocess
import shutil
import sys
from pathlib import Path
HERE = Path(__file__).parent
ROOT = HERE.parent
DRAWIO = ROOT / "drawio"
APP_MIN = DRAWIO / "src/main/webapp/js/app.min.js"
DRAWIO = ROOT / "drawio/src/main/webapp"
# a much shorter path
DIO = ROOT / "dio"
PATCHES = {
APP_MIN: [
"js/app.min.js": [
{
"name": "global ref so we can get at the App at runtime",
"before": "new App(new Editor",
"after": "window.IPYDRAWIO_APP = new App(new Editor",
},
# {
# "name": "plugin path so this can be hosted on non-root",
# "before": """;window.PLUGINS_BASE_PATH=window.PLUGINS_BASE_PATH||"";""",
# "after": """;window.PLUGINS_BASE_PATH=window.PLUGINS_BASE_PATH||"";""",
# },
}
]
}
def copy():
if DIO.exists():
shutil.rmtree(DIO)
shutil.copytree(DRAWIO, DIO)
return 0
def patch():
for path, patches in PATCHES.items():
print("checkout", path)
subprocess.check_call(
["git", "checkout", str(path.relative_to(DRAWIO))], cwd=DRAWIO
)
txt = path.read_text(encoding="utf-8")
src_path = DRAWIO / path
dest_path = DIO / path
txt = src_path.read_text(encoding="utf-8")
for patch in patches:
print(" ", patch["name"])
@ -55,8 +57,9 @@ def patch():
else:
print(" ...nothing to do")
path.write_text(txt, encoding="utf-8")
dest_path.write_text(txt, encoding="utf-8")
return 0
if __name__ == "__main__":
patch()
sys.exit(copy() + patch())

Wyświetl plik

@ -20,14 +20,14 @@ from pprint import pprint
HERE = Path(__file__).parent
ROOT = HERE.parent.resolve()
DRAWIO = ROOT / "drawio"
DIO = ROOT / "dio"
IGNORE = ROOT / ".npmignore"
IGNORED = {
glob.strip(): 0
for glob in IGNORE.read_text().strip().splitlines()
if glob.startswith("drawio/")
if glob.startswith("dio/")
}
STATIC = ROOT / "lib" / "_static.js"
STATIC = ROOT / "lib/_static.js"
HEADER = """
/**
All files that should be copied to the labextension folder, available as:
@ -36,7 +36,7 @@ HEADER = """
*/
"""
TMPL = """
import '!!file-loader?name=[path][name].[ext]&context=.!../drawio{}';
import '!!file-loader?name=[path][name].[ext]&context=.!../dio{}';
"""
@ -52,15 +52,13 @@ def update_static():
print("ignoring\n", "\n".join(IGNORED))
lines = []
for path in sorted(DRAWIO.rglob("*")):
for path in sorted(DIO.rglob("*")):
if path.is_dir():
continue
if is_ignored(path):
continue
lines += [
TMPL.format(
str(path.as_posix()).replace(str(DRAWIO.as_posix()), "")
).strip()
TMPL.format(str(path.as_posix()).replace(str(DIO.as_posix()), "")).strip()
]
assert lines

Wyświetl plik

@ -17,7 +17,7 @@
"@jupyter-widgets/jupyterlab-manager": "3"
},
"peerDependencies": {
"@deathbeds/ipydrawio-webpack": "^14.5.9",
"@deathbeds/ipydrawio-webpack": "^14.5.901",
"@jupyter-widgets/base": "4",
"@jupyter-widgets/controls": "3",
"@jupyter-widgets/jupyterlab-manager": "3"
@ -31,7 +31,7 @@
"extension": "lib/plugin.js",
"mimeExtension": "lib/mime.js",
"schemaDir": "schema",
"outputDir": "../../py_packages/ipydrawio/src/ipydrawio/labextensions/@deathbeds/ipydrawio",
"outputDir": "../../py_packages/ipydrawio/src/ipydrawio/ext/ipd",
"sharedPackages": {
"@deathbeds/ipydrawio-webpack": {
"bundled": false,
@ -67,5 +67,5 @@
"url": "https://github.com/deathbeds/ipydrawio.git"
},
"types": "lib/index.d.ts",
"version": "1.0.0"
"version": "1.0.1"
}

Wyświetl plik

@ -24,7 +24,7 @@ import { DocumentRegistry } from '@jupyterlab/docregistry';
import { ReadonlyPartialJSONObject } from '@lumino/coreutils';
export const NS = '@deathbeds/ipydrawio';
export const VERSION = '1.0.0';
export const VERSION = '1.0.1';
export const PLUGIN_ID = `${NS}:plugin`;
import { Diagram } from './editor';

Wyświetl plik

@ -1,6 +1,6 @@
include README.md LICENSE.txt install.json
include README.md LICENSE.txt
recursive-exclude src/ipydrawio_export/vendor/draw-image-export2 node_modules
recursive-include src/ipydrawio_export/etc *.json
recursive-include src/ipydrawio_export/labextensions *.*
recursive-include src/ipydrawio_export/ext *.*
recursive-include src/ipydrawio_export/tests/fixtures *.*
recursive-include src/ipydrawio_export/vendor/draw-image-export2 *.json *.js README.md LICENSE yarn.lock

Wyświetl plik

@ -18,42 +18,41 @@ import json
from pathlib import Path
HERE = Path(__file__).parent
EXT = HERE / "src/ipydrawio_export/labextensions"
EXT = HERE / "src/ipydrawio_export/ext"
PDF = EXT / "@deathbeds/ipydrawio-pdf"
PDF = EXT / "ipdpdf"
SHARE = "share/jupyter/labextensions"
__js__ = json.loads((PDF / "package.json").read_text(encoding="utf-8"))
EXT_FILES = {}
FILES = []
for ext_path in [EXT] + [d for d in EXT.rglob("*") if d.is_dir()]:
if ext_path == EXT:
target = str(SHARE)
else:
target = f"{SHARE}/{ext_path.relative_to(EXT)}"
EXT_FILES[target] = [
str(p.relative_to(HERE).as_posix())
for p in ext_path.glob("*")
if not p.is_dir()
]
for package_json in EXT.glob("*/package.json"):
pkg = json.loads(package_json.read_text(encoding="utf-8"))
ALL_FILES = sum(EXT_FILES.values(), [])
FILES += [(f"""{SHARE}/{pkg["name"]}""", ["src/ipydrawio_export/etc/install.json"])]
EXT_FILES[str(SHARE)] += ["install.json"]
for path in package_json.parent.rglob("*"):
if path.is_dir():
continue
parent = path.parent.relative_to(package_json.parent).as_posix()
FILES += [
(
f"""{SHARE}/{pkg["name"]}/{parent}""",
[str(path.relative_to(HERE).as_posix())],
)
]
for app in ["server", "notebook"]:
EXT_FILES[f"etc/jupyter/jupyter_{app}_config.d"] = [
f"src/ipydrawio_export/etc/jupyter_{app}_config.d/ipydrawio-export.json"
for app in ["server", "notebook"]:
FILES += [
(
f"etc/jupyter/jupyter_{app}_config.d",
[f"src/ipydrawio_export/etc/jupyter_{app}_config.d/ipydrawio-export.json"],
)
]
if __name__ == "__main__":
import setuptools
setuptools.setup(
version=__js__["version"],
data_files=[
*[(k, v) for k, v in EXT_FILES.items()],
],
)
setuptools.setup(version=__js__["version"], data_files=FILES)

Wyświetl plik

@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from pathlib import Path
from ._version import __js__, __version__
@ -24,14 +25,15 @@ from .serverextension import load_jupyter_server_extension
def _jupyter_labextension_paths():
"""static paths to link for interactive installation"""
here = Path(__file__).parent
return [
dict(
src=f"{pkg.parent.relative_to(here).as_posix()}",
dest=f"{pkg.parent.parent.name}/{pkg.parent.name}",
)
for pkg in (here / "labextensions").glob("*/*/package.json")
]
exts = []
for pkg in here.glob("ext/*/package.json"):
exts += [
dict(
src=str(pkg.parent.relative_to(here).as_posix()),
dest=json.loads(pkg.read_text(encoding="utf-8"))["name"],
)
]
return exts
def _jupyter_server_extension_paths():

Wyświetl plik

@ -20,11 +20,7 @@ from pathlib import Path
HERE = Path(__file__).parent
__js__ = json.loads(
(HERE / "labextensions/@deathbeds/ipydrawio-pdf/package.json").read_text(
encoding="utf-8"
)
)
__js__ = json.loads((HERE / "ext/ipdpdf/package.json").read_text(encoding="utf-8"))
__version__ = __js__["version"]

Wyświetl plik

@ -18,9 +18,7 @@
PNG_DRAWIO_INFO = "mxfile"
# TODO: hoist this to `package.json` and consume directly
DRAWIO_APP = (
"../labextensions/@deathbeds/ipydrawio-webpack/static/drawio/src/main/webapp"
)
DRAWIO_APP = "../labextensions/@deathbeds/ipydrawio-webpack/static/dio"
# key set in notebook#/metadata/
IPYNB_METADATA = "@deathbeds/ipydrawio"

Wyświetl plik

@ -1,2 +1,3 @@
include README.md LICENSE.txt install.json
recursive-include src/ipydrawio/labextensions *.*
include README.md LICENSE.txt
recursive-include src/ipydrawio/ext *.*
recursive-include src/ipydrawio_export/etc *.json

Wyświetl plik

@ -14,44 +14,39 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import re
from pathlib import Path
import json
from pathlib import Path
HERE = Path(__file__).parent
EXT = HERE / "src/ipydrawio/labextensions"
CORE = EXT / "@deathbeds/ipydrawio"
EXT = HERE / "src/ipydrawio/ext"
CORE = EXT / "ipd"
SHARE = "share/jupyter/labextensions"
__js__ = json.loads((CORE / "package.json").read_text(encoding="utf-8"))
EXT_FILES = {}
FILES = []
for ext_path in [EXT] + [d for d in EXT.rglob("*") if d.is_dir()]:
if ext_path == EXT:
target = str(SHARE)
else:
target = f"{SHARE}/{ext_path.relative_to(EXT)}"
EXT_FILES[target] = [
str(p.relative_to(HERE).as_posix())
for p in ext_path.glob("*")
if not p.is_dir()
]
for package_json in EXT.glob("*/package.json"):
pkg = json.loads(package_json.read_text(encoding="utf-8"))
ALL_FILES = sum(EXT_FILES.values(), [])
FILES += [(f"""{SHARE}/{pkg["name"]}""", ["src/ipydrawio/etc/install.json"])]
EXT_FILES[str(SHARE)] += ["install.json"]
for path in package_json.parent.rglob("*"):
if path.is_dir():
continue
parent = path.parent.relative_to(package_json.parent).as_posix()
FILES += [
(
f"""{SHARE}/{pkg["name"]}/{parent}""",
[str(path.relative_to(HERE).as_posix())],
)
]
if __name__ == "__main__":
import setuptools
setuptools.setup(
version=__js__["version"],
data_files=[
*[(k, v) for k, v in EXT_FILES.items()],
],
)
setuptools.setup(version=__js__["version"], data_files=FILES)

Wyświetl plik

@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from pathlib import Path
from ._version import __js__, __version__
@ -23,13 +24,15 @@ from .widget_diagram import Diagram
def _jupyter_labextension_paths():
here = Path(__file__).parent
return [
dict(
src=f"{pkg.parent.relative_to(here).as_posix()}",
dest=f"{pkg.parent.parent.name}/{pkg.parent.name}",
)
for pkg in (here / "labextensions").glob("*/*/package.json")
]
exts = []
for pkg in here.glob("ext/*/package.json"):
exts += [
dict(
src=str(pkg.parent.relative_to(here).as_posix()),
dest=json.loads(pkg.read_text(encoding="utf-8"))["name"],
)
]
return exts
__all__ = [

Wyświetl plik

@ -20,11 +20,7 @@ from pathlib import Path
HERE = Path(__file__).parent
__js__ = json.loads(
(HERE / "labextensions/@deathbeds/ipydrawio/package.json").read_text(
encoding="utf-8"
)
)
__js__ = json.loads((HERE / "ext/ipd/package.json").read_text(encoding="utf-8"))
__version__ = __js__["version"]

Wyświetl plik

@ -160,7 +160,7 @@ JS_PY_SCRIPTS = {
# special things for ipydrawio-webpack
IPDW = JS_PKG_JSON["ipydrawio-webpack"].parent
IPDW_APP = IPDW / "drawio/src/main/webapp/js/app.min.js"
IPDW_APP = IPDW / "dio/js/app.min.js"
IPDW_PY = (IPDW / "scripts").rglob("*.py")
DRAWIO = IPDW / "drawio"
IPDW_LIB = IPDW / "lib"
@ -205,19 +205,16 @@ SERVER_EXT = {
}
def NOT_LABEXTENSIONS(paths):
return [p for p in paths if "labextensions" not in str(p)]
ALL_PY = [
*ATEST.rglob("*.py"),
*BINDER.glob("*.py"),
*IPDW_PY,
*PY_SETUP.values(),
*SCRIPTS.glob("*.py"),
*sum(JS_PY_SCRIPTS.values(), []),
*sum(PY_SRC.values(), []),
*BINDER.glob("*.py"),
POSTBUILD_PY,
DODO,
POSTBUILD_PY,
]
ALL_YML = [*ROOT.glob("*.yml"), *CI.rglob("*.yml"), *BINDER.glob("*.yml")]
ALL_JSON = [
@ -230,7 +227,6 @@ ALL_JSON = [
ALL_MD = [
*ROOT.glob("*.md"),
*PACKAGES.glob("*/*.md"),
*NOT_LABEXTENSIONS(PY_PACKAGES.glob("*/*.md")),
]
ALL_SETUP_CFG = [SETUP_CFG, *PY_SETUP_CFG.values()]
ALL_JS = [PACKAGES / ".eslintrc.js"]
@ -301,6 +297,7 @@ OK_PROVISION = BUILD / "provision.ok"
OK_ROBOT_DRYRUN = BUILD / "robot.dryrun.ok"
OK_RFLINT = BUILD / "robot.rflint.ok"
OK_ATEST = BUILD / "atest.ok"
OK_CONDA_TEST = BUILD / "conda-build.test.ok"
OK_EXT_BUILD = {k: BUILD / f"ext.build.{k}.ok" for k in JS_LABEXT_PY_HOST}
@ -316,6 +313,16 @@ CMD_LIST_EXTENSIONS = ["jupyter", "labextension", "list"]
CMD_LAB = ["jupyter", "lab", "--no-browser", "--debug"]
# conda building
RECIPE = ROOT / "conda.recipe/meta.yaml"
CONDA_BLD = BUILD / "conda-bld"
# could be mambabuild
CONDA_BUILDERER = os.environ.get("CONDA_BUILDERER", "build")
CONDA_PKGS = {
pkg: CONDA_BLD / f"noarch/{pkg}-{ver}-py_0.tar.bz2"
for pkg, ver in PY_VERSION.items()
}
def get_atest_stem(attempt=1, extra_args=None, browser=None):
"""get the directory in ATEST_OUT for this platform/apps"""
@ -330,4 +337,6 @@ def get_atest_stem(attempt=1, extra_args=None, browser=None):
return stem
os.environ.update(IPYDRAWIO_DATA_DIR=str(IPYDRAWIO_DATA_DIR))
os.environ.update(
IPYDRAWIO_DATA_DIR=str(IPYDRAWIO_DATA_DIR), PIP_DISABLE_PIP_VERSION_CHECK="1"
)

Wyświetl plik

@ -72,23 +72,23 @@
tslib "~1.13.0"
"@deathbeds/ipydrawio-notebook@file:packages/ipydrawio-notebook":
version "1.0.0"
version "1.0.1"
dependencies:
"@jupyterlab/application" "3"
"@jupyterlab/notebook" "3"
"@deathbeds/ipydrawio-pdf@file:packages/ipydrawio-pdf":
version "1.0.0"
version "1.0.1"
dependencies:
"@jupyterlab/application" "3"
"@deathbeds/ipydrawio-webpack@file:packages/ipydrawio-webpack":
version "14.5.9"
version "14.5.901"
dependencies:
"@jupyterlab/application" "3"
"@deathbeds/ipydrawio@file:packages/ipydrawio":
version "1.0.0"
version "1.0.1"
dependencies:
"@jupyterlab/application" "3"
"@jupyterlab/launcher" "3"