diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml new file mode 100644 index 0000000..4868ddc --- /dev/null +++ b/.github/workflows/check-release.yml @@ -0,0 +1,29 @@ +name: Check Release +on: + push: + branches: ["main"] + pull_request: + branches: ["*"] + +jobs: + check_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Base Setup + uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + - name: Install Dependencies + run: | + pip install -e . + + - name: Check Release + uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Distributions + uses: actions/upload-artifact@v3 + with: + name: ipylgbst-releaser-dist-${{ github.run_number }} + path: .jupyter_releaser_checkout/dist diff --git a/.github/workflows/enforce-label.yml b/.github/workflows/enforce-label.yml new file mode 100644 index 0000000..725feab --- /dev/null +++ b/.github/workflows/enforce-label.yml @@ -0,0 +1,13 @@ +name: Enforce PR label + +on: + pull_request: + types: [labeled, unlabeled, opened, edited, synchronize] +jobs: + enforce-label: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - name: enforce-triage-label + uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..2416112 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + + + +## 0.2.0 + + diff --git a/docs/source/conf.py b/docs/source/conf.py index 5304f27..46b832d 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -71,17 +71,24 @@ # get version from python package: import os +import json here = os.path.dirname(__file__) repo = os.path.join(here, '..', '..') -_version_py = os.path.join(repo, 'ipylgbst', '_version.py') -version_ns = {} -with open(_version_py) as f: - exec(f.read(), version_ns) +package_json = os.path.join(repo, 'package.json') + +data = {} +with open(package_json) as f: + data = json.load(f) + +#_version_py = os.path.join(repo, 'ipylgbst', '_version.py') +#version_ns = {} +#with open(_version_py) as f: +# exec(f.read(), version_ns) # The short X.Y version. -version = '%i.%i' % version_ns['version_info'][:2] +version = '%s.%s' % (data["version"][0], data["version"][2]) # The full version, including alpha/beta/rc tags. -release = version_ns['__version__'] +release = data["version"] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/ipylgbst/_frontend.py b/ipylgbst/_frontend.py index 52ec33c..01e0aaa 100644 --- a/ipylgbst/_frontend.py +++ b/ipylgbst/_frontend.py @@ -7,6 +7,10 @@ """ Information about the frontend package of the widgets. """ +from packaging import version +from ._version import __version__ # noqa + +v = version.parse(__version__) module_name = "ipylgbst" -module_version = "^0.2.0" +module_version = f"^{v.major}.{v.minor}" diff --git a/pyproject.toml b/pyproject.toml index db83f74..073c860 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,3 +95,10 @@ build_dir = "ipylgbst/labextension" [tool.jupyter-releaser.options] version_cmd = "hatch version" + +[tool.jupyter-releaser.hooks] +before-build-npm = ["python -m pip install jupyterlab~=3.0", "jlpm", "jlpm build:prod"] +before-build-python = ["jlpm clean"] + +[tool.check-wheel-contents] +ignore = ["W002"] diff --git a/src/widget.ts b/src/widget.ts index b6436f1..95a84dd 100644 --- a/src/widget.ts +++ b/src/widget.ts @@ -250,24 +250,26 @@ export class LegoBoostView extends DOMWidgetView { meter_distance: HTMLMeterElement; color_color: HTMLDivElement; - isWebBluetoothSupported : boolean = navigator.bluetooth ? true : false; + isWebBluetoothSupported: boolean = navigator.bluetooth ? true : false; render() { this.el.classList.add('custom-widget'); // checking if Web Bluetooth API is supported if (!this.isWebBluetoothSupported) { - // bluetooth error box const bluetooth_box = document.createElement('div'); bluetooth_box.classList.add('error-box'); this.el.appendChild(bluetooth_box); this.txt_bluetooth = document.createElement('div'); - this.txt_bluetooth.textContent = "Your device doesn't support Web Bluetooth API. Try to turn on Experimental Platform Features from Chrome, by accessing the following link and turning it on: chrome://flags/#enable-experimental-web-platform-features"; + this.txt_bluetooth.textContent = + "Your device doesn't support Web Bluetooth API. Try to turn on Experimental Platform Features from Chrome, by accessing the following link and turning it on: chrome://flags/#enable-experimental-web-platform-features"; bluetooth_box.appendChild(this.txt_bluetooth); - console.log( "Your device doesn't support Web Bluetooth API. Try to turn on Experimental Platform Features from Chrome, by accessing the following link and turning it on: chrome://flags/#enable-experimental-web-platform-features"); + console.log( + "Your device doesn't support Web Bluetooth API. Try to turn on Experimental Platform Features from Chrome, by accessing the following link and turning it on: chrome://flags/#enable-experimental-web-platform-features" + ); } // connection box