Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / mlflow-server / default.nix
blob6916b3b655476d9a10bb5d1950c950cc8c341185
1 { python3, writeText}:
3 let
4   py = python3.pkgs;
5 in
6 py.toPythonApplication
7   (py.mlflow.overridePythonAttrs(old: rec {
9     propagatedBuildInputs = old.propagatedBuildInputs ++ [
10       py.boto3
11       py.mysqlclient
12     ];
14     postPatch = (old.postPatch or "") + ''
15       substituteInPlace mlflow/utils/process.py --replace \
16         "child = subprocess.Popen(cmd, env=cmd_env, cwd=cwd, universal_newlines=True," \
17         "cmd[0]='$out/bin/gunicornMlflow'; child = subprocess.Popen(cmd, env=cmd_env, cwd=cwd, universal_newlines=True,"
18     '';
20     gunicornScript = writeText "gunicornMlflow"
21     ''
22         #!/usr/bin/env python
23         import re
24         import sys
25         from gunicorn.app.wsgiapp import run
26         if __name__ == '__main__':
27           sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', ''', sys.argv[0])
28           sys.exit(run())
29       '';
31     postInstall = ''
32       gpath=$out/bin/gunicornMlflow
33       cp ${gunicornScript} $gpath
34       chmod 555 $gpath
35     '';
36 }))