Skip to content

Commit

Permalink
prepare the initial files for ipywidgets 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Dou Du committed Dec 12, 2022
1 parent 35264ce commit 7a53fee
Show file tree
Hide file tree
Showing 24 changed files with 181 additions and 207 deletions.
53 changes: 17 additions & 36 deletions .github/workflows/build.yml
Expand Up @@ -2,62 +2,43 @@ name: Build

on:
push:
branches: "*"
branches: main
pull_request:
branches: "*"

jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.7", "3.10"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: "16.x"
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: "x64"

- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1

- name: Install dependencies
run: |
python -m pip install -U pip setuptools codecov
python -m pip install -U codecov
npm install -g codecov
- name: Test the extension
run: |
python -m pip install --upgrade -v -e ".[test, examples, docs]"
yarn run lint:check
pytest
python -m pytest
yarn run test
- name: Linting
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
yarn run lint:check
- name: Check docs can be build + links
if: ${{ matrix.os == 'ubuntu-latest' }}
working-directory: docs
run: |
sudo apt install -y pandoc
pushd docs
make html
python -m pytest --check-links
popd
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -146,7 +146,6 @@ $RECYCLE.BIN/

**/node_modules/
widget_periodictable/nbextension/index.*
widget_periodictable/labextension/*.tgz

# Coverage data
# -------------
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,4 +1,4 @@
Copyright (c) 2021 Dou Du
Copyright (c) 2022 Dou Du,Casper Welzel Andersen
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
@@ -1,7 +1,8 @@
include LICENSE.txt
include README.md

include setupbase.py
include setup.py
include pyproject.toml
include pytest.ini
include .coverage.rc

Expand Down
8 changes: 4 additions & 4 deletions docs/source/conf.py
Expand Up @@ -59,8 +59,8 @@

# General information about the project.
project = 'widget_periodictable'
copyright = '2021, Dou Du'
author = 'Dou Du'
copyright = '2022, Dou Du,Casper Welzel Andersen'
author = 'Dou Du,Casper Welzel Andersen'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -88,7 +88,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = "en"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down Expand Up @@ -148,7 +148,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'widget_periodictable.tex', 'widget_periodictable Documentation',
'Dou Du', 'manual'),
'Dou Du,Casper Welzel Andersen', 'manual'),
]


Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/index.rst
Expand Up @@ -3,7 +3,7 @@ Examples
========

This section contains several examples generated from Jupyter notebooks.
The widgets have been embedded into the page for demonstrative pruposes.
The widgets have been embedded into the page for demonstrative purposes.

.. todo::

Expand Down
2 changes: 1 addition & 1 deletion docs/source/installing.rst
Expand Up @@ -25,7 +25,7 @@ notebook (as opposed to Jupyterlab), run::
with the `appropriate flag`_. If you are using Jupyterlab, install the extension
with::

jupyter labextension install widget-periodictable
jupyter labextension install widget_periodictable

If you are installing using conda, these commands should be unnecessary, but If
you need to run them the commands should be the same (just make sure you choose the
Expand Down
15 changes: 8 additions & 7 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "widget-periodictable",
"version": "3.0.0",
"name": "widget_periodictable",
"version": "3.1.0",
"description": "A jupyter widget for a interactive periodic table.",
"keywords": [
"jupyter",
Expand All @@ -19,7 +19,7 @@
},
"license": "BSD-3-Clause",
"author": {
"name": "Dou Du, Casper Welzel Andersen and Giovanni Pizzi",
"name": "Dou Du,Casper Welzel Andersen and Giovanni Pizzi",
"email": "dou.du@epfl.ch"
},
"main": "lib/index.js",
Expand Down Expand Up @@ -49,14 +49,15 @@
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyter-widgets/base": "^1.1.10 || ^2.0.0 || ^3.0.0 || ^4.0.0"
"@jupyter-widgets/base": "^1.1.10 || ^2 || ^3 || ^4 || ^5 || ^6"
},
"devDependencies": {
"@babel/core": "^7.5.0",
"@babel/preset-env": "^7.5.0",
"@jupyter-widgets/base-manager": "^1.0.2",
"@jupyterlab/builder": "^3.0.0",
"@phosphor/application": "^1.6.0",
"@phosphor/widgets": "^1.6.0",
"@lumino/application": "^1.6.0",
"@lumino/widgets": "^1.6.0",
"@types/jest": "^26.0.0",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^3.6.0",
Expand All @@ -78,7 +79,7 @@
"ts-jest": "^26.0.0",
"ts-loader": "^8.0.0",
"typescript": "~4.1.3",
"webpack": "^5.0.0",
"webpack": "^5.61.0",
"webpack-cli": "^4.0.0"
},
"jupyterlab": {
Expand Down
113 changes: 111 additions & 2 deletions pyproject.toml
@@ -1,3 +1,112 @@
[build-system]
requires = ["jupyter_packaging==0.7.9", "jupyterlab==3.*", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = [
"hatchling>=1.3.1",
"jupyterlab==3.*",
]
build-backend = "hatchling.build"

[project]
name = "widget_periodictable"
description = "A jupyter widget for a interactive periodic table."
readme = "README.md"
license = { file = "LICENSE.txt" }
requires-python = ">=3.7"
authors = [
{ name = "Dou Du,Casper Welzel Andersen", email = "dou.du@epfl.ch" },
]
keywords = [
"IPython",
"Jupyter",
"Widgets",
]
classifiers = [
"Framework :: Jupyter",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
dependencies = [
"ipywidgets>=7.0.0",
]
version = "3.1.0"

[project.optional-dependencies]
docs = [
"jupyter_sphinx",
"nbsphinx",
"nbsphinx-link",
"pypandoc",
"pytest_check_links",
"recommonmark",
"sphinx>=1.5",
"sphinx_rtd_theme",
]
examples = []
test = [
"nbval",
"pytest-cov",
"pytest>=6.0",
]

[project.urls]
Homepage = "https://github.com/osscar-org/widget-periodictable"

[tool.hatch.build]
artifacts = [
"widget_periodictable/nbextension/index.*",
"widget_periodictable/labextension/*.tgz",
"widget_periodictable/labextension",
]

[tool.hatch.build.targets.wheel.shared-data]
"widget_periodictable/nbextension" = "share/jupyter/nbextensions/widget_periodictable"
"widget_periodictable/labextension" = "share/jupyter/labextensions/widget_periodictable"
"./install.json" = "share/jupyter/labextensions/widget_periodictable/install.json"
"./widget_periodictable.json" = "etc/jupyter/nbconfig/notebook.d/widget_periodictable.json"

[tool.hatch.build.targets.sdist]
exclude = [
".github",
]

[tool.hatch.build.hooks.jupyter-builder]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"widget_periodictable/nbextension/index.js",
"widget_periodictable/labextension/package.json",
]
skip-if-exists = [
"widget_periodictable/nbextension/index.js",
"widget_periodictable/labextension/package.json",
]
dependencies = [
"hatch-jupyter-builder>=0.5.0",
]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
path = "."
build_cmd = "build:prod"

[tool.tbump]
field = [
{ name = "channel", default = "" },
{ name = "release", default = "" },
]
file = [
{ src = "pyproject.toml", version_template = "version = \"{major}.{minor}.{patch}{channel}{release}\"" },
{ src = "widget_periodictable/_version.py" },
]

[tool.tbump.version]
current = "3.1.0"
regex = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)((?P<channel>a|b|rc|.dev)(?P<release>\\d+))?"

[tool.tbump.git]
message_template = "Bump to {new_version}"
tag_template = "v{new_version}"

0 comments on commit 7a53fee

Please sign in to comment.