Skip to content

Avoid eager FTP connection when importing SINAN helpers#243

Open
YuF-9468 wants to merge 1 commit intoAlertaDengue:mainfrom
YuF-9468:fix-sinan-lazy-import
Open

Avoid eager FTP connection when importing SINAN helpers#243
YuF-9468 wants to merge 1 commit intoAlertaDengue:mainfrom
YuF-9468:fix-sinan-lazy-import

Conversation

@YuF-9468
Copy link

@YuF-9468 YuF-9468 commented Mar 9, 2026

Closes #242

Summary

  • defer creation of the SINAN FTP-backed client until one of the public helper functions is actually called
  • cache the loaded client so repeated calls keep the previous behavior without reconnecting on every use
  • add a regression test that verifies importing pysus.online_data.SINAN no longer calls SINAN.load() eagerly

Testing

  • uv venv .venv
  • source .venv/bin/activate
  • uv pip install -e .
  • python -m unittest pysus.tests.test_sinan_online_data -v

Copy link
Collaborator

@fccoelho fccoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

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.

Avoid connecting to FTP server on import

2 participants