Skip to content

Commit 96fc45f

Browse files
committed
simplify workflow
1 parent 8d6b1f6 commit 96fc45f

File tree

4 files changed

+21
-62
lines changed

4 files changed

+21
-62
lines changed

.github/workflows/publish.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: startsWith(github.ref, 'refs/tags/v')
1212

13+
permissions:
14+
id-token: write
15+
contents: read
16+
1317
steps:
1418
- name: Checkout code
1519
uses: actions/checkout@v3
@@ -22,19 +26,17 @@ jobs:
2226
- name: Install dependencies
2327
run: |
2428
python -m pip install --upgrade pip
25-
python -m pip install build hatch hatch-jupyter-builder
29+
python -m pip install hatch hatch-jupyter-builder
2630
27-
- name: Build the package with Hatch
31+
- name: Build the widget JS
2832
run: |
29-
hatch build
33+
npm ci
34+
npm run build:widget
3035
31-
- name: Create GitHub release
32-
uses: softprops/action-gh-release@v2
33-
with:
34-
files: dist/*
35-
generate_release_notes: true
36+
- name: Build Python package
37+
run: hatch build
3638

37-
- name: Publish package to PyPI (using trusted publisher)
39+
- name: Publish package to PyPI
3840
uses: pypa/gh-action-pypi-publish@release/v1
3941
with:
4042
packages-dir: dist/

optimadewidget/optimade_widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44

55
class OptimadeQuerierWidget(anywidget.AnyWidget):
6-
_esm = "widget-dist/optimade_widget.js"
7-
_css = "widget-dist/optimade_widget.css"
6+
_esm = "optimadewidget/widget-dist/optimade_widget.js"
7+
_css = "optimadewidget/widget-dist/optimade_widget.css"
88

99
# synced state between Python ↔ JS
1010
base_url = traitlets.Unicode("").tag(sync=True)

pyproject.toml

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,15 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "widget-optimade-client"
7-
version = "0.1.0"
7+
version = "0.0.1a"
88
description = "A Jupyter widget for querying OPTIMADE-compatible providers"
99
readme = "README.md"
1010
requires-python = ">=3.8"
11-
keywords = ["jupyter", "anywidget", "optimade", "materials", "science"]
12-
classifiers = [
13-
"Development Status :: 4 - Beta",
14-
"Framework :: Jupyter",
15-
"Programming Language :: Python :: 3",
16-
"Programming Language :: Python :: 3.8",
17-
"Programming Language :: Python :: 3.9",
18-
"Programming Language :: Python :: 3.10",
19-
"Topic :: Scientific/Engineering :: Chemistry",
20-
]
2111
dependencies = ["traitlets>=5.0", "anywidget>=0.2"]
2212

23-
[project.urls]
24-
Home = "https://github.com/materialscloud-org/tools-optimadeclient-react"
25-
Source = "https://github.com/materialscloud-org/tools-optimadeclient-react"
26-
27-
[project.optional-dependencies]
28-
dev = ["jupyterlab", "notebook", "watchfiles", "pytest", "black"]
29-
30-
[tool.hatch.envs.default]
31-
features = ["dev"]
32-
33-
# Build configuration
34-
[tool.hatch.build]
35-
only-packages = true
36-
artifacts = ["widget-dist/*"]
37-
38-
[tool.hatch.build.hooks.jupyter-builder]
39-
build-function = "hatch_jupyter_builder.npm_builder"
40-
ensured-targets = ["widget-dist/optimade_widget.js"]
41-
skip-if-exists = ["widget-dist/optimade_widget.js"]
42-
dependencies = ["hatch-jupyter-builder>=0.5.0"]
43-
44-
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
45-
npm = "npm"
46-
build_cmd = "build"
47-
48-
# Optional: automatic version bumping
49-
[tool.bumpver]
50-
current_version = "v0.1.0"
51-
version_pattern = "vMAJOR.MINOR.PATCH[PYTAGNUM]"
52-
commit_message = "Bump version {old_version} -> {new_version}"
53-
commit = true
54-
tag = true
55-
push = true
56-
57-
[tool.bumpver.file_patterns]
58-
"pyproject.toml" = [
59-
'version = "{pep440_version}"',
60-
'current_version = "{version}"'
61-
]
13+
[tool.hatch.build.targets.wheel]
14+
packages = ["optimadewidget"]
15+
include = [
16+
"optimadewidget/widget-dist/*.js",
17+
"optimadewidget/widget-dist/*.css"
18+
]

vite.widget.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default defineConfig({
2121
},
2222
},
2323
cssCodeSplit: true,
24-
outDir: "widget-dist",
24+
outDir: "optimadewidget/widget-dist",
2525
emptyOutDir: true,
2626
},
2727
base: "",

0 commit comments

Comments
 (0)