1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 google-re2,
6 pyyaml,
7 pytestCheckHook,
8 setuptools,
9 setuptools-scm,
10 ua-parser-builtins,
11 ua-parser-rs,
12}:
13
14buildPythonPackage rec {
15 pname = "ua-parser";
16 version = "1.0.1";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "ua-parser";
21 repo = "uap-python";
22 tag = version;
23 fetchSubmodules = true;
24 hash = "sha256-l8EBQq5Hqw/Vx4zvWy2QQ1m7mrAiqYNK2x3yUmJj8Xw=";
25 };
26
27 build-system = [
28 pyyaml
29 setuptools
30 setuptools-scm
31 ];
32
33 dependencies = [
34 ua-parser-builtins
35 ];
36
37 optional-dependencies = {
38 yaml = [ pyyaml ];
39 re2 = [ google-re2 ];
40 regex = [ ua-parser-rs ];
41 };
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 pythonImportsCheck = [ "ua_parser" ];
46
47 meta = {
48 changelog = "https://github.com/ua-parser/uap-python/releases/tag/${version}";
49 description = "Python implementation of the UA Parser";
50 homepage = "https://github.com/ua-parser/uap-python";
51 license = lib.licenses.asl20;
52 maintainers = with lib.maintainers; [ dotlambda ];
53 };
54}