add flake

This commit is contained in:
Valentin Boettcher 2021-12-07 20:03:13 +01:00
parent dcbb0ead64
commit fab19e1368
3 changed files with 424 additions and 27 deletions

343
flake.lock generated Normal file
View file

@ -0,0 +1,343 @@
{
"nodes": {
"binfootprint": {
"inputs": {
"flake-utils": "flake-utils",
"mach-nix": "mach-nix",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1638902364,
"narHash": "sha256-XkXNBM6/CJd8soHZQHugtfPUQOKL+dtC5IVCV+d34us=",
"owner": "vale981",
"repo": "binfootprint",
"rev": "090f17d7aaf599614d0752c97e1825bd93eb0a8d",
"type": "github"
},
"original": {
"owner": "vale981",
"repo": "binfootprint",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1601282935,
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "588973065fce51f4763287f0fda87a174d78bf48",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"locked": {
"lastModified": 1601282935,
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "588973065fce51f4763287f0fda87a174d78bf48",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"locked": {
"lastModified": 1601282935,
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "588973065fce51f4763287f0fda87a174d78bf48",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"mach-nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs",
"pypi-deps-db": "pypi-deps-db"
},
"locked": {
"lastModified": 1637687243,
"narHash": "sha256-Qm0hPR9ZT1EP7lRW4udAPeb4yv6D2ONcw9ayterTP18=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "31b21203a1350bff7c541e9dfdd4e07f76d874be",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "mach-nix",
"type": "github"
}
},
"mach-nix_2": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": "nixpkgs_3",
"pypi-deps-db": "pypi-deps-db_2"
},
"locked": {
"lastModified": 1637687243,
"narHash": "sha256-Qm0hPR9ZT1EP7lRW4udAPeb4yv6D2ONcw9ayterTP18=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "31b21203a1350bff7c541e9dfdd4e07f76d874be",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "mach-nix",
"type": "github"
}
},
"mach-nix_3": {
"inputs": {
"flake-utils": "flake-utils_6",
"nixpkgs": "nixpkgs_5",
"pypi-deps-db": "pypi-deps-db_3"
},
"locked": {
"lastModified": 1637687243,
"narHash": "sha256-Qm0hPR9ZT1EP7lRW4udAPeb4yv6D2ONcw9ayterTP18=",
"owner": "DavHau",
"repo": "mach-nix",
"rev": "31b21203a1350bff7c541e9dfdd4e07f76d874be",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "mach-nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1622797669,
"narHash": "sha256-xIyWeoYExzF0KNaKcqfxEX58fN4JTIQxTJWbsAujllc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1ca6b0a0cc38dbba0441202535c92841dd39d1ae",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1638806821,
"narHash": "sha256-v2qd2Bsmzft53s43eCbN+4ocrLksRdFLyF/MAGuWuDA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bc5d68306b40b8522ffb69ba6cff91898c2fbbff",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1622797669,
"narHash": "sha256-xIyWeoYExzF0KNaKcqfxEX58fN4JTIQxTJWbsAujllc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1ca6b0a0cc38dbba0441202535c92841dd39d1ae",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1638806821,
"narHash": "sha256-v2qd2Bsmzft53s43eCbN+4ocrLksRdFLyF/MAGuWuDA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bc5d68306b40b8522ffb69ba6cff91898c2fbbff",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1622797669,
"narHash": "sha256-xIyWeoYExzF0KNaKcqfxEX58fN4JTIQxTJWbsAujllc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1ca6b0a0cc38dbba0441202535c92841dd39d1ae",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1638806821,
"narHash": "sha256-v2qd2Bsmzft53s43eCbN+4ocrLksRdFLyF/MAGuWuDA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bc5d68306b40b8522ffb69ba6cff91898c2fbbff",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"progression": {
"inputs": {
"flake-utils": "flake-utils_5",
"mach-nix": "mach-nix_3",
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1638904081,
"narHash": "sha256-AQnQEwr63mZLPJ/BcY/7Kyr/3Qb+KfUGepfISPZLVVI=",
"owner": "vale981",
"repo": "progression",
"rev": "4a559dbdfcb84a516eee64d502475e16f19238ce",
"type": "github"
},
"original": {
"owner": "vale981",
"repo": "progression",
"type": "github"
}
},
"pypi-deps-db": {
"flake": false,
"locked": {
"lastModified": 1622970040,
"narHash": "sha256-u//RFnae/XMIhoy83G2uH2Qu/1LiUhVCdwwY1xj4Ufs=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "be6591698c67a86a69c81fef72167e38d038a9fc",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"pypi-deps-db_2": {
"flake": false,
"locked": {
"lastModified": 1622970040,
"narHash": "sha256-u//RFnae/XMIhoy83G2uH2Qu/1LiUhVCdwwY1xj4Ufs=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "be6591698c67a86a69c81fef72167e38d038a9fc",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"pypi-deps-db_3": {
"flake": false,
"locked": {
"lastModified": 1622970040,
"narHash": "sha256-u//RFnae/XMIhoy83G2uH2Qu/1LiUhVCdwwY1xj4Ufs=",
"owner": "DavHau",
"repo": "pypi-deps-db",
"rev": "be6591698c67a86a69c81fef72167e38d038a9fc",
"type": "github"
},
"original": {
"owner": "DavHau",
"repo": "pypi-deps-db",
"type": "github"
}
},
"root": {
"inputs": {
"binfootprint": "binfootprint",
"flake-utils": "flake-utils_3",
"mach-nix": "mach-nix_2",
"nixpkgs": "nixpkgs_4",
"progression": "progression"
}
}
},
"root": "root",
"version": 7
}

40
flake.nix Normal file
View file

@ -0,0 +1,40 @@
{
description = "Python job manager for parallel computing.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
mach-nix.url = "github:DavHau/mach-nix";
flake-utils.url = "github:numtide/flake-utils";
binfootprint.url = "github:vale981/binfootprint";
progression.url = "github:vale981/progression";
};
outputs = { self, nixpkgs, flake-utils, mach-nix, binfootprint, progression }:
let
python = "python39";
in flake-utils.lib.eachSystem ["x86_64-linux"] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
mach-nix-wrapper = import mach-nix { inherit pkgs python; };
jobmanager = (mach-nix-wrapper.buildPythonPackage {
src = ./.;
propagatedBuildInputs = [
binfootprint.defaultPackage.${system}
progression.defaultPackage.${system}
];
});
pythonShell = mach-nix-wrapper.mkPython {
packagesExtra = [jobmanager];
};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [pythonShell black pyright];
};
defaultPackage = jobmanager;
});
}

