diff --git a/glean_parser/util.py b/glean_parser/util.py index 4f35b615..4703df8c 100644 --- a/glean_parser/util.py +++ b/glean_parser/util.py @@ -16,11 +16,9 @@ from typing import Any, Callable, Iterable, Sequence, Tuple, Union, Optional import urllib.request -import diskcache # type: ignore import jinja2 import jsonschema # type: ignore from jsonschema import _utils # type: ignore -import platformdirs # type: ignore import yaml try: @@ -283,33 +281,18 @@ def resolve_remote(self, uri): return NullResolver.from_schema(schema) -def fetch_remote_url(url: str, cache: bool = True): +def fetch_remote_url(url: str): """ - Fetches the contents from an HTTP url or local file path, and optionally - caches it to disk. + Fetches the contents from an HTTP url or local file path. """ - # Include the Python version in the cache key, since caches aren't - # sharable across Python versions. - key = (url, str(sys.version_info)) - is_http = url.startswith("http") if not is_http: with open(url, "r", encoding="utf-8") as fd: return fd.read() - if cache: - cache_dir = platformdirs.user_cache_dir("glean_parser", "mozilla") - with diskcache.Cache(cache_dir, disk=diskcache.JSONDisk) as dc: - if key in dc: - return dc[key] - contents = urllib.request.urlopen(url).read().decode("utf-8") - if cache: - with diskcache.Cache(cache_dir, disk=diskcache.JSONDisk) as dc: - dc[key] = contents - return contents diff --git a/pyproject.toml b/pyproject.toml index 84d4fbce..8fda031d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,6 @@ classifiers = [ requires-python = ">=3.9" dependencies = [ "Click>=7", - "diskcache>=4", "Jinja2>=2.10.1", "jsonschema>=3.0.2", "platformdirs>=2.4.0", diff --git a/uv.lock b/uv.lock index 8d861b34..7457cab0 100644 --- a/uv.lock +++ b/uv.lock @@ -256,15 +256,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3c/38/bbe2e63902847cf79036ecc75550d0698af31c91c7575352eb25190d0fb3/coverage-7.9.2-py3-none-any.whl", hash = "sha256:e425cd5b00f6fc0ed7cdbd766c70be8baab4b7839e4d4fe5fac48581dd968ea4", size = 204005, upload-time = "2025-07-03T10:54:13.491Z" }, ] -[[package]] -name = "diskcache" -version = "5.6.3" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/3f/21/1c1ffc1a039ddcc459db43cc108658f32c57d271d7289a2794e401d0fdb6/diskcache-5.6.3.tar.gz", hash = "sha256:2c3a3fa2743d8535d832ec61c2054a1641f41775aa7c556758a109941e33e4fc", size = 67916, upload-time = "2023-08-31T06:12:00.316Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/3f/27/4570e78fc0bf5ea0ca45eb1de3818a23787af9b390c0b0a0033a1b8236f9/diskcache-5.6.3-py3-none-any.whl", hash = "sha256:5e31b2d5fbad117cc363ebaf6b689474db18a1f6438bc82358b024abd4c2ca19", size = 45550, upload-time = "2023-08-31T06:11:58.822Z" }, -] - [[package]] name = "docutils" version = "0.21.2" @@ -292,7 +283,6 @@ source = { editable = "." } dependencies = [ { name = "click", version = "8.1.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" }, { name = "click", version = "8.2.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.10'" }, - { name = "diskcache" }, { name = "jinja2" }, { name = "jsonschema" }, { name = "platformdirs" }, @@ -317,7 +307,6 @@ dev = [ [package.metadata] requires-dist = [ { name = "click", specifier = ">=7" }, - { name = "diskcache", specifier = ">=4" }, { name = "jinja2", specifier = ">=2.10.1" }, { name = "jsonschema", specifier = ">=3.0.2" }, { name = "platformdirs", specifier = ">=2.4.0" },