Skip to content

Commit

Permalink
Modified directory structure to match default anywidget directory str…
Browse files Browse the repository at this point in the history
…ucture.
  • Loading branch information
Taylor-96 committed Jun 3, 2024
1 parent ad3341c commit eab68bc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/widget_code_input/index.js → js/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as _ from 'underscore';
import { nord } from 'cm6-theme-nord'
import { solarizedLight } from 'cm6-theme-solarized-light'
import { basicLight } from 'cm6-theme-basic-light'

import './widget.css';
export default{
initialize({ model }) {
// /* (optional) model initialization logic */
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"scripts": {
"dev": "npm run build -- --sourcemap=inline --watch",
"build": "esbuild --bundle --format=esm --outdir=src/widget_code_input/static src/widget_code_input/index.js src/widget_code_input/styles.css"
"build": "esbuild js/widget.js --minify --format=esm --bundle --outdir=src/widget_code_input/static"
},
"devDependencies": {
"esbuild": "^0.20.0",
"eslint": "^8.57.0",
"eslint-config-google": "^0.14.0"
},
"dependencies": {
"dependencies": {
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/lang-python": "^6.1.4",
"@jupyter-widgets/base": "^6.0.7",
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "hatchling.build"

[project]
name = "widget_code_input"
version = "4.0.10"
version = "4.0.12"
dependencies = ["anywidget>=0.9.1"]
readme = "README.md"
license = { file = "LICENSE.txt" }
Expand All @@ -32,12 +32,12 @@ packages = ["src/widget_code_input","widget_code_input"]

[tool.hatch.build]
only-packages = true
artifacts = ["src/widget_code_input/static/*","widget_code_input/*"]
artifacts = ["src/widget_code_input/static/*"]

[tool.hatch.build.hooks.jupyter-builder]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = ["src/widget_code_input/static/index.js"]
skip-if-exists = ["src/widget_code_input/static/index.js"]
ensured-targets = ["src/widget_code_input/static/widget.js"]
skip-if-exists = ["src/widget_code_input/static/widget.js"]
dependencies = ["hatch-jupyter-builder>=0.5.0"]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@


class CodeInputWidget(anywidget.AnyWidget):
_esm = pathlib.Path(__file__).parent / "static" / "widget.js"
_css = pathlib.Path(__file__).parent / "static" / "widget.css"
widget_instance_count=0 # counter to keep track of number of widget instances in use

function_name = Unicode('example').tag(sync=True)
Expand Down Expand Up @@ -99,8 +101,7 @@ def __init__( # pylint: disable=too-many-arguments
CodeInputWidget.widget_instance_count+=1


_esm = bundler_output_dir / "index.js"
_css = bundler_output_dir / "styles.css"

name = traitlets.Unicode().tag(sync=True)


Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit eab68bc

Please sign in to comment.