> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morph-data.io/llms.txt
> Use this file to discover all available pages before exploring further.

# @morph.variables

`@morph.variables`のアノテーションで外部から渡す変数を宣言することができます。

```python theme={"dark"}
@morph.variables(
    var_name: str,
	default: Optional[Any] = None,
	required: Optional[bool] = False,
    type: Optional[Literal["str", "bool", "int", "float", "dict", "list"]] = None,
)
def func_name(context):
	# write your code here
```

## Parameters

<ParamField body="var_name" type="string" required>
  関数の実行時の引数を追加できる。

  mdxファイルから引数を渡したり、コマンド実行時に引数を指定できる。
</ParamField>

<ParamField body="default" type="any">
  デフォルト値を設定できる。

  指定しない場合はデフォルト値がNoneになる。
</ParamField>

<ParamField body="required" type="bool" default="False">
  必須項目かどうかを指定できる。必須項目の場合は指定されなかった場合にエラーが発生する。

  指定しない場合は必須項目ではない。
</ParamField>

<ParamField body="type" type="string" default="None">
  変数の型を指定できる。

  指定しない場合は自動で型推論される。
</ParamField>

## 使用例

```python theme={"dark"}
@morph.func
@morph.variables("var1")
def get_data_from_database(context):
	var1_data = context.vars["var1"]
    # write your code here using var1_data
	return pd.DataFrame({})
```
