From 581cb03fbb7875cb357afcd3583d0b459edfb569 Mon Sep 17 00:00:00 2001 From: Joerg Behrmann Date: Tue, 2 Mar 2021 18:27:44 +0100 Subject: [PATCH] ci: add isort --- .github/workflows/ci-unit-test.yml | 5 ++++- mkosi/__init__.py | 7 +++---- mkosi/__main__.py | 2 +- pyproject.toml | 5 +++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-unit-test.yml b/.github/workflows/ci-unit-test.yml index 683d85fb1..b3a82bac6 100644 --- a/.github/workflows/ci-unit-test.yml +++ b/.github/workflows/ci-unit-test.yml @@ -15,11 +15,14 @@ jobs: - uses: actions/checkout@v2 - name: Install - run: python3 -m pip install pytest mypy black + run: python3 -m pip install pytest mypy black isort - name: Check formatting run: python3 -m black --check mkosi/ tests/ + - name: Check that imports are sorted + run: python3 -m isort --verbose --check-only mkosi/ + - name: Type Checking run: python3 -m mypy mkosi diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 0a283f5c0..b1cee1444 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -36,11 +36,14 @@ import urllib.request import uuid from subprocess import DEVNULL, PIPE from textwrap import dedent +from types import FrameType from typing import ( IO, + TYPE_CHECKING, Any, BinaryIO, Callable, + ContextManager, Dict, Generator, Iterable, @@ -54,14 +57,10 @@ from typing import ( Tuple, Union, cast, - TYPE_CHECKING, - ContextManager, ) -from types import FrameType from .printer import MkosiPrinter - __version__ = "9" diff --git a/mkosi/__main__.py b/mkosi/__main__.py index f794cd373..e70e22ffe 100644 --- a/mkosi/__main__.py +++ b/mkosi/__main__.py @@ -3,7 +3,7 @@ import os import sys -from . import parse_args, complete_step, run_verb, die, MkosiException +from . import MkosiException, complete_step, die, parse_args, run_verb def main() -> None: diff --git a/pyproject.toml b/pyproject.toml index c5af75a60..31f8e56a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,8 @@ [tool.black] line-length = 119 target-version = ['py37'] + +[tool.isort] +profile = "black" +multi_line_output = 3 +py_version = "37" -- 2.47.2