# Dica 08 - Aplicando isort e autopep8

[![](/files/-MfuAP0TTmVUwSHDjaRn)](https://youtu.be/A3RRHIJ0514)

O [isort](https://pycqa.github.io/isort/#installing-isort) serve para ordenar os imports.

O [autopep8](https://pypi.org/project/autopep8/) serve para ajustar os arquivos segundo a [PEP8](https://peps.python.org/pep-0008/).

```
pip install isort autopep8
pip freeze | grep -E 'isort|autopep8' >> requirements.txt
```

Para perceber o efeito vamos editar

```
touch lorem.py
```

```python
# lorem.py
import requests
import json
import click


def long_function_name(var_one, var_two, var_three, var_four, var_five, var_six, var_seven, var_eight):
    return
```

Então rode

```
autopep8 --in-place --aggressive --aggressive lorem.py

find backend -name "*.py" | xargs autopep8 --max-line-length 120 --in-place

isort -m 3 *
```

O resultado será:

```python
# lorem.py
import json

import click
import requests


def long_function_name(
        var_one,
        var_two,
        var_three,
        var_four,
        var_five,
        var_six,
        var_seven,
        var_eight):
    return
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.dicas-de-django.com.br/068-08-isort-autopep8.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
