1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 cython_0,
9 pdm-backend,
10 setuptools,
11
12 # dependencies
13 igraph,
14 leidenalg,
15 matplotlib,
16 pandas,
17 pyarrow,
18 scipy,
19 spacy,
20 spacy-lookups-data,
21 toolz,
22 tqdm,
23 wasabi,
24
25 # tests
26 en_core_web_sm,
27 pytestCheckHook,
28}:
29
30buildPythonPackage rec {
31 pname = "textnets";
32 version = "0.10.3";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "jboynyc";
37 repo = "textnets";
38 tag = "v${version}";
39 hash = "sha256-BK0bBoe6GrZpVL4HvTwzRlXRWXfKdYJDhLD2UQctTjc=";
40 };
41
42 build-system = [
43 cython_0
44 pdm-backend
45 setuptools
46 ];
47
48 pythonRelaxDeps = [
49 "pyarrow"
50 "toolz"
51 ];
52
53 dependencies = [
54 igraph
55 leidenalg
56 matplotlib
57 pandas
58 pyarrow
59 scipy
60 spacy
61 spacy-lookups-data
62 toolz
63 tqdm
64 wasabi
65 ];
66
67 nativeCheckInputs = [
68 en_core_web_sm
69 pytestCheckHook
70 ];
71
72 pythonImportsCheck = [ "textnets" ];
73
74 # Enable the package to find the cythonized .so files during testing. See #255262
75 # Set MPLBACKEND=agg for headless matplotlib on darwin. See #350784
76 preCheck = ''
77 rm -r textnets
78 export MPLBACKEND=agg
79 '';
80
81 meta = {
82 description = "Text analysis with networks";
83 homepage = "https://textnets.readthedocs.io";
84 changelog = "https://github.com/jboynyc/textnets/blob/v${version}/HISTORY.rst";
85 license = lib.licenses.gpl3Only;
86 maintainers = with lib.maintainers; [ jboy ];
87 };
88}