Skip to content

Commit

Permalink
Improve formatting of config option documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Nov 23, 2021
1 parent 4a8d2f6 commit 6a730a0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/configuration/options.md
Expand Up @@ -13,13 +13,35 @@ Tells isort to set the known standard library based on the specified Python vers

**Type:** String
**Default:** `py3`
**Config default:** `py3`
**Config default:** `3`
**Python & Config File Name:** py_version
**CLI Flags:**

- --py
- --python-version

**Examples:**

### Example `.isort.cfg`

```
[settings]
py_version=39
```

### Example `pyproject.toml`

```
[tool.isort]
py_version=39
```

### Example cli usage

`isort --py 39`

## Force To Top

Force specific imports to the top of their appropriate section.
Expand Down
9 changes: 9 additions & 0 deletions scripts/build_config_option_docs.py
Expand Up @@ -291,6 +291,13 @@ def __str__(self):
),
"multi_line_output": Example(cfg="multi_line_output=3", pyproject_toml="multi_line_output = 3"),
"show_version": Example(cli="isort --version"),
"py_version": Example(cli="isort --py 39",
pyproject_toml="""
py_version=39
""",
cfg="""
py_version=39
""")
}


Expand Down Expand Up @@ -335,6 +342,8 @@ def config_default(default: Any) -> str:
if default_str in CONFIG_DEFAULTS:
return CONFIG_DEFAULTS[default_str]

if default_str.startswith("py"):
return default_str[2:]
return default_str


Expand Down

0 comments on commit 6a730a0

Please sign in to comment.