Skip to content

Add 1-second timeout to PyPI version check on import - #650

Closed
luisremis with Copilot wants to merge 2 commits into
developfrom
copilot/fix-pypi-connection-block
Closed

Add 1-second timeout to PyPI version check on import#650
luisremis with Copilot wants to merge 2 commits into
developfrom
copilot/fix-pypi-connection-block

Conversation

Copilot AI commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Importing aperturedb triggers a blocking HTTP request to PyPI to check for the latest version. In air-gapped, VPN-restricted, or slow network environments this hangs indefinitely, blocking any program that imports the package — even if the DB itself is local.

Change

  • Added timeout=1 to the requests.get call in __init__.py. On timeout, the existing except Exception handler logs a warning and skips the version check, allowing the import to proceed immediately.
# Before
latest_version = json.loads(requests.get(
    "https://pypi.org/pypi/aperturedb/json").text)["info"]["version"]

# After
latest_version = json.loads(requests.get(
    "https://pypi.org/pypi/aperturedb/json", timeout=1).text)["info"]["version"]

Copilot AI changed the title [WIP] Fix indefinite hang on pypi connection in initialization Add 1-second timeout to PyPI version check on import Apr 10, 2026
Copilot AI requested a review from luisremis April 10, 2026 12:58
@luisremis luisremis closed this Apr 19, 2026
@luisremis
luisremis deleted the copilot/fix-pypi-connection-block branch April 19, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request to pypi to fetch version blocks connection indefinitely

2 participants