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 component example template when creating from sidebar interface #345

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

MFA-X-AI
Copy link
Member

Description

This PR adds ExampleComponent when creating a new component from the tray sidebar interface.

from xai_components.base import InArg, OutArg, InCompArg, Component, BaseComponent, xai_component, dynalist

@xai_component(color='blue')
class ExampleComponent(Component):
    """Brief description of the component.
    
    ##### inPorts:
    - input_port (type): Description of input_port.

    ##### outPorts:
    - output_port (type): Description of output_port.

    """
    input_port: InArg[type]
    output_port: OutArg[type]
    
    def execute(self, ctx) -> None:
        input_port = self.input_port.value
        print(f'The input_port value is {input_port}.')
        self.output_port.value = input_port

References

#343

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

  1. Create a new component. Ensure that the template appears on the text editor.
  2. Drag it in. Ensure that it works.

Tested on?

  • Windows
  • Linux Ubuntu
  • Centos
  • Mac
  • Others (State here -> xxx )

Copy link

Binder 👈 Launch a binder notebook on branch XpressAI/xircuits/fahreza/new-library-sample

@MFA-X-AI MFA-X-AI merged commit b6d8a9e into master Jul 22, 2024
8 of 9 checks passed
@MFA-X-AI MFA-X-AI deleted the fahreza/new-library-sample branch July 22, 2024 09:31
@MFA-X-AI MFA-X-AI restored the fahreza/new-library-sample branch July 22, 2024 09:37
@MFA-X-AI MFA-X-AI deleted the fahreza/new-library-sample branch July 22, 2024 17:33
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.

1 participant