YAML Intellisense in Jina App Development

Image source: [1]

What is YAML?

YAML (a recursive acronym for “YAML Ain’t Markup Language”) is a human-readable data-serialization language [2]. It is often used to write configuration files that are simple and human-readable.

Image source: [3]

How is YAML used in Jina Development?

Jina applications usually contains two types of source files: Python files and YAML files. Python files define the entrypoint and customize logic. YAML is extensively used in Jina app development for Flow and Executor configuration.

jtype: Flow
version: '1'
pods:
- name: segmenter
show_exc_info: true
uses: pods/segment.yml
read_only: true
- name: encoder
show_exc_info: true
uses: pods/encode.yml
polling: any
shards: $JINA_PARALLEL
timeout_ready: 600000
read_only: true
- name: chunk_idx
polling: any
show_exc_info: true
uses: pods/chunk.yml
shards: $JINA_SHARDS
- name: doc_idx
polling: any
uses: pods/doc.yml
needs: gateway
- name: join_all
uses: _merge
needs: [doc_idx, chunk_idx]

Intellisense Support in Jina

Intellisense can provide code completion, syntax validation, argument filtering, default value filling and help text display. Enabling Intellisense will save you lots of time in writing YAML configuration files and avoid potential bugs.

Image source: [4]

Configuration in Pycharm

Step 1:

  • Click on the menu
  • Go to Preferences
  • Search for JSON Schema mappings

Configuration in VSCode

Step 1: Install the extension: YAML Language Support by Red Hat;

"yaml.schemas": {
"https://api.jina.ai/schemas/latest.json": ["/*.jina.yml", "/*.jaml"],
}
}

Intellisense In Action

Flow-level YAML

Executor-level YAML

Conclusion

In this post, we introduced our new features for YAML Intellisense. We hope this will help you speed up developing Jina applications.

Footnotes

1. Cover image source: https://unsplash.com/photos/FCHlYvR5gJI

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store