# 0.5 to 0.8+

```{note}
Be sure to also [migrate](0.11_to_0.12.md) your `run.py` file to the new snakebids 0.12 syntax!
```

Starting in version 0.8, {func}`snakebids.generate_inputs()` returns a {class}`BidsInputs <snakebids.BidsDataset>` object instead of a {class}`dict <snakebids.BidsDatasetDict>`. This requires a change in the way info is accessed. The previous  {class}`dict <snakebids.BidsDatasetDict>` had top-level keys such as `"input_lists"`. After selecting such a key, you would pass the name of a component to get the information sought:

```python
config.update(snakebids.generate_inputs(
    bids_dir=config['bids_dir'],
    pybids_inputs=config['pybids_inputs'],
    use_bids_inputs=False,
))

config["input_lists"]["t1w"]
```

Now, the components are top level keys, and the type of property being requested is accessed using an attribute:

```python
inputs = snakebids.generate_inputs(
    bids_dir=config['bids_dir'],
    pybids_inputs=config['pybids_inputs'],
)

inputs["t1w"].entities
```

Note that the old behaviour can still be achieved by setting `use_bids_inputs=False`, as shown in the above example. However, we encourage all users to upgrade to take advantage of all the new features Snakebids has to offer.

## 1. Assign {func}`generate_inputs() <snakebids.generate_inputs()>` to a variable called `inputs`
Because {func}`~snakebids.generate_inputs` no longer returns a dict, you cannot use it to update `config`, as was previously recommended. The new best practice is to assign its return to a variable called `inputs`:

```python
inputs = snakebids.generate_inputs(
    bids_dir=config['bids_dir'],
    pybids_inputs=config['pybids_inputs'],
)
```

## 2. Change references to `config`

All references to `config['<attr>']['<comp>']`, where `<attr>` is one of `'input_path'`, `'input_zip_lists'`, `'input_lists'`, or `'input_wildcards'`, must be updated to `input['<comp>'].<attr>`. The following regexes may be helpful for search and replace:

```
# match
config\[([\x22\x27])(input_path|input_zip_lists|input_lists|input_wildcards)\1\]\[([\x22\x27])(\w+)\3\]

# replace
inputs["\4"].\2
```

In addition, all references to `config['<attr>']` where `<attr>` is one of `'sessions'`, `'subjects'`, or `'subj_wildcards'` must be updated to `input.<attr>`. The following regexes may be helpful:

```
# match
config\[([\x22\x27])(sessions|subjects|subj_wildcards)\1\]

# replace
inputs.\2
```

## 3. Update attribute names into modern forms

Although the previous attribute names are being kept around as aliases, we recommend you update to the more modern, sleeker equivalents. Replacements should be made according to the following table:

* `input_path` -> {attr}`~snakebids.BidsComponent.path`
* `input_lists` -> {attr}`~snakebids.BidsComponent.entities`
* `input_zip_lists` -> {attr}`~snakebids.BidsComponent.zip_lists`
* `input_wildcards` -> {attr}`~snakebids.BidsComponent.wildcards`

## 4. Switch to {meth}`~snakebids.BidsComponent.expand` method

Calls to snakemake's [`expand()`](#snakefiles_expand) should be replaced with the new {meth}`~snakebids.BidsComponent.expand` method available on {class}`~snakebids.BidsComponent`. See [the section](#0_8_migration_expand_func) in 0.7-0.8 migration guide for more details.
