diff --git a/.gitignore b/.gitignore index 91f34fcb..1722c7d6 100755 --- a/.gitignore +++ b/.gitignore @@ -16,8 +16,7 @@ ipyvuetify/generated js/src/generated # Compiled javascript -ipyvuetify/labextension/ -ipyvuetify/nbextension/ +prefix/share js/lib # Unit test / coverage reports diff --git a/MANIFEST.in b/MANIFEST.in index 28b087c5..8a218555 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,4 @@ include LICENSE -recursive-include ipyvuetify/nbextension *.* -recursive-include ipyvuetify/labextension *.* -include jupyter-vuetify.json +recursive-include prefix *.* recursive-include ipyvuetify/extra *.vue recursive-include ipyvuetify/generated *.* diff --git a/ipyvuetify/__init__.py b/ipyvuetify/__init__.py index ad543aa1..b63f1085 100755 --- a/ipyvuetify/__init__.py +++ b/ipyvuetify/__init__.py @@ -5,10 +5,22 @@ from .VuetifyTemplate import VuetifyTemplate +def _prefix(): + import sys + from pathlib import Path + + prefix = sys.prefix + here = Path(__file__).parent + # for when in dev mode + if (here.parent / "prefix").exists(): + prefix = str(here.parent) + return prefix + + def _jupyter_labextension_paths(): return [ { - "src": "labextension", + "src": f"{_prefix()}/prefix/share/jupyter/labextensions/jupyter-vuetify/", "dest": "jupyter-vuetify", } ] @@ -18,7 +30,7 @@ def _jupyter_nbextension_paths(): return [ { "section": "notebook", - "src": "nbextension", + "src": f"{_prefix()}/prefix/share/jupyter/nbextensions/jupyter-vuetify/", "dest": "jupyter-vuetify", "require": "jupyter-vuetify/extension", } diff --git a/js/package.json b/js/package.json index c210b4d0..afabb7e2 100755 --- a/js/package.json +++ b/js/package.json @@ -66,7 +66,7 @@ }, "jupyterlab": { "extension": "lib/labplugin", - "outputDir": "../ipyvuetify/labextension", + "outputDir": "../prefix/share/jupyter/labextensions/jupyter-vuetify", "webpackConfig": "webpack.config.lab3.js", "sharedPackages": { "@jupyter-widgets/base": { diff --git a/js/webpack.config.js b/js/webpack.config.js index 129ce13a..bb318632 100755 --- a/js/webpack.config.js +++ b/js/webpack.config.js @@ -24,7 +24,15 @@ module.exports = [ entry: "./lib/extension.js", output: { filename: "extension.js", - path: path.resolve(__dirname, "..", "ipyvuetify", "nbextension"), + path: path.resolve( + __dirname, + "..", + "prefix", + "share", + "jupyter", + "nbextensions", + "jupyter-vuetify" + ), libraryTarget: "amd", }, mode: "production", @@ -39,7 +47,15 @@ module.exports = [ entry: "./lib/notebook.js", output: { filename: "index.js", - path: path.resolve(__dirname, "..", "ipyvuetify", "nbextension"), + path: path.resolve( + __dirname, + "..", + "prefix", + "share", + "jupyter", + "nbextensions", + "jupyter-vuetify" + ), libraryTarget: "amd", }, devtool: "source-map", @@ -62,7 +78,15 @@ module.exports = [ entry: "./lib/nodeps.js", output: { filename: "nodeps.js", - path: path.resolve(__dirname, "..", "ipyvuetify", "nbextension"), + path: path.resolve( + __dirname, + "..", + "prefix", + "share", + "jupyter", + "nbextensions", + "jupyter-vuetify" + ), libraryTarget: "amd", }, devtool: "source-map", diff --git a/jupyter-vuetify.json b/prefix/etc/nbconfig/notebook.d/jupyter-vuetify.json similarity index 100% rename from jupyter-vuetify.json rename to prefix/etc/nbconfig/notebook.d/jupyter-vuetify.json diff --git a/setup.py b/setup.py index 69cbc539..1de29990 100644 --- a/setup.py +++ b/setup.py @@ -45,11 +45,14 @@ def run(self): def get_data_files(): """files that need to be installed in specific locations upon installation.""" - - nbext = [rel(f) for f in ROOT.glob("ipyvuetify/nbextension/*")] - package = [rel(f) for f in ROOT.glob("ipyvuetify/labextension/package.json")] - labext = [rel(f) for f in ROOT.glob("ipyvuetify/labextension/static/*")] - nbconfig = [rel(f) for f in ROOT.glob("jupyter-vuetify.json")] + nbext = [rel(f) for f in ROOT.glob("prefix/share/jupyter/nbextensions/jupyter-vuetify/*")] + package = [ + rel(f) for f in ROOT.glob("prefix/share/jupyter/labextensions/jupyter-vuetify/package.json") + ] + labext = [ + rel(f) for f in ROOT.glob("prefix/share/jupyter/labextensions/jupyter-vuetify/static/*") + ] + nbconfig = [rel(f) for f in ROOT.glob("prefix/etc/nbconfig/notebook.d/jupyter-vuetify.json")] return [ ("share/jupyter/nbextensions/jupyter-vuetify", nbext),