Commit 7025ade3 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python3Packages.ipycanvas: cleanup

parent 75f8c1fc
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
{
  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 ];
  };
}
})