diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..b8229c5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,81 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1733220138, + "narHash": "sha256-Yh5XZ9yVurrcYdNTSWxYgW4+EJ0pcOqgM1043z9JaRc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bcb68885668cccec12276bbb379f8f2557aa06ce", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_master": { + "locked": { + "lastModified": 1733517114, + "narHash": "sha256-tS3gtFB5txYZzYhvYO+FbfdPt9Ua0Ee+ZcBm1+V9q2s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "938d142c35d037ca8a9d620524c8a62c849a515e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nixpkgs_master": "nixpkgs_master", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..455176f --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nixpkgs_master.url = "github:NixOS/nixpkgs/master"; + systems.url = "github:nix-systems/default"; + flake-utils.url = "github:numtide/flake-utils"; + flake-utils.inputs.systems.follows = "systems"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + systems, + ... + } @ inputs: + flake-utils.lib.eachDefaultSystem ( + system: let + pkgs = import nixpkgs { + system = system; + config.allowUnfree = true; + }; + + in + with pkgs; rec { + callPackage = lib.callPackageWith (pkgs // packages // python3Packages); + + packages = { + centrosome = callPackage ./nix/centrosome.nix {}; + }; + + devShells = { + default = let + python_with_pkgs = (pkgs.python3.withPackages(pp: [ + packages.centrosome + ])); + in + mkShell { + packages = [ + python_with_pkgs + ]; + venvDir = "./.venv"; + postVenvCreation = '' + unset SOURCE_DATE_EPOCH + ''; + postShellHook = '' + unset SOURCE_DATE_EPOCH + ''; + shellHook = '' + runHook venvShellHook + export PYTHONPATH=${python_with_pkgs}/${python_with_pkgs.sitePackages}:$PYTHONPATH + ''; + }; + }; + } + ); +} diff --git a/nix/centrosome.nix b/nix/centrosome.nix new file mode 100644 index 0000000..39f0f48 --- /dev/null +++ b/nix/centrosome.nix @@ -0,0 +1,47 @@ +{ + lib, + # build deps + buildPythonPackage, + fetchFromGitHub, + pip, + setuptools, + # test deps + pytest, + cython, + # runtime deps + deprecation, + numpy, + scipy, + scikit-image, +}: +buildPythonPackage { + pname = "centrosome"; + version = "1.3.0"; + + src = fetchFromGitHub { + owner = "afermg"; + repo = "centrosome"; + rev = "d9313e13c557264f8899f6bac3a5210e4580b40e"; + sha256 = "sha256-ufCLHpYdC6XeWGIa4TulhuO08+ZtQ8iSZv0uGcRhZkQ="; + }; + pyproject = true; + buildInputs = [ + cython + pip + setuptools + ]; + propagatedBuildInputs = [ + deprecation + numpy + scipy + scikit-image + pytest + ]; + pythonImportsCheck = []; + + meta = { + description = "Centrosome"; + homepage = "https://cellprofiler.org"; + license = lib.licenses.bsd3; + }; +} diff --git a/setup.py b/setup.py index 5e449a5..f4c469b 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ from __future__ import absolute_import + import glob import os.path import sys @@ -78,7 +79,7 @@ def run_tests(self): ] if __suffix == "pyx": - __extensions = Cython.Build.cythonize(__extensions, compiler_directives={'language_level' : "3"}) + __extensions = Cython.Build.cythonize(__extensions, compiler_directives={'language_level': "3"}) setuptools.setup( author="Nodar Gogoberidze", @@ -95,6 +96,7 @@ def run_tests(self): "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering", ], @@ -107,20 +109,11 @@ def run_tests(self): }, install_requires=[ "deprecation", - "matplotlib>=3.1.3,<3.8", - # we don't depend on this directly but matplotlib does - # and does not put an upper pin on it - # if removing upper pin on scikit-image here, - # then delete contourpy as a dependency as well - "contourpy<1.2.0", - "numpy>=1.18.2,<2", - "scikit-image>=0.17.2,<0.22.0", - # we don't depend on this directly but scikit-image does - # and does not put an upper pin on it - # if removing upper pin on scikit-image here, - # then delete PyWavelets as a dependency as well - "PyWavelets<1.5", - "scipy>=1.4.1,<1.11", + "matplotlib>=3.1.3,<4", + "numpy>=1.18.2,<3", + "pillow>=7.1.0,<12", + "scikit-image>=0.17.2,<=0.24", + "scipy>=1.4.1,!=1.11.0,<2", ], tests_require=[ "pytest", @@ -130,7 +123,7 @@ def run_tests(self): long_description="", name="centrosome", packages=["centrosome"], - setup_requires=["cython", "numpy", "pytest",], + setup_requires=["cython", "numpy", "pytest", ], url="https://github.com/CellProfiler/centrosome", - version="1.2.3", + version="1.3.0", )