diff --git a/halig/__version__.py b/halig/__version__.py index 98a433b..3dd3d2d 100644 --- a/halig/__version__.py +++ b/halig/__version__.py @@ -1 +1 @@ -__version__ = "0.4.5" +__version__ = "0.4.6" diff --git a/halig/settings.py b/halig/settings.py index 65549f5..285dd92 100644 --- a/halig/settings.py +++ b/halig/settings.py @@ -9,6 +9,7 @@ import yaml from pydantic import DirectoryPath, Field, FilePath, HttpUrl, field_validator from pydantic_core import Url from pydantic_settings import BaseSettings, SettingsConfigDict +from rich import print class Settings(BaseSettings): @@ -82,17 +83,25 @@ class Settings(BaseSettings): keys = set() for path in self.recipient_paths: if isinstance(path, Url): - with hishel.CacheClient( - storage=hishel.FileStorage(base_path=self.cache_path / "hishel"), - ) as client: - response = client.get( - str(path), - timeout=self.remote_public_keys_timeout, + try: + with hishel.CacheClient( + storage=hishel.FileStorage( + base_path=self.cache_path / "hishel" + ), + timeout=3, + ) as client: + response = client.get( + str(path), + timeout=self.remote_public_keys_timeout, + ) + if response.status_code == httpx.codes.OK: + for line in response.content.decode().split("\n"): + if line: + keys.add(line) + except Exception as e: # noqa: BLE001 + print( + f"[yellow] Could not retrieve public key from {path}. Ignoring error: '{e}'" ) - if response.status_code == httpx.codes.OK: - for line in response.content.decode().split("\n"): - if line: - keys.add(line) elif isinstance(path, Path): with path.open("r") as f: keys.add(f.read()) diff --git a/pdm.lock b/pdm.lock index cdc5f8b..8a411c6 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "docs", "linting", "testing", "dev"] strategy = ["cross_platform"] lock_version = "4.4.1" -content_hash = "sha256:7ac93593b9b93325db09d2e6d1121558b1f40de0891790971deae7531e2b5955" +content_hash = "sha256:386a15bb1ebd589f1aa4e7f9ebf6f5795e3219716277e28fdbd0a4c9a86465fa" [[package]] name = "annotated-types" diff --git a/pyproject.toml b/pyproject.toml index 7a0f231..279f9a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,16 +4,16 @@ authors = [ ] requires-python = ">=3.10" dependencies = [ - "typer<1.0.0,>=0.6.1", + "typer>=0.12", "rich>=13.3.3", - "pydantic>=2.0.3", + "pydantic>=2.7", "pyyaml>=6.0", - "pyrage>=1.1.1", - "pendulum>=2.1.2", - "httpx>=0.24.0", - "platformdirs>=3.5.1", - "pydantic-settings>=2.0.2", - "hishel>=0.0.17", + "pyrage>=1.1", + "pendulum>=3.0", + "httpx>=0.27", + "platformdirs>=4.2", + "pydantic-settings>=2.0", + "hishel>=0.0.26", ] name = "halig" dynamic = ["version"] @@ -90,7 +90,7 @@ reportAttributeAccessIssue = false [tool.ruff.lint] extend-select = ["W", "C90", "I", "N", "UP", "S", "BLE", "B", "A", "COM", "C4", "DTZ", "T10", "EM", "ISC", "T20", "PT", "RSE", "RET", "SIM", "PTH", "ERA", "PGH", "PL", "TRY", "RUF"] -extend-ignore = ["S101", "ISC002"] +extend-ignore = ["S101", "ISC002", "COM812", "ISC001"] [tool.mypy] python_version = "3.11"