chore: promote experimental APIs to main API surface - #48
Conversation
Move the former TCT.experimental wrappers (pathfinder, neighborhood_finder, resource cache, result dataclasses) into TCT/TCT.py, replacing the legacy Path_finder and Neighborhood_finder entry points. Delete the unused low-level TCT_pathfinder.pathfinder and rename tests/test_experimental.py to tests/test_finder_api.py.
Fold the experimental tutorial content into Path_finder, Neighborhood_finder, Neighborhood_finder_multiple_nodes, and Connecting_userAPI notebooks; delete the experimental tutorial notebook and re-execute notebooks so outputs reflect the new API. Path_finder, Neighborhood_finder, and Neighborhood_finder_multiple_nodes executed cleanly against live Translator endpoints. Connecting_userAPI could not be re-executed: the external user-API endpoint (amlkg.systemsbiology.org:9990) is unreachable (SSL error), so its cells keep the previously committed outputs while the pathfinder call is updated to the new API.
Rewrite the Connecting_userAPI result cell to serialize FinderResult.to_dict() instead of the deleted TCT.Path_finder dict shape, drop the unused cache-clear import from the Path_finder quick-start (notebook re-executed), and mention the promoted pathfinder/neighborhood_finder wrappers in the docs intro.
Re-execution refreshed outputs on every cell, inflating the diff. Restore the committed outputs/execution counts for cells this PR does not modify; keep executed outputs only on the new quick-start cells and the replaced legacy-call cells.
- Add concurrency groups with cancel-in-progress so superseded runs auto-cancel instead of accumulating - Bump setup-uv v3 -> v4 in codespell.yml to match main.yml - Add docs/source/_static/ dir to fix Sphinx html_static_path warning
This reverts commit 4228153.
Move the promoted `pathfinder` and `neighborhood_finder` functions out of `TCT/TCT.py` into `TCT/TCT_pathfinder.py` and `TCT/TCT_neighborhood_finder.py`, following the repo convention of keeping finder logic in its submodule and importing/re-exporting the public names from `TCT`. The shared infrastructure stays in `TCT.py`: the result/resource dataclasses (`FinderResult`, `ResolvedNode`, `TranslatorResources`), `get_translator_resources` / `clear_translator_resource_cache`, and the node/category/resource helpers. `neighborhood_finder` is defined as `_neighborhood_finder` in its submodule (to avoid colliding with the existing low-level `TCT_neighborhood_finder.neighborhood_finder` used by the network annotator and notebooks) and re-exported under its public name from `TCT.py`, so no legacy caller changes. The submodule re-exports sit at the end of `TCT.py` (after the helpers are defined) to avoid a circular import. Retarget the finder-test monkeypatches at the submodules; helper tests are unchanged.
|
Update: restructured so the finder entry points are not all dumped in Two new commits:
Verified: |
… API Drop the private `_neighborhood_finder` alias and the legacy low-level `neighborhood_finder` / `neighborhood_finder_multiple_inputs` wrappers from `TCT_neighborhood_finder`. The developer-friendly `neighborhood_finder` (single + multiple inputs via a list) is now the only implementation, defined directly under its public name and re-exported from `TCT` without aliasing. Migrate TCT's internal caller `TCT_network_annotator.network_annotator` to the new API: one query+parse per gene via `FinderResult.raw`, replacing the old call-then-`parse_results_for_neighborhood_finder` pair (and dropping the unused ranked tuple it never consumed). Update the neighborhood notebooks (Neighborhood_extender, Neighborhood_finder, Connecting_userAPI, Neighborhood_finder_multiple_nodes) to call the new API, collapsing each legacy call + re-parse into a single call (`finder_result.raw`). Outputs of the rewritten cells are cleared pending re-execution.
|
Update: collapsed to a single
Verified: Notebook re-execution (to refresh outputs) is left as a follow-up — flag if you'd like me to re-run them against the Translator endpoints. |
Re-run Neighborhood_finder, Neighborhood_finder_multiple_nodes, Neighborhood_extender, and Connecting_userAPI end-to-end so the migrated neighborhood_finder cells carry live outputs. Connecting_userAPI runs with errors allowed; its only failure is the pre-existing SSL error on the external user-API endpoint (amlkg.systemsbiology.org:9990), unrelated to the migration.
|
Re-executed the four neighborhood notebooks against the Translator endpoints (commit
Updated the PR description accordingly (removed the "pending re-execution" note). |
* feat: isolate visualization dependencies into 'vision' extra group * feat: isolate visualization dependencies into 'vision' extra group * fix: make visualization extra valid and optional * docs: keep visualization extra change focused
…with the other pathfinder APIs.
Promotes the former
TCT.experimentaldeveloper-friendly finder wrappers into the main API surface, exported through the existing__all__+ star-import pattern.What changed
pathfinderinTCT/TCT_pathfinder.pyandneighborhood_finderinTCT/TCT_neighborhood_finder.py, re-exported fromTCT/TCT.py(repo convention: finder logic in its submodule, public names imported back intoTCT).neighborhood_finder: the legacy low-levelneighborhood_finder/neighborhood_finder_multiple_inputswrappers are removed; the developer-friendlyneighborhood_finder(handles single + multiple inputs via a list, returns aFinderResult) is now the only implementation, defined directly under its public name — no_neighborhood_finderalias.TCT/TCT.py: the result/resource dataclasses (FinderResult,ResolvedNode,TranslatorResources),get_translator_resources/clear_translator_resource_cache, and the node/category/resource helpers. The legacyPath_finderandNeighborhood_finderentry points are removed.TCT_network_annotator.network_annotatornow uses the newneighborhood_finderAPI (one query+parse per gene viaFinderResult.raw), replacing the old call-then-parse_results_for_neighborhood_finderpair and dropping the unused ranked tuple.TCT/experimental.py: deleted.tests/test_experimental.py→tests/test_finder_api.py(11 tests), with the finder-test monkeypatches retargeted at the submodules; helper tests unchanged.Path_finder,Neighborhood_finder, andNeighborhood_finder_multiple_nodes; the detailed neighborhood-workflow cells inNeighborhood_extender,Neighborhood_finder,Connecting_userAPI, andNeighborhood_finder_multiple_nodesmigrated to the newneighborhood_finderAPI (legacy call + re-parse collapsed intofinder_result.raw); all four re-executed end-to-end against Translator endpoints so the migrated cells carry live outputs.Experimental_API_tutorial.ipynbdeleted.ci: harden sphinx and codespell workflowscommit so this PR does not bundle unrelated CI hardening.pyproject.tomlintentionally untouched (no version bump).Verification
uv run pytest: finder API tests pass (11/11); the only failures are the pre-existingtests/test_main.pycases that require the optionalfastmcp(MCP) extra, unrelated to this change.ruff check: no new findings vsmainbaseline (remaining findings are pre-existing in untouched code).Neighborhood_finder,Neighborhood_finder_multiple_nodes,Neighborhood_extender,Connecting_userAPI) re-executed successfully; migratedneighborhood_findercells carry live outputs.get_translator_resources,pathfinder('asthma','albuterol',['Gene','Protein']), single + multi-inputneighborhood_finder,refresh=True, andclear_translator_resource_cacheall ran successfully against Translator endpoints.Known limitation
Connecting_userAPI.ipynbis executed with errors allowed: its cell hitting the external user-API endpoint (amlkg.systemsbiology.org:9990) fails with an SSL error (endpoint currently unreachable), which is unrelated to this change. All other cells, including the migratedneighborhood_findercell, execute successfully.