1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fetchFromGitHub,
6 isPyPy,
7 mypy,
8 pytestCheckHook,
9 requests,
10 setuptools,
11 setuptools-scm,
12}:
13
14buildPythonPackage rec {
15 pname = "charset-normalizer";
16 version = "3.4.3";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "jawah";
21 repo = "charset_normalizer";
22 tag = version;
23 hash = "sha256-ZEHxBErjjvofqe3rkkgiEuEJcoluwo+2nZrLfrsHn5Q=";
24 };
25
26 build-system = [
27 setuptools
28 setuptools-scm
29 ]
30 ++ lib.optional (!isPyPy) mypy;
31
32 env.CHARSET_NORMALIZER_USE_MYPYC = lib.optionalString (!isPyPy) "1";
33
34 nativeCheckInputs = [ pytestCheckHook ];
35
36 pythonImportsCheck = [ "charset_normalizer" ];
37
38 passthru.tests = {
39 inherit aiohttp requests;
40 };
41
42 meta = with lib; {
43 description = "Python module for encoding and language detection";
44 mainProgram = "normalizer";
45 homepage = "https://charset-normalizer.readthedocs.io/";
46 changelog = "https://github.com/jawah/charset_normalizer/blob/${src.tag}/CHANGELOG.md";
47 license = licenses.mit;
48 maintainers = with maintainers; [ fab ];
49 };
50}