Reapply AZ Python fixes#198
Conversation
riya-singh28
left a comment
There was a problem hiding this comment.
@shreyasvinaya I have put some comments after the first review.
There was a problem hiding this comment.
@shreyasvinaya Please shift all the fixtures to conftest.py file.
| ] | ||
|
|
||
|
|
||
| def _get_aizynthfinder_cls(): |
There was a problem hiding this comment.
@shreyasvinaya Is a function required here instead of just try-except at the beginning of the file?
|
|
||
|
|
||
| @cache_results | ||
| def run_az_with_img( |
There was a problem hiding this comment.
@shreyasvinaya Why is the following try-except block used in run_az, but not in run_az_with_img function?
try:
config_path = f"{AZ_MODELS_PATH}/{az_model}/config.yml"
with open(config_path, "r") as _:
config_filename = config_path
except FileNotFoundError:
logger.warning("AZ config not found, trying fallback", path=config_path)
try:
with open(AZ_MODEL_CONFIG_PATH, "r") as _:
config_filename = AZ_MODEL_CONFIG_PATH
except FileNotFoundError:
raise FileNotFoundError(
f"AZ_MODEL_CONFIG_PATH not found at {AZ_MODEL_CONFIG_PATH}"
)
There was a problem hiding this comment.
handled with the common _resolve_config function
There was a problem hiding this comment.
@shreyasvinaya I compared run_az function with the run_az_with_img, and mostly it looks the same except for the image computation and output sizes. In general, this may cause issues in the future if someone updates, given that any change made in both functions.
There was a problem hiding this comment.
Update: since the core for both are the same, there is now a private function that does the common parts, each of the individual functions now format the output of the private function in their respective formats
- Replace _get_aizynthfinder_cls() with top-level try-except import - Extract _resolve_config() and _run_finder() helpers shared by both run_az and run_az_with_img, so config fallback logic is consistent - Move test fixtures from test_az.py to conftest.py for reuse Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace _get_aizynthfinder_cls() with top-level try-except import - Extract _resolve_config() and _run_finder() helpers shared by both run_az and run_az_with_img, so config fallback logic is consistent - Move test fixtures from test_az.py to conftest.py for reuse Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4d97930 to
db073d2
Compare
Extract basic-molecule check, config resolution, finder setup, and result extraction into _run_az_core so the two public functions are thin wrappers handling only caching and return-tuple shape. Add tests for _run_az_core directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…_MOLECULES) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add actions/cache step to persist downloaded models between runs - Download models in a dedicated step (only on cache miss) - Fixture honours AZ_TEST_MODELS_DIR env var to skip re-download - _download_aizynth_models skips if config.yml already present Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reapplies the AZ changes from #196 after the revert in #197.