1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 python,
6 fetchPypi,
7}:
8
9let
10 format = "wheel";
11 pyShortVersion = "cp" + builtins.replaceStrings [ "." ] [ "" ] python.pythonVersion;
12 platforms = rec {
13 aarch64-darwin =
14 if pyShortVersion == "cp313" then "macosx_10_13_universal2" else "macosx_10_9_universal2";
15 aarch64-linux = "manylinux2014_aarch64.manylinux_2_17_aarch64";
16 x86_64-darwin = aarch64-darwin;
17 x86_64-linux = "manylinux2014_x86_64.manylinux_2_17_x86_64";
18 };
19 platform = platforms.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
20 hashes = rec {
21 cp312-aarch64-darwin = "sha256-Ag8jJ39jDgeerBFDheq9G9n7SsIvh5btW6bZFc5PFBs=";
22 cp312-aarch64-linux = "sha256-crv1RLwFBgu5OQm3lxWs5MD0FhmPdiKphcq7no6Zqhw=";
23 cp312-x86_64-darwin = cp312-aarch64-darwin;
24 cp312-x86_64-linux = "sha256-s/lxyvJw9nG2/89bk3s8BDClJksPAVKdyGgdYcIh8hU=";
25 cp313-aarch64-darwin = "sha256-qFUuR2c8tvH9NR7fj8rYawL4Msv7V9kO8h4Dl+ltE44=";
26 cp313-aarch64-linux = "sha256-vgXAdBQcihJsiq7MxBeVqwkaZm6rs5yh/5inS96B5mM=";
27 cp313-x86_64-darwin = cp313-aarch64-darwin;
28 cp313-x86_64-linux = "sha256-eaMzdm4n/veQLO7vvPAnmhyjk6J6cupi+OMBshqhfVk=";
29 };
30 hash =
31 hashes."${pyShortVersion}-${stdenv.system}"
32 or (throw "Unsupported Python version: ${python.pythonVersion}");
33in
34buildPythonPackage rec {
35 pname = "gurobipy";
36 version = "12.0.3";
37 inherit format;
38
39 src = fetchPypi {
40 inherit pname version;
41 python = pyShortVersion;
42 abi = pyShortVersion;
43 dist = pyShortVersion;
44 inherit format platform hash;
45 };
46
47 pythonImportsCheck = [ "gurobipy" ];
48
49 meta = {
50 description = "Python interface to Gurobi";
51 homepage = "https://www.gurobi.com";
52 license = lib.licenses.unfree;
53 maintainers = with lib.maintainers; [ wegank ];
54 platforms = builtins.attrNames platforms;
55 };
56}