tldextract 5.1.0__tar.gz → 5.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. tldextract-5.1.1/.github/workflows/ci.yml +40 -0
  2. {tldextract-5.1.0 → tldextract-5.1.1}/CHANGELOG.md +6 -0
  3. {tldextract-5.1.0 → tldextract-5.1.1}/PKG-INFO +3 -2
  4. {tldextract-5.1.0 → tldextract-5.1.1}/README.md +1 -1
  5. {tldextract-5.1.0 → tldextract-5.1.1}/pyproject.toml +1 -0
  6. {tldextract-5.1.0 → tldextract-5.1.1}/tests/custom_suffix_test.py +7 -3
  7. {tldextract-5.1.0 → tldextract-5.1.1}/tests/test_cache.py +5 -6
  8. {tldextract-5.1.0 → tldextract-5.1.1}/tests/test_parallel.py +18 -3
  9. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/_version.py +2 -2
  10. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/cache.py +8 -8
  11. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/PKG-INFO +3 -2
  12. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/SOURCES.txt +1 -1
  13. {tldextract-5.1.0 → tldextract-5.1.1}/tox.ini +1 -1
  14. tldextract-5.1.0/.travis.yml +0 -23
  15. {tldextract-5.1.0 → tldextract-5.1.1}/.github/FUNDING.yml +0 -0
  16. {tldextract-5.1.0 → tldextract-5.1.1}/.gitignore +0 -0
  17. {tldextract-5.1.0 → tldextract-5.1.1}/LICENSE +0 -0
  18. {tldextract-5.1.0 → tldextract-5.1.1}/setup.cfg +0 -0
  19. {tldextract-5.1.0 → tldextract-5.1.1}/tests/__init__.py +0 -0
  20. {tldextract-5.1.0 → tldextract-5.1.1}/tests/cli_test.py +0 -0
  21. {tldextract-5.1.0 → tldextract-5.1.1}/tests/conftest.py +0 -0
  22. {tldextract-5.1.0 → tldextract-5.1.1}/tests/fixtures/fake_suffix_list_fixture.dat +0 -0
  23. {tldextract-5.1.0 → tldextract-5.1.1}/tests/integration_test.py +0 -0
  24. {tldextract-5.1.0 → tldextract-5.1.1}/tests/main_test.py +0 -0
  25. {tldextract-5.1.0 → tldextract-5.1.1}/tests/test_trie.py +0 -0
  26. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/.tld_set_snapshot +0 -0
  27. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/__init__.py +0 -0
  28. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/__main__.py +0 -0
  29. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/cli.py +0 -0
  30. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/py.typed +0 -0
  31. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/remote.py +0 -0
  32. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/suffix_list.py +0 -0
  33. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract/tldextract.py +0 -0
  34. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/dependency_links.txt +0 -0
  35. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/entry_points.txt +0 -0
  36. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/requires.txt +0 -0
  37. {tldextract-5.1.0 → tldextract-5.1.1}/tldextract.egg-info/top_level.txt +0 -0
@@ -0,0 +1,40 @@
1
+ name: build
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ os: [macos-latest, windows-latest, ubuntu-latest]
9
+ language:
10
+ [
11
+ {python-version: "3.8", toxenv: "py38"},
12
+ {python-version: "3.9", toxenv: "py39"},
13
+ {python-version: "3.10", toxenv: "py310"},
14
+ {python-version: "3.11", toxenv: "py311"},
15
+ {python-version: "3.12", toxenv: "py312"},
16
+ {python-version: "pypy3.8", toxenv: "pypy38"},
17
+ ]
18
+ include:
19
+ - os: ubuntu-latest
20
+ language: {python-version: "3.8", toxenv: "codestyle"}
21
+ - os: ubuntu-latest
22
+ language: {python-version: "3.8", toxenv: "lint"}
23
+ - os: ubuntu-latest
24
+ language: {python-version: "3.8", toxenv: "typecheck"}
25
+ runs-on: ${{ matrix.os }}
26
+ steps:
27
+ - name: Check out repository
28
+ uses: actions/checkout@v4
29
+ - name: Setup Python
30
+ uses: actions/setup-python@v4
31
+ with:
32
+ python-version: ${{ matrix.language.python-version }}
33
+ - name: Install Python requirements
34
+ run: |
35
+ pip install --upgrade pip
36
+ pip install --upgrade --editable '.[testing]'
37
+ - name: Test
38
+ run: tox
39
+ env:
40
+ TOXENV: ${{ matrix.language.toxenv }}
@@ -3,6 +3,12 @@
3
3
  After upgrading, update your cache file by deleting it or via `tldextract
4
4
  --update`.
