Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds releaser #10

Merged
merged 4 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -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 .
Copy link
Collaborator

@jtpio jtpio Jun 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally it would be better to remove this step as it is not needed anymore with releaser v2.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a pip install -e . only in the check release workflow but not in the "Publish Release" workflow (the one used to do the real release) can add unexpected side effects (some dev dependencies missing in the actual release workflow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jtpio


- 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
13 changes: 13 additions & 0 deletions .github/workflows/enforce-label.yml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

<!-- <START NEW CHANGELOG ENTRY> -->

## 0.2.0

<!-- <END NEW CHANGELOG ENTRY> -->
19 changes: 13 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion ipylgbst/_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 6 additions & 4 deletions src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down