From 408ce5361068f85bff93918c31a1761459f00ef4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 14 Apr 2024 19:59:34 -0500 Subject: [PATCH 1/2] Switch to hatch custom build --- hatch_build.py | 19 +++++++++++++++++++ pyproject.toml | 26 +++++--------------------- 2 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 hatch_build.py diff --git a/hatch_build.py b/hatch_build.py new file mode 100644 index 0000000..d624df9 --- /dev/null +++ b/hatch_build.py @@ -0,0 +1,19 @@ +"""A custom hatch build hook for octave_kernel.""" +import shutil +from pathlib import Path + +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + + +class CustomHook(BuildHookInterface): + """The octave_kernel build hook.""" + + def initialize(self, version, build_data): + """Initialize the hook.""" + here = Path(__file__).parent.resolve() + jupyter_data = here /"jupyter-data" + if jupyter_data.exists(): + shutil.rmtree(jupyter_data) + jupyter_data.mkdir() + shutil.copy(here / "octave_kernel" / "kernel.json", jupyter_data / "kernel.json") + shutil.copytree(here / "octave_kernel" / "images", jupyter_data / "images") \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8d6ab42..9e52cda 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,8 +33,11 @@ content-type = "text/x-rst" [project.optional-dependencies] test = ["pytest", "nbconvert", "jupyter_kernel_test", "nbconvert"] +# Used to call hatch_build.py +[tool.hatch.build.hooks.custom] + [tool.hatch.build.targets.wheel.shared-data] -"jupyter-data/share" = "share" +"jupyter-data" = "share/jupyter/kernels/octave" [tool.hatch.build.targets.sdist] artifacts = ["jupyter-data"] @@ -49,26 +52,7 @@ include = [ [tool.hatch.version] path = "octave_kernel/_version.py" source = "code" - -[tool.jupyter-releaser] -skip = ["check-links"] - -[tool.jupyter-releaser.hooks] -after-prep-git = ["make data-files"] - -[tool.tbump.version] -current = "0.35.1" -regex = ''' - (?P\d+)\.(?P\d+)\.(?P\d+) - ((?Pa|b|rc|.dev)(?P\d+))? -''' - -[tool.tbump.git] -message_template = "Bump to {new_version}" -tag_template = "v{new_version}" - -[[tool.tbump.file]] -src = "octave_kernel/_version.py" +validate-bump = false [tool.check-wheel-contents] ignore = ["W002"] \ No newline at end of file From 7eebb7fe46c98480c54ad86062e3a14dacd78cfb Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 14 Apr 2024 20:26:56 -0500 Subject: [PATCH 2/2] fix version bump --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9e52cda..33b2af8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,7 +51,6 @@ include = [ [tool.hatch.version] path = "octave_kernel/_version.py" -source = "code" validate-bump = false [tool.check-wheel-contents]