Skip to content

Commit

Permalink
working on the hatch build step
Browse files Browse the repository at this point in the history
  • Loading branch information
paddymul committed Dec 28, 2024
1 parent 78f0473 commit f614eea
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ classifiers = [
]
dependencies = [
"anywidget >= 0.9.0",
"ipyreact",
"graphlib_backport>=1.0.0",
"packaging>=18"
]
Expand All @@ -41,8 +40,19 @@ version = "0.8.0"
[project.license]
file = "LICENSE.txt"



[tool.uv]
dev-dependencies = [
"anywidget[dev]>=0.9.0",
"jupyterlab>=4.2.5",
"ruff>=0.6.2",
"polars>=1.5.0",
]


[project.optional-dependencies]
dev = ["watchfiles", "jupyterlab"]
dev = ["watchfiles", "jupyterlab", "anywidget[dev]>=0.9.0",]

test = [
"nbval>=0.9",
Expand Down Expand Up @@ -76,6 +86,11 @@ docs = [
[project.urls]
Homepage = "https://github.com/paddymul/buckaroo"

[tool.hatch.build]
only-packages = true

[tool.hatch.envs.default]
installer = "uv"

[tool.hatch.build.targets.wheel]
include = [
Expand Down
31 changes: 31 additions & 0 deletions scripts/hatch_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""A Hatchling plugin to build the quak frontend."""

import os
import pathlib
import subprocess

from hatchling.builders.hooks.plugin.interface import BuildHookInterface

ROOT = pathlib.Path(__file__).parent / ".."


class BuckarooBuildHook(BuildHookInterface):
"""Hatchling plugin to build the quak frontend."""

PLUGIN_NAME = "buckaroo_hatch"

def initialize(self, version: str, build_data: dict) -> None:
"""Initialize the plugin."""
# if os.getenv("SKIP_DENO_BUILD", "0") == "1":
# # Skip the build if the environment variable is set
# # Useful in CI/CD pipelines
# return


bjs_core_root = ROOT / "packages/buckaroo-js-core"
if not (bjs_core_root / "dist/index.esm.js").exists():
subprocess.check_call(["npm", "install"], cwd=bjs_core_root)
subprocess.check_call(["npm", "run", "build"], cwd=bjs_core_root)
subprocess.check_call(["npm", "install"], cwd=ROOT)
subprocess.check_call(["npm", "run", "build"], cwd=ROOT)

0 comments on commit f614eea

Please sign in to comment.