vscode-extensions.capatech.betacode: init at 0.1.10 (#355720)
[NixPkgs.git] / pkgs / servers / unstructured-api / default.nix
blob759096ea1b555ad530544e238ad987b78a5f328f
2   lib,
3   stdenvNoCC,
4   fetchFromGitHub,
5   python3,
6   makeWrapper,
7   nix-update-script,
8   symlinkJoin,
9   nltk-data,
11 let
12   pythonEnv = python3.withPackages (packages: with packages; [
13     unstructured-api-tools
14     unstructured
15     pydantic
16     click
17     ratelimit
18     requests
19     pypdf
20     pycryptodome
21     safetensors
22     uvicorn
23   ] ++ packages.unstructured.optional-dependencies.local-inference);
24   version = "0.0.61";
25   unstructured_api_nltk_data = symlinkJoin {
26     name = "unstructured_api_nltk_data";
28     paths = [ nltk-data.punkt nltk-data.averaged_perceptron_tagger ];
29   };
30 in stdenvNoCC.mkDerivation {
31   pname = "unstructured-api";
32   inherit version;
34   src = fetchFromGitHub {
35     owner = "Unstructured-IO";
36     repo = "unstructured-api";
37     rev = version;
38     hash = "sha256-Ucd+SKIES9E5WgKJjg8Vihjc1hMrJ9e956Sb7QlQea8=";
39   };
41   nativeBuildInputs = [ makeWrapper ];
43   installPhase = ''
44     runHook preInstall
46     mkdir -p $out $out/bin $out/lib
47     cp -r . $out/lib
49     makeWrapper ${pythonEnv}/bin/uvicorn $out/bin/unstructured-api \
50       --set NLTK_DATA ${unstructured_api_nltk_data} \
51       --prefix PYTHONPATH : $out/lib \
52       --add-flags "prepline_general.api.app:app"
54     runHook postInstall
55   '';
57   passthru = {
58     updateScript = nix-update-script { };
59   };
61   meta = with lib; {
62     description = "open-source toolkit designed to make it easy to prepare unstructured data like PDFs, HTML and Word Documents for downstream data science tasks";
63     homepage = "https://github.com/Unstructured-IO/unstructured-api";
64     changelog = "https://github.com/Unstructured-IO/unstructured-api/releases/tag/${version}";
65     license = licenses.asl20;
66     maintainers = with maintainers; [ happysalada ];
67   };