Skip to content

Commit

Permalink
feat(nix): setup to move towards uv workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
leoank committed Jan 5, 2025
1 parent e48c63d commit d985062
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 65 deletions.
11 changes: 0 additions & 11 deletions nix/containers/default.nix

This file was deleted.

20 changes: 10 additions & 10 deletions nix/containers/illum-calculate.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
inputs,
pkgs,
nix2container,
outputs,
...
}:
{
illum_calculate = inputs.nix2container.buildImage {
name = "starrynight-illum-calculate";
config = {
entrypoint = [
"${outputs.packages.starrynight}/bin/starrynight"
"illum"
];
};
pkgs.dockerTools.buildImage {
name = "ghcr.io/broadinstitute/starrynight-illum-calculate";
tag = "dev";
config = {
Cmd = [
"${outputs.packages.${pkgs.system}.starrynight}/bin/starrynight"
"illum"
];
};
}
16 changes: 9 additions & 7 deletions nix/cpgdata.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
lib,
buildPythonPackage,
fetchPypi,
poetry-core,
pytest,
cython,
setuptools,
Expand All @@ -15,28 +16,29 @@
tqdm,
lark,
}:
buildPythonPackage {
buildPythonPackage rec {
pname = "cpgdata";
version = "0.4.0";
src = fetchPypi {
inherit pname version;
sha256 = "";
sha256 = "sha256-nCDzjnEXD0Hs4lfS9NP9DbG0ly84Y8NDICbvpuMD1cU=";

};
pyproject = true;

# Relax deps constraints
# postPatch = ''
# substituteInPlace setup.py \
# --replace "scipy>=1.4.1,<1.11" "scipy>=1.4.1" \
# --replace "matplotlib>=3.1.3,<3.8" "matplotlib>=3.1.3"
# '';
postPatch = ''
substituteInPlace pyproject.toml \
--replace-warn 'polars = "^0.19"' 'polars = ">=0.19"' \
--replace-warn 'pyarrow = "^13.0"' 'pyarrow = ">=13.0"'
'';

buildInputs = [
pytest
cython
setuptools
setuptools-scm
poetry-core
];

propagatedBuildInputs = [
Expand Down
35 changes: 13 additions & 22 deletions nix/cpgparser.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,30 @@
lib,
buildPythonPackage,
fetchPypi,
pytest,
cython,
setuptools,
setuptools-scm,
maturin,
rustPlatform,
}:
buildPythonPackage {
buildPythonPackage rec {
pname = "cpgparser";
version = "0.2.0";
pyproject = true;

src = fetchPypi {
inherit pname version;
sha256 = "";
sha256 = "sha256-5k3u873kKKFyP2qps1Buq+SmIuU0BPUfa23+FaAoomE=";

};
pyproject = true;

# Relax deps constraints
# postPatch = ''
# substituteInPlace setup.py \
# --replace "scipy>=1.4.1,<1.11" "scipy>=1.4.1" \
# --replace "matplotlib>=3.1.3,<3.8" "matplotlib>=3.1.3"
# '';

buildInputs = [
pytest
cython
setuptools
setuptools-scm
maturin
nativeBuildInputs = with rustPlatform; [
maturinBuildHook
cargoSetupHook
];

propagatedBuildInputs = [
cargoDeps = rustPlatform.fetchCargoTarball {
inherit pname version src;
hash = "sha256-uz/q3cnWNf9k8bNeUIh1gzJGCWWOnPSwSoAgvlwAdlo=";
};

dependencies = [
];
pythonImportsCheck = [ "cpgparser" ];

Expand Down
17 changes: 13 additions & 4 deletions nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,24 @@
}:

let
# tools
inherit (inputs.nix2container.packages.${pkgs.system}) nix2container;
# Apps
packages = rec {
cp-pkgs = inputs.cp-flake.packages.${pkgs.system};
pipecraft = python3Packages.callPackage ./pipecraft.nix { };
cpgparser = python3Packages.callPackage ./cpgparser.nix { };
# cpgdata = python3Packages.callPackage ./cpgdata.nix { };
# starrynight = python3Packages.callPackage ./starrynight.nix { inherit pipecraft cpgdata; };
cpgdata = python3Packages.callPackage ./cpgdata.nix { inherit cpgparser; };
starrynight = python3Packages.callPackage ./starrynight.nix {
inherit cpgdata pipecraft;
inherit (cp-pkgs) cellprofiler cellprofiler-core cellprofiler-library;
};

# Containers
container_illum_calculate = pkgs.callPackage ./containers/illum-calculate.nix {
inherit nix2container outputs;
};
};

in
# Containers
# containers = import pkgs.callPackage ./containers { };
packages
11 changes: 2 additions & 9 deletions nix/pipecraft.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ buildPythonPackage {
src = ./../pipecraft;
pyproject = true;

# Relax deps constraints
# postPatch = ''
# substituteInPlace setup.py \
# --replace "scipy>=1.4.1,<1.11" "scipy>=1.4.1" \
# --replace "matplotlib>=3.1.3,<3.8" "matplotlib>=3.1.3"
# '';

buildInputs = [
pytest
cython
Expand All @@ -42,8 +35,8 @@ buildPythonPackage {
pythonImportsCheck = [ "pipecraft" ];

meta = {
description = "Centrosome";
homepage = "https://cellprofiler.org";
description = "Pipecraft library for crafting data pipelines in python";
homepage = "https://github.com/broadinstitute/starrynight";
license = lib.licenses.mit;
};

Expand Down
7 changes: 5 additions & 2 deletions nix/starrynight.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
setuptools,
setuptools-scm,
pipecraft,
cpgdata,
lark,
numpy,
contourpy,
Expand All @@ -18,6 +19,7 @@
buildPythonPackage {
pname = "starrynight";
version = "0.1.0";
pyproject = true;

src = ./../starrynight;

Expand All @@ -37,6 +39,7 @@ buildPythonPackage {

propagatedBuildInputs = [
pipecraft
cpgdata
lark
numpy
contourpy
Expand All @@ -49,8 +52,8 @@ buildPythonPackage {
pythonImportsCheck = [ "starrynight" ];

meta = {
description = "Centrosome";
homepage = "https://cellprofiler.org";
description = "Starrynight";
homepage = "https://github.com/broadinstitute/bin/starrynight";
license = lib.licenses.mit;
};

Expand Down

0 comments on commit d985062

Please sign in to comment.