Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tool-Centric APIs to the Tool Shed 2.0 #18524

Merged
merged 12 commits into from
Jul 15, 2024

Conversation

jmchilton
Copy link
Member

@jmchilton jmchilton commented Jul 10, 2024

Adds the following backend enhancements to galaxy-tool-util...

  • Brings in model layer from structured tool state work to describe tool inputs.
  • Reworks citation handling for proper separation of parsing into galaxy.tool_util.parser.
  • Implement a variety of Pydantic models to describe tool outputs.

... and brings those together to add two new APIs to the Tool Shed 2.0 designed for reasoning about tools outside of Galaxy.

  • /api/tools/{trs_tool_id}/version/{version} returns a parsed version of various information from the ToolSource abstraction that is de-coupled from XML and not dependent on Galaxy's Tool classes. The model for this information is:
class ParsedTool(BaseModel):
    id: str
    version: Optional[str]
    name: str
    description: Optional[str]
    inputs: List[ToolParameterT]
    outputs: List[ToolOutput]
    citations: List[Citation]
    license: Optional[str]
    profile: Optional[str]
    edam_operations: List[str]
    edam_topics: List[str]
    xrefs: List[XrefDict]
    help: Optional[str]
  • /api/tools/{trs_tool_id}/version/{version}/parameter_request_schema returns a JSON schema that can be used to validate a tool inputs according to the API that will be added with the Galaxy internals portion of the structured tool state PR Structured tool state #17393. This is generated from the metadata model that is exposed via the other API as the inputs field.

This is better than the last attempt #18470 for a variety of reasons - the tool state work has advanced and repeat min and max instance counts are now represented by the schema as are section elements, the tool shed API is much richer and more harmonious (modeling inputs and outputs together should allow for full workflow validation by external tooling, including citations, xrefs, and help in the API should enhance our ability to provide information about tools from sources such the IDE plugin), the caching has been reworked to be more future facing and gracefully handle model changes, and finally this version exposes stock tools as well.

How to test the changes?

(Select all options that apply)

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@jmchilton jmchilton force-pushed the structured_tool_state_models branch from 805711c to 696f9ae Compare July 10, 2024 14:29
@jmchilton jmchilton marked this pull request as ready for review July 10, 2024 17:51
@github-actions github-actions bot added this to the 24.2 milestone Jul 10, 2024
@jmchilton jmchilton marked this pull request as draft July 10, 2024 17:52
@jmchilton jmchilton force-pushed the structured_tool_state_models branch 2 times, most recently from 96db4a8 to 3412e38 Compare July 10, 2024 18:42
Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

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

Looks great, just some minor comments in line. Can't wait to play with this.

doc/source/dev/tool_state.md Outdated Show resolved Hide resolved
lib/galaxy/tool_util/parameters/_types.py Outdated Show resolved Hide resolved
lib/galaxy/tool_util/parameters/case.py Outdated Show resolved Hide resolved
lib/galaxy/tool_util/parameters/case.py Outdated Show resolved Hide resolved
lib/galaxy/tool_util/parameters/factory.py Show resolved Hide resolved
lib/galaxy/tool_util/parameters/factory.py Show resolved Hide resolved
lib/galaxy/tool_util/parameters/factory.py Outdated Show resolved Hide resolved
lib/galaxy/tool_util/parameters/factory.py Outdated Show resolved Hide resolved
lib/galaxy/tool_util/parameters/models.py Outdated Show resolved Hide resolved
@jmchilton jmchilton force-pushed the structured_tool_state_models branch 3 times, most recently from 17be053 to 665d276 Compare July 11, 2024 20:56
@jmchilton jmchilton force-pushed the structured_tool_state_models branch 2 times, most recently from 6725119 to 50a5651 Compare July 12, 2024 15:07
@jmchilton jmchilton marked this pull request as ready for review July 12, 2024 16:22
@hexylena
Copy link
Member

(Just want to say this is fantastic to see, it'll let me throw away a repository where I collect this data from live servers as the old TS doesn't expose it and I need this metadata. happy day. Thank you @jmchilton!!)

Copy link
Member

@mvdbeek mvdbeek left a comment

Choose a reason for hiding this comment

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

Looks great, let's deploy it. Can you regenerate the conflicting schema ?

@jmchilton jmchilton force-pushed the structured_tool_state_models branch from 50a5651 to fc57099 Compare July 15, 2024 13:47
@mvdbeek mvdbeek merged commit f742784 into galaxyproject:dev Jul 15, 2024
49 of 53 checks passed
@mvdbeek
Copy link
Member

mvdbeek commented Jul 15, 2024

This is so awesome, thanks a lot @jmchilton! This will enable so many cool things for a long time to come!

@galaxyproject-sentryintegration
Copy link

galaxyproject-sentryintegration bot commented Jul 16, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ ValueError: too many values to unpack (expected 3) /api/tools/{tool_id}/versions/{tool_version} View Issue
  • ‼️ AttributeError: 'NoneType' object has no attribute 'installable_revisions' /api/tools/{tool_id}/versions/{tool_version} View Issue
  • ‼️ AttributeError: 'object' object has no attribute 'app' /api/tools/{tool_id}/versions/{tool_version} View Issue
  • ‼️ ValidationError: 1 validation error for Citation https://127.0.0.1:9009/repository/display_tool View Issue
  • ‼️ AssertionError https://127.0.0.1:9009/repository/display_tool View Issue

Did you find this useful? React with a 👍 or 👎

This was referenced Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants