1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fetchFromGitHub,
6 mypy,
7 pytestCheckHook,
8 pythonOlder,
9 requests,
10 setuptools,
11 setuptools-scm,
12}:
13
14buildPythonPackage rec {
15 pname = "charset-normalizer";
16 version = "3.4.1";
17 pyproject = true;
18
19 disabled = pythonOlder "3.5";
20
21 src = fetchFromGitHub {
22 owner = "Ousret";
23 repo = "charset_normalizer";
24 tag = version;
25 hash = "sha256-z6XUXfNJ4+2Gq2O13MgF1D3j/bVBjgAG2wCWLaNgADE=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace-fail "mypy>=1.4.1,<=1.14.0" mypy
31 '';
32
33 build-system = [
34 mypy
35 setuptools
36 setuptools-scm
37 ];
38
39 env.CHARSET_NORMALIZER_USE_MYPYC = "1";
40
41 nativeCheckInputs = [ pytestCheckHook ];
42
43 pythonImportsCheck = [ "charset_normalizer" ];
44
45 passthru.tests = {
46 inherit aiohttp requests;
47 };
48
49 meta = with lib; {
50 description = "Python module for encoding and language detection";
51 mainProgram = "normalizer";
52 homepage = "https://charset-normalizer.readthedocs.io/";
53 changelog = "https://github.com/Ousret/charset_normalizer/blob/${src.tag}/CHANGELOG.md";
54 license = licenses.mit;
55 maintainers = with maintainers; [ fab ];
56 };
57}