Skip to content

Commit 79d09bf

Browse files
authored
Switch to hatch custom build (#238)
* Switch to hatch custom build * fix version bump
1 parent 5ec0ad6 commit 79d09bf

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

hatch_build.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""A custom hatch build hook for octave_kernel."""
2+
import shutil
3+
from pathlib import Path
4+
5+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
6+
7+
8+
class CustomHook(BuildHookInterface):
9+
"""The octave_kernel build hook."""
10+
11+
def initialize(self, version, build_data):
12+
"""Initialize the hook."""
13+
here = Path(__file__).parent.resolve()
14+
jupyter_data = here /"jupyter-data"
15+
if jupyter_data.exists():
16+
shutil.rmtree(jupyter_data)
17+
jupyter_data.mkdir()
18+
shutil.copy(here / "octave_kernel" / "kernel.json", jupyter_data / "kernel.json")
19+
shutil.copytree(here / "octave_kernel" / "images", jupyter_data / "images")

pyproject.toml

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ content-type = "text/x-rst"
3333
[project.optional-dependencies]
3434
test = ["pytest", "nbconvert", "jupyter_kernel_test", "nbconvert"]
3535

36+
# Used to call hatch_build.py
37+
[tool.hatch.build.hooks.custom]
38+
3639
[tool.hatch.build.targets.wheel.shared-data]
37-
"jupyter-data/share" = "share"
40+
"jupyter-data" = "share/jupyter/kernels/octave"
3841

3942
[tool.hatch.build.targets.sdist]
4043
artifacts = ["jupyter-data"]
@@ -48,27 +51,7 @@ include = [
4851

4952
[tool.hatch.version]
5053
path = "octave_kernel/_version.py"
51-
source = "code"
52-
53-
[tool.jupyter-releaser]
54-
skip = ["check-links"]
55-
56-
[tool.jupyter-releaser.hooks]
57-
after-prep-git = ["make data-files"]
58-
59-
[tool.tbump.version]
60-
current = "0.35.1"
61-
regex = '''
62-
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
63-
((?P<channel>a|b|rc|.dev)(?P<release>\d+))?
64-
'''
65-
66-
[tool.tbump.git]
67-
message_template = "Bump to {new_version}"
68-
tag_template = "v{new_version}"
69-
70-
[[tool.tbump.file]]
71-
src = "octave_kernel/_version.py"
54+
validate-bump = false
7255

7356
[tool.check-wheel-contents]
7457
ignore = ["W002"]

0 commit comments

Comments
 (0)