diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8b4a7894..3b41da77 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,8 +7,8 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-python@v2.1.4 + - uses: actions/checkout@v3.5.3 + - uses: actions/setup-python@v4.6.1 with: python-version: "3.8" architecture: "x64" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 3eb6a40d..f50fa690 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -4,8 +4,8 @@ jobs: run: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v3.5.3 + - uses: actions/setup-python@v4.6.1 - name: Install dependencies for pre-commit run: | python -m pip install --upgrade pip diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 17df5db3..f310f3d3 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -7,8 +7,8 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-python@v2.1.4 + - uses: actions/checkout@v3.5.3 + - uses: actions/setup-python@v4.6.1 with: python-version: "3.8" architecture: "x64" @@ -29,8 +29,8 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 - - uses: actions/setup-python@v2.1.4 + - uses: actions/checkout@v3.5.3 + - uses: actions/setup-python@v4.6.1 with: python-version: "3.8" architecture: "x64" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b918c639..fb073ff9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,10 +8,10 @@ jobs: os: [ubuntu-20.04, macos-latest, windows-latest] python-version: ["3.6"] steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v3.5.3 - name: Set up Python${{ matrix.python-version }} - uses: actions/setup-python@v2.1.4 + uses: actions/setup-python@v4.6.1 with: python-version: ${{ matrix.python-version }} architecture: x64 @@ -32,10 +32,10 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v3.5.3 - name: Set up Python${{ matrix.python-version }} - uses: actions/setup-python@v2.1.4 + uses: actions/setup-python@v4.6.1 with: python-version: ${{ matrix.python-version }} architecture: x64 @@ -52,10 +52,10 @@ jobs: coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v3.5.3 - name: Set up Python${{ matrix.python-version }} - uses: actions/setup-python@v2.1.4 + uses: actions/setup-python@v4.6.1 with: python-version: ${{ matrix.python-version }} architecture: x64 diff --git a/.github/workflows/unimport.yml b/.github/workflows/unimport.yml index 72e8b965..944637f6 100644 --- a/.github/workflows/unimport.yml +++ b/.github/workflows/unimport.yml @@ -4,8 +4,8 @@ jobs: run: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v3.5.3 + - uses: actions/setup-python@v4.6.1 - name: unimport uses: ./ with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 72a66ab7..4bee2244 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,24 +12,24 @@ repos: - id: isort - repo: https://github.com/hakancelikdev/unimport - rev: 0.16.1 + rev: 1.0.0 hooks: - id: unimport - repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 + rev: v1.7.3 hooks: - id: docformatter args: [--config=pyproject.toml] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.1.1 + rev: v1.4.1 hooks: - id: mypy additional_dependencies: [types-toml==0.1.3] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v3.0.0 hooks: - id: prettier args: [--prose-wrap=always, --print-width=88] @@ -41,15 +41,15 @@ repos: files: "\\.(py|.txt|.yaml|.json|.in|.md|.toml|.cfg|.html|.yml)$" - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.8.0 hooks: - id: pyupgrade args: [--py36-plus] - - repo: https://github.com/hakancelikdev/pyall - rev: 00a95e9fe84d9dede21c750b8edf40336ba03b3e + - repo: https://github.com/hakancelikdev/unexport + rev: 0.4.0 hooks: - - id: pyall + - id: unexport args: - --refactor - --exclude=tests|setup.py|__init__.py| diff --git a/action.yml b/action.yml index 0ec92fe4..38efecdc 100644 --- a/action.yml +++ b/action.yml @@ -10,7 +10,7 @@ inputs: runs: using: "composite" steps: - - run: pip install --upgrade pip && python -m pip install unimport==0.16.1 + - run: pip install --upgrade pip && python -m pip install unimport==1.0.0 shell: bash - run: unimport --color auto --gitignore --ignore-init ${{ inputs.extra_args }} shell: bash diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9796d4e2..12d7ced5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,6 +4,32 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - YYYY-MM-DD +## [1.0.0] - 2023-07-07 + +### Added + +- Automatically pick up config options from setup.cfg if it is present in the project + root else check and if it exists use pyproject.toml. + [#256](https://github.com/hakancelikdev/unimport/issues/256) + + If you want you can disable this feature by passing `--disable-auto-discovery-config` + +- Add github-action [#229](https://github.com/hakancelikdev/unimport/issues/229) +- Add support like command line commands in configuration files. #287 + +### Fixed + +- ignore-init setting is not working from command line call + [#263](https://github.com/hakancelikdev/unimport/issues/263) +- Running without options or a config file + [#281](https://github.com/hakancelikdev/unimport/issues/281) +- Attribute as import refactor #284 + +### Changed + +- Raise more human-readable exceptions when the key is mistyped in the configuration + [#286](https://github.com/hakancelikdev/unimport/issues/286) + ## [0.16.1] - 2023-07-05 ### Fixed diff --git a/docs/index.md b/docs/index.md index 52ed6d4f..cad94016 100644 --- a/docs/index.md +++ b/docs/index.md @@ -29,5 +29,5 @@ process with Unimport. - **Documentation** https://unimport.hakancelik.dev/ - **Issues** https://github.com/hakancelikdev/unimport/issues/ -- **Changelog** https://unimport.hakancelik.dev/CHANGELOG/ +- **Changelog** https://unimport.hakancelik.dev/1.0.0/CHANGELOG/ - **Playground** https://playground-unimport.hakancelik.dev/ diff --git a/docs/tutorial/use-with-github-action.md b/docs/tutorial/use-with-github-action.md index 4c613e69..f0ce2bce 100644 --- a/docs/tutorial/use-with-github-action.md +++ b/docs/tutorial/use-with-github-action.md @@ -7,8 +7,8 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v3.5.3 + - uses: actions/setup-python@v4.6.1 - name: Check unused imports uses: hakancelikdev/unimport@stable with: @@ -24,10 +24,10 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v3.5.3 + - uses: actions/setup-python@v4.6.1 - name: Check unused imports - uses: hakancelikdev/unimport@0.16.1 + uses: hakancelikdev/unimport@1.0.0 with: extra_args: --include src/ ``` diff --git a/mkdocs.yml b/mkdocs.yml index b02abde1..ca5cae43 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -52,7 +52,6 @@ markdown_extensions: plugins: - search: separator: '[\s\-\.]+' - prebuild_index: true - git-revision-date-localized: type: date enable_creation_date: true diff --git a/setup.cfg b/setup.cfg index e168880b..8fc9a0c4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,7 +29,7 @@ classifiers = project_urls = Documentation = https://unimport.hakancelik.dev/ Issues = https://github.com/hakancelikdev/unimport/issues/ - Changelog = https://unimport.hakancelik.dev/CHANGELOG/ + Changelog = https://unimport.hakancelik.dev/1.0.0/CHANGELOG/ [options] python_requires = >=3.6 @@ -56,16 +56,17 @@ console_scripts = [options.extras_require] docs = - mkdocs==1.4.2 - mkdocs-material==8.5.11 + mkdocs==1.4.3 + mkdocs-material==9.1.18 mkdocs-markdownextradata-plugin==0.2.5 - mkdocs-minify-plugin==0.6.2 - mkdocs-git-revision-date-localized-plugin==1.1.0 + mkdocs-minify-plugin==0.6.4 + mkdocs-git-revision-date-localized-plugin==1.2.0 mike==1.1.2 test = pytest==6.2.4; python_version == '3.6' - pytest==7.2.0; python_version != '3.6' - pytest-cov==4.0.0 + pytest==7.4.0; python_version != '3.6' + pytest-cov==4.0.0; python_version == '3.6' + pytest-cov==4.1.0; python_version != '3.6' semantic-version==2.10.0 [options.package_data] diff --git a/src/unimport/__init__.py b/src/unimport/__init__.py index c8938839..9e40ce04 100644 --- a/src/unimport/__init__.py +++ b/src/unimport/__init__.py @@ -1,2 +1,2 @@ -__version__ = "0.16.1" +__version__ = "1.0.0" __description__ = "A linter, formatter for finding and removing unused import statements." diff --git a/src/unimport/meta.py b/src/unimport/meta.py index f9106d70..9765bc9d 100644 --- a/src/unimport/meta.py +++ b/src/unimport/meta.py @@ -7,10 +7,8 @@ class MakeSingletonWithParams(type): _instances: Dict = {} def __call__(cls, *args, **kwargs): - """ - Returns the same instance if args and kwargs are the same, - otherwise, creates a new instance. - """ + """Returns the same instance if args and kwargs are the same, + otherwise, creates a new instance.""" key = (cls, args, frozenset(kwargs.items())) if key not in cls._instances: cls._instances[key] = super().__call__(*args, **kwargs) diff --git a/tests/utils.py b/tests/utils.py index 09a4e0cb..7a563d1f 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -14,8 +14,8 @@ def reopenable_temp_file(content: str, newline: Optional[str] = None) -> Iterator[Path]: """Create a reopenable tempfile to supporting multiple reads/writes. - Required to avoid file locking issues on Windows. - For more information, see: + Required to avoid file locking issues on Windows. For more + information, see: https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile :param content: string content to write.