Commit 62e106f8 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python3Packages.nixl: init at 1.0.1

parent 19d44034
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -137,6 +137,11 @@ effectiveStdenv.mkDerivation (finalAttrs: {

  passthru = {
    updateScript = nix-update-script { };

    # propagate the stdenv so that the python API can consume it directly
    stdenv = effectiveStdenv;

    pythonPackage = python3Packages.nixl;
  };

  meta = {
+84 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  python,
  nixl,

  # build-system
  build,
  meson-python,
  pybind11,
  pytest,
  pyyaml,
  setuptools,
  types-pyyaml,

  # dependencies
  numpy,
  torch,

  config,
  cudaSupport ? config.cudaSupport,
  cudaPackages,
}:

buildPythonPackage.override { inherit (nixl) stdenv; } (finalAttrs: {
  inherit (nixl)
    pname
    version
    src
    __structuredAttrs
    strictDeps
    nativeBuildInputs
    dontUseCmakeConfigure
    buildInputs
    mesonFlags
    ;
  pyproject = true;

  postPatch = (nixl.postPatch or "") + ''
    substituteInPlace pyproject.toml \
      --replace-fail \
        '"patchelf",' \
        ""
  '';

  build-system = [
    build
    meson-python
    pybind11
    pytest
    pyyaml
    setuptools
    types-pyyaml
  ];
  dontUseMesonConfigure = true;

  dependencies = [
    numpy
    torch
  ];

  # Install the `nixl` shim module (re-exports nixl_cu{12,13}).
  # Upstream builds this as a separate wheel via `uv build` (nixl-meta), but that doesn't work in
  # the sandbox.
  postInstall = ''
    install -Dm644 \
      src/bindings/python/nixl-meta/nixl/__init__.py \
      "$out/${python.sitePackages}/nixl/__init__.py"
  '';

  pythonImportsCheck = [
    "nixl"
  ]
  ++ lib.optionals cudaSupport [
    "nixl_cu${cudaPackages.cudaMajorVersion}"
  ];

  # No tests we can run in the sandbox
  doCheck = false;

  meta = nixl.meta // {
    description = "Python API for nixl";
  };
})
+2 −0
Original line number Diff line number Diff line
@@ -11132,6 +11132,8 @@ self: super: with self; {
  nix-prefetch-github = callPackage ../development/python-modules/nix-prefetch-github { };
  nixl = callPackage ../development/python-modules/nixl { inherit (pkgs) nixl; };
  nixpkgs-plugin-update = callPackage ../development/python-modules/nixpkgs-plugin-update { };
  nixpkgs-pytools = callPackage ../development/python-modules/nixpkgs-pytools { };