View file

@ -9,8 +9,8 @@ from warnings import warn
author = u"Richard Hartmann"
authors = [author, u"Paul Müller"]
name = 'jobmanager'
description = 'Python job manager for parallel computing.'
name = "jobmanager"
description = "Python job manager for parallel computing."
year = "2015"
DIR = realpath(dirname(__file__))
@ -19,9 +19,10 @@ longdescription = open(join(DIR, "doc/description.txt"), "r").read().strip()
class PyDocGitHub(Command):
""" Upload the docs to GitHub gh-pages branch
"""
"""Upload the docs to GitHub gh-pages branch"""
user_options = []
def initialize_options(self):
pass
@ -29,14 +30,15 @@ class PyDocGitHub(Command):
pass
def run(self):
errno = sp.call([sys.executable, 'doc/commit_gh-pages.py'])
errno = sp.call([sys.executable, "doc/commit_gh-pages.py"])
raise SystemExit(errno)
class PyTest(Command):
""" Perform pytests
"""
"""Perform pytests"""
user_options = []
def initialize_options(self):
pass
@ -44,14 +46,17 @@ class PyTest(Command):
pass
def run(self):
import sys,subprocess
errno = sp.call([sys.executable, 'tests/runtests.py'])
import sys, subprocess
errno = sp.call([sys.executable, "tests/runtests.py"])
raise SystemExit(errno)
try:
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__))+"/"+name)
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/" + name)
# get version number
from jm_version import __version__ as version
except:
@ -62,26 +67,35 @@ if __name__ == "__main__":
setup(
name=name,
author=author,
url='https://github.com/cimatosa/jobmanager',
url="https://github.com/cimatosa/jobmanager",
version=version,
packages=[name],
package_dir={name: name},
license="MIT",
description=description,
long_description=longdescription,
install_requires=["sqlitedict>=1.2.0", "NumPy>=1.5.1"],
tests_require=["psutil", "scipy"],
keywords=["multiprocessing", "queue", "parallel", "distributed", "computing",
"progress", "manager", "job", "persistent data", "scheduler"],
classifiers= [
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.6',
'Intended Audience :: Science/Research'
],
platforms=['ALL'],
cmdclass = {'test': PyTest,
'commit_doc': PyDocGitHub,
},
)
install_requires=["sqlitedict>=1.2.0", "NumPy>=1.5.1", "scipy"],
tests_require=["psutil"],
keywords=[
"multiprocessing",
"queue",
"parallel",
"distributed",
"computing",
"progress",
"manager",
"job",
"persistent data",
"scheduler",
],
classifiers=[
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.6",
"Intended Audience :: Science/Research",
],
platforms=["ALL"],
cmdclass={
"test": PyTest,
"commit_doc": PyDocGitHub,
},
)