From 7025ade3e9d3ce10aa272df4a977a9135aba238e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 27 Mar 2026 22:47:13 +0000 Subject: [PATCH] python3Packages.ipycanvas: cleanup --- .../python-modules/ipycanvas/default.nix | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/ipycanvas/default.nix b/pkgs/development/python-modules/ipycanvas/default.nix index fa05db7ed6ee..934536132fe0 100644 --- a/pkgs/development/python-modules/ipycanvas/default.nix +++ b/pkgs/development/python-modules/ipycanvas/default.nix @@ -1,38 +1,44 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, + + # build-system hatch, hatch-build-scripts, hatch-nodejs-version, + hatchling, + jupyterlab, + + # dependencies ipywidgets, numpy, pillow, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "ipycanvas"; version = "0.14.3"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-xqU6Iu6/TWEbFouPRDQUWIPyenV1UJvZmkv8SMU4Wjk="; + src = fetchFromGitHub { + owner = "jupyter-widgets-contrib"; + repo = "ipycanvas"; + tag = "v${finalAttrs.version}"; + hash = "sha256-VvNCe3+zK3qSuYErO4H2UlfAClvfDmisExWHx48cjUo="; }; - # We relax dependencies here instead of pulling in a patch because upstream - # has released a new version using hatch-jupyter-builder, but it is not yet - # trivial to upgrade to that. - # + # _version.py is supposed to be generated by a script postPatch = '' - substituteInPlace pyproject.toml \ - --replace-fail '"jupyterlab>=3,<5",' "" \ + echo '__version__ = "{${finalAttrs.version}}"' > ipycanvas/_version.py ''; build-system = [ hatch hatch-build-scripts hatch-nodejs-version + hatchling + jupyterlab ]; env.HATCH_BUILD_NO_HOOKS = true; @@ -49,8 +55,8 @@ buildPythonPackage rec { meta = { description = "Expose the browser's Canvas API to IPython"; homepage = "https://ipycanvas.readthedocs.io"; - changelog = "https://github.com/jupyter-widgets-contrib/ipycanvas/releases/tag/${version}"; + changelog = "https://github.com/jupyter-widgets-contrib/ipycanvas/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ bcdarwin ]; }; -} +})