From 0049793b7fe2bb09495af126a2cc3e85caefcac8 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Sat, 16 Jan 2021 11:37:10 -0800 Subject: [PATCH 1/3] Move notebook conf.d file to use python package name, which will not have / in it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have an error using the cookie cutter right now if the npm package name has an org and a slash, like ‘@jupyter-widgets/example’, for example: Traceback (most recent call last): File "/bin/cookiecutter", line 10, in sys.exit(main()) File "/lib/python3.9/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/lib/python3.9/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/lib/python3.9/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/lib/python3.9/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/lib/python3.9/site-packages/cookiecutter/cli.py", line 140, in main cookiecutter( File "/lib/python3.9/site-packages/cookiecutter/main.py", line 101, in cookiecutter result = generate_files( File "/lib/python3.9/site-packages/cookiecutter/generate.py", line 352, in generate_files generate_file( File "/lib/python3.9/site-packages/cookiecutter/generate.py", line 179, in generate_file with io.open(outfile, 'w', encoding='utf-8') as fh: FileNotFoundError: [Errno 2] No such file or directory: '//@jupyter-widgets/example.json' --- {{cookiecutter.github_project_name}}/setup.py | 2 +- ...ge_name}}.json => {{cookiecutter.python_package_name}}.json} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {{cookiecutter.github_project_name}}/{{{cookiecutter.npm_package_name}}.json => {{cookiecutter.python_package_name}}.json} (100%) diff --git a/{{cookiecutter.github_project_name}}/setup.py b/{{cookiecutter.github_project_name}}/setup.py index a36ed14..84034a1 100644 --- a/{{cookiecutter.github_project_name}}/setup.py +++ b/{{cookiecutter.github_project_name}}/setup.py @@ -36,7 +36,7 @@ ('share/jupyter/nbextensions/{{ cookiecutter.npm_package_name }}', '{{ cookiecutter.python_package_name }}/nbextension', '*.*'), ('share/jupyter/labextensions/{{ cookiecutter.npm_package_name }}', '{{ cookiecutter.python_package_name }}/labextension', "**"), ("share/jupyter/labextensions/{{ cookiecutter.npm_package_name }}", '.', "install.json"), - ('etc/jupyter/nbconfig/notebook.d', '.', '{{ cookiecutter.npm_package_name }}.json'), + ('etc/jupyter/nbconfig/notebook.d', '.', '{{ cookiecutter.python_package_name }}.json'), ] cmdclass = create_cmdclass('jsdeps', data_files_spec=data_files_spec) diff --git a/{{cookiecutter.github_project_name}}/{{cookiecutter.npm_package_name}}.json b/{{cookiecutter.github_project_name}}/{{cookiecutter.python_package_name}}.json similarity index 100% rename from {{cookiecutter.github_project_name}}/{{cookiecutter.npm_package_name}}.json rename to {{cookiecutter.github_project_name}}/{{cookiecutter.python_package_name}}.json From 861a4b6fbd5947aae0ca1826cc37bb6f408822af Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Fri, 22 Jan 2021 12:13:15 -0800 Subject: [PATCH 2/3] Fix test, and test an npm package name with a slash --- .github/workflows/main.yml | 10 +++++----- tests/testconfig.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 44b078e..39da1bc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,12 +38,12 @@ jobs: - name: Run pip install shell: bash -l {0} - run: pip install ./jupyter-widget-testwidgets + run: python -m pip install ./jupyter-widget-testwidgets - name: Test install shell: bash -l {0} run: | - test -d $CONDA_PREFIX/share/jupyter/nbextensions/jupyter-widget-testwidgets - test -f $CONDA_PREFIX/etc/jupyter/nbconfig/notebook.d/jupyter-widget-testwidgets.json - test -d $CONDA_PREFIX/share/jupyter/labextensions/jupyter-widget-testwidgets - test -f $CONDA_PREFIX/share/jupyter/labextensions/jupyter-widget-testwidgets/package.json + test -d $CONDA_PREFIX/share/jupyter/nbextensions/@jupyter-widgets/jupyter-widget-testwidgets + test -f $CONDA_PREFIX/etc/jupyter/nbconfig/notebook.d/jupyter_widget_example.json + test -d $CONDA_PREFIX/share/jupyter/labextensions/@jupyter-widgets/jupyter-widget-testwidgets + test -f $CONDA_PREFIX/share/jupyter/labextensions/@jupyter-widgets/jupyter-widget-testwidgets/package.json diff --git a/tests/testconfig.yml b/tests/testconfig.yml index db155d1..01595f3 100644 --- a/tests/testconfig.yml +++ b/tests/testconfig.yml @@ -3,6 +3,6 @@ default_context: author_email: "testwidget@example.com" github_project_name: "jupyter-widget-testwidgets" github_organization_name: "jupyter" - npm_package_name: "jupyter-widget-testwidgets" + npm_package_name: "@jupyter-widgets/jupyter-widget-testwidgets" npm_package_version: "1.1.0" project_short_description: "A Test Jupyter Widget Library" From 0665b4a3ae3d2bf71157af5a1d2c2ea5f8dc92b7 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Mon, 1 Feb 2021 23:32:57 -0800 Subject: [PATCH 3/3] Update manifest --- {{cookiecutter.github_project_name}}/MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.github_project_name}}/MANIFEST.in b/{{cookiecutter.github_project_name}}/MANIFEST.in index bf307a2..4c2b98f 100644 --- a/{{cookiecutter.github_project_name}}/MANIFEST.in +++ b/{{cookiecutter.github_project_name}}/MANIFEST.in @@ -5,7 +5,7 @@ graft js graft tests prune **/node_modules -include {{ cookiecutter.npm_package_name }}.json +include {{ cookiecutter.python_package_name }}.json include LICENSE include setup.py