5
5
 
6
+ ## 5.1.1 (2023-11-16)
7
+
8
+ * Bugfixes
9
+ * Fix path join on Windows ([#314](https://github.com/john-kurkowski/tldextract/issues/314))
10
+ * Support Python 3.12
11
+
6
12
  ## 5.1.0 (2023-11-05)
7
13
 
8
14
  * Features
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tldextract
3
- Version: 5.1.0
3
+ Version: 5.1.1
4
4
  Summary: Accurately separates a URL's subdomain, domain, and public suffix, using the Public Suffix List (PSL). By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well.
5
5
  Author-email: John Kurkowski <john.kurkowski@gmail.com>
6
6
  License: BSD-3-Clause
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
14
14
  Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
17
18
  Requires-Python: >=3.8
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE
@@ -33,7 +34,7 @@ Requires-Dist: tox; extra == "testing"
33
34
  Requires-Dist: types-filelock; extra == "testing"
34
35
  Requires-Dist: types-requests; extra == "testing"
35
36
 
36
- # tldextract [![PyPI version](https://badge.fury.io/py/tldextract.svg)](https://badge.fury.io/py/tldextract) [![Build Status](https://travis-ci.com/john-kurkowski/tldextract.svg?branch=master)](https://app.travis-ci.com/github/john-kurkowski/tldextract)
37
+ # tldextract [![PyPI version](https://badge.fury.io/py/tldextract.svg)](https://badge.fury.io/py/tldextract) [![Build Status](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml/badge.svg)](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml)
37
38
 
38
39
  `tldextract` accurately separates a URL's subdomain, domain, and public suffix,
39
40
  using [the Public Suffix List (PSL)](https://publicsuffix.org).
@@ -1,4 +1,4 @@
1
- # tldextract [![PyPI version](https://badge.fury.io/py/tldextract.svg)](https://badge.fury.io/py/tldextract) [![Build Status](https://travis-ci.com/john-kurkowski/tldextract.svg?branch=master)](https://app.travis-ci.com/github/john-kurkowski/tldextract)
1
+ # tldextract [![PyPI version](https://badge.fury.io/py/tldextract.svg)](https://badge.fury.io/py/tldextract) [![Build Status](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml/badge.svg)](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml)
2
2
 
3
3
  `tldextract` accurately separates a URL's subdomain, domain, and public suffix,
4
4
  using [the Public Suffix List (PSL)](https://publicsuffix.org).
@@ -27,6 +27,7 @@ classifiers = [
27
27
  "Programming Language :: Python :: 3.9",
28
28
  "Programming Language :: Python :: 3.10",
29
29
  "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
30
31
  ]
31
32
  requires-python = ">=3.8"
32
33
  dynamic = ["version"]
@@ -2,13 +2,17 @@
2
2
 
3
3
  import os
4
4
  import tempfile
5
+ from pathlib import Path
5
6
 
6
7
  import tldextract
7
8
  from tldextract.tldextract import ExtractResult
8
9
 
9
- FAKE_SUFFIX_LIST_URL = "file://" + os.path.join(
10
- os.path.dirname(os.path.abspath(__file__)), "fixtures/fake_suffix_list_fixture.dat"
11
- )
10
+ FAKE_SUFFIX_LIST_URL = Path(
11
+ os.path.dirname(os.path.abspath(__file__)),
12
+ "fixtures",
13
+ "fake_suffix_list_fixture.dat",
14
+ ).as_uri()
15
+
12
16
  EXTRA_SUFFIXES = ["foo1", "bar1", "baz1"]
13
17
 
14
18
  extract_using_fake_suffix_list = tldextract.TLDExtract(
@@ -1,7 +1,6 @@
1
1
  """Test the caching functionality."""
2
2
  from __future__ import annotations
3
3
 
4
- import os.path
5
4
  import sys
6
5
  import types
7
6
  from collections.abc import Hashable
@@ -56,14 +55,14 @@ def test_get_cache_dir(monkeypatch: pytest.MonkeyPatch) -> None:
56
55
  monkeypatch.delenv("HOME", raising=False)
57
56
  monkeypatch.delenv("XDG_CACHE_HOME", raising=False)
58
57
  monkeypatch.delenv("TLDEXTRACT_CACHE", raising=False)
59
- assert get_cache_dir().endswith("tldextract/.suffix_cache/")
58
+ assert get_cache_dir().endswith(str(Path("tldextract", ".suffix_cache")))
60
59
 
61
60
  # with home set, but not anything else specified, use XDG_CACHE_HOME default
62
61
  monkeypatch.setenv("HOME", "/home/john")
63
62
  monkeypatch.delenv("XDG_CACHE_HOME", raising=False)
64
63
  monkeypatch.delenv("TLDEXTRACT_CACHE", raising=False)
65
- assert get_cache_dir() == os.path.join(
66
- "/home/john", ".cache/python-tldextract", pkg_identifier
64
+ assert get_cache_dir() == str(
65
+ Path("/home/john", ".cache/python-tldextract", pkg_identifier)
67
66
  )
68
67
 
69
68
  # if XDG_CACHE_HOME is set, use it
@@ -71,8 +70,8 @@ def test_get_cache_dir(monkeypatch: pytest.MonkeyPatch) -> None:
71
70
  monkeypatch.setenv("XDG_CACHE_HOME", "/my/alt/cache")
72
71
  monkeypatch.delenv("TLDEXTRACT_CACHE", raising=False)
73
72
 
74
- assert get_cache_dir() == os.path.join(
75
- "/my/alt/cache/python-tldextract", pkg_identifier
73
+ assert get_cache_dir() == str(
74
+ Path("/my/alt/cache/python-tldextract", pkg_identifier)
76
75
  )
77
76
 
78
77
  # if TLDEXTRACT_CACHE is set, use it
@@ -1,7 +1,8 @@
1
1
  """Test ability to run in parallel with shared cache."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import os
4
- import os.path
5
6
  from multiprocessing import Pool
6
7
  from pathlib import Path
7
8
 
@@ -43,9 +44,23 @@ def test_cache_cleared_by_other_process(
43
44
  extract("google.com")
44
45
  orig_unlink = os.unlink
45
46
 
46
- def evil_unlink(filename: str) -> None:
47
+ def is_relative_to(path: Path, other_path: str | Path) -> bool:
48
+ """Return True if path is relative to other_path or False.
49
+
50
+ Taken from the Python 3.9 standard library.
51
+ Reference: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.is_relative_to
52
+ """
53
+ try:
54
+ path.relative_to(other_path)
55
+ return True
56
+ except ValueError:
57
+ return False
58
+
59
+ def evil_unlink(filename: str | Path) -> None:
47
60
  """Simulate someone deletes the file right before we try to."""
48
- if filename.startswith(cache_dir):
61
+ if (isinstance(filename, str) and filename.startswith(cache_dir)) or (
62
+ isinstance(filename, Path) and is_relative_to(filename, cache_dir)
63
+ ):
49
64
  orig_unlink(filename)
50
65
  orig_unlink(filename)
51
66
 
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '5.1.0'
16
- __version_tuple__ = version_tuple = (5, 1, 0)
15
+ __version__ = version = '5.1.1'
16
+ __version_tuple__ = version_tuple = (5, 1, 1)
@@ -6,9 +6,9 @@ import hashlib
6
6
  import json
7
7
  import logging
8
8
  import os
9
- import os.path
10
9
  import sys
11
10
  from collections.abc import Callable, Hashable, Iterable
11
+ from pathlib import Path
12
12
  from typing import (
13
13
  TypeVar,
14
14
  cast,
@@ -79,15 +79,15 @@ def get_cache_dir() -> str:
79
79
  if xdg_cache_home is None:
80
80
  user_home = os.getenv("HOME", None)
81
81
  if user_home:
82
- xdg_cache_home = os.path.join(user_home, ".cache")
82
+ xdg_cache_home = str(Path(user_home, ".cache"))
83
83
 
84
84
  if xdg_cache_home is not None:
85
- return os.path.join(
86
- xdg_cache_home, "python-tldextract", get_pkg_unique_identifier()
85
+ return str(
86
+ Path(xdg_cache_home, "python-tldextract", get_pkg_unique_identifier())
87
87
  )
88
88
 
89
89
  # fallback to trying to use package directory itself
90
- return os.path.join(os.path.dirname(__file__), ".suffix_cache/")
90
+ return str(Path(os.path.dirname(__file__), ".suffix_cache"))
91
91
 
92
92
 
93
93
  class DiskCache:
@@ -153,7 +153,7 @@ class DiskCache:
153
153
  self.file_ext + ".lock"
154
154
  ):
155
155
  try:
156
- os.unlink(os.path.join(root, filename))
156
+ os.unlink(str(Path(root, filename)))
157
157
  except FileNotFoundError:
158
158
  pass
159
159
  except OSError as exc:
@@ -165,10 +165,10 @@ class DiskCache:
165
165
  def _key_to_cachefile_path(
166
166
  self, namespace: str, key: str | dict[str, Hashable]
167
167
  ) -> str:
168
- namespace_path = os.path.join(self.cache_dir, namespace)
168
+ namespace_path = str(Path(self.cache_dir, namespace))
169
169
  hashed_key = _make_cache_key(key)
170
170
 
171
- cache_path = os.path.join(namespace_path, hashed_key + self.file_ext)
171
+ cache_path = str(Path(namespace_path, hashed_key + self.file_ext))
172
172
 
173
173
  return cache_path
174
174
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tldextract
3
- Version: 5.1.0
3
+ Version: 5.1.1
4
4
  Summary: Accurately separates a URL's subdomain, domain, and public suffix, using the Public Suffix List (PSL). By default, this includes the public ICANN TLDs and their exceptions. You can optionally support the Public Suffix List's private domains as well.
5
5
  Author-email: John Kurkowski <john.kurkowski@gmail.com>
6
6
  License: BSD-3-Clause
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
14
14
  Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
17
18
  Requires-Python: >=3.8
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE
@@ -33,7 +34,7 @@ Requires-Dist: tox; extra == "testing"
33
34
  Requires-Dist: types-filelock; extra == "testing"
34
35
  Requires-Dist: types-requests; extra == "testing"
35
36
 
36
- # tldextract [![PyPI version](https://badge.fury.io/py/tldextract.svg)](https://badge.fury.io/py/tldextract) [![Build Status](https://travis-ci.com/john-kurkowski/tldextract.svg?branch=master)](https://app.travis-ci.com/github/john-kurkowski/tldextract)
37
+ # tldextract [![PyPI version](https://badge.fury.io/py/tldextract.svg)](https://badge.fury.io/py/tldextract) [![Build Status](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml/badge.svg)](https://github.com/john-kurkowski/tldextract/actions/workflows/ci.yml)
37
38
 
38
39
  `tldextract` accurately separates a URL's subdomain, domain, and public suffix,
39
40
  using [the Public Suffix List (PSL)](https://publicsuffix.org).
@@ -1,11 +1,11 @@
1
1
  .gitignore
2
- .travis.yml
3
2
  CHANGELOG.md
4
3
  LICENSE
5
4
  README.md
6
5
  pyproject.toml
7
6
  tox.ini
8
7
  .github/FUNDING.yml
8
+ .github/workflows/ci.yml
9
9
  tests/__init__.py
10
10
  tests/cli_test.py
11
11
  tests/conftest.py
@@ -1,5 +1,5 @@
1
1
  [tox]
2
- envlist = py{38,39,310,311,py3},codestyle,lint,typecheck
2
+ envlist = py{38,39,310,311,312,py38},codestyle,lint,typecheck
3
3
 
4
4
  [testenv]
5
5
  commands = pytest {posargs}
@@ -1,23 +0,0 @@
1
- dist: focal
2
- language: python
3
- matrix:
4
- include:
5
- - python: "3.8"
6
- env: TOXENV=py38
7
- - python: "3.9"
8
- env: TOXENV=py39
9
- - python: "3.10"
10
- env: TOXENV=py310
11
- - python: "3.11"
12
- env: TOXENV=py311
13
- - python: pypy3.8-7.3.9
14
- dist: xenial
15
- env: TOXENV=pypy3
16
- - env: TOXENV=codestyle
17
- - env: TOXENV=lint
18
- - env: TOXENV=typecheck
19
- python: "3.10"
20
- install:
21
- - pip install --upgrade pip
22
- - pip install --upgrade --editable '.[testing]'
23
- script: tox
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes