1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, filelock
5, idna
6, pytest-mock
7, pytestCheckHook
8, pythonOlder
9, requests
10, requests-file
11, responses
12, setuptools
13, setuptools-scm
14}:
15
16buildPythonPackage rec {
17 pname = "tldextract";
18 version = "5.1.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "john-kurkowski";
25 repo = "tldextract";
26 rev = "refs/tags/${version}";
27 hash = "sha256-x5SJcbTUrqG7mMUPXIhR1rEu3PZ+VA00dFYeoGnX5l0=";
28 };
29
30 SETUPTOOLS_SCM_PRETEND_VERSION = version;
31
32 nativeBuildInputs = [
33 setuptools
34 setuptools-scm
35 ];
36
37 propagatedBuildInputs = [
38 filelock
39 idna
40 requests
41 requests-file
42 ];
43
44 nativeCheckInputs = [
45 pytest-mock
46 pytestCheckHook
47 responses
48 ];
49
50 pythonImportsCheck = [
51 "tldextract"
52 ];
53
54 meta = with lib; {
55 description = "Python module to accurately separate the TLD from the domain of an URL";
56 longDescription = ''
57 tldextract accurately separates the gTLD or ccTLD (generic or country code top-level domain)
58 from the registered domain and subdomains of a URL.
59 '';
60 homepage = "https://github.com/john-kurkowski/tldextract";
61 changelog = "https://github.com/john-kurkowski/tldextract/blob/${version}/CHANGELOG.md";
62 license = with licenses; [ bsd3 ];
63 maintainers = with maintainers; [ fab ];
64 };
65}