1{
2 lib,
3 buildPythonPackage,
4 click,
5 fetchPypi,
6 magika,
7 numpy,
8 onnxruntime,
9 hatchling,
10 python-dotenv,
11 pythonOlder,
12 stdenv,
13 tabulate,
14 testers,
15 tqdm,
16}:
17
18buildPythonPackage rec {
19 pname = "magika";
20 version = "0.6.2";
21 pyproject = true;
22 disabled = pythonOlder "3.9";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-N+tq6AIPbmjyMbwGBSwKDL6Ob6J0kts0Xo3IZ9vOsGc=";
27 };
28
29 nativeBuildInputs = [ hatchling ];
30
31 propagatedBuildInputs = [
32 click
33 numpy
34 onnxruntime
35 python-dotenv
36 tabulate
37 tqdm
38 ];
39
40 pythonImportsCheck = [ "magika" ];
41
42 passthru.tests.version = testers.testVersion { package = magika; };
43
44 meta = with lib; {
45 description = "Detect file content types with deep learning";
46 homepage = "https://github.com/google/magika";
47 changelog = "https://github.com/google/magika/blob/python-v${version}/python/CHANGELOG.md";
48 license = licenses.asl20;
49 maintainers = with maintainers; [ mihaimaruseac ];
50 mainProgram = "magika-python-client";
51 # Currently, disabling on AArch64 as it onnx runtime crashes on ofborg
52 broken = stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux;
53 };
54}