diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 584f680..d9b8b66 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,12 +3,13 @@ updates: - package-ecosystem: "pip" directory: "/" schedule: - interval: "daily" + interval: "weekly" labels: - "dependency" assignees: - "cdce8p" open-pull-requests-limit: 10 + rebase-strategy: "disabled" - package-ecosystem: "github-actions" directory: "/" @@ -19,3 +20,4 @@ updates: assignees: - "cdce8p" open-pull-requests-limit: 10 + rebase-strategy: "disabled" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9988e00..3ffa998 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2.2.1 + uses: actions/setup-python@v2.2.2 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Generate partial Python venv restore key @@ -37,7 +37,7 @@ jobs: 'requirements_test_pre_commit.txt') }}" - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: venv key: >- @@ -60,7 +60,7 @@ jobs: hashFiles('.pre-commit-config.yaml') }}" - name: Restore pre-commit environment id: cache-precommit - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: ${{ env.PRE_COMMIT_CACHE }} key: >- @@ -82,12 +82,12 @@ jobs: uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2.2.1 + uses: actions/setup-python@v2.2.2 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -99,7 +99,7 @@ jobs: exit 1 - name: Restore pre-commit environment id: cache-precommit - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: ${{ env.PRE_COMMIT_CACHE }} key: ${{ runner.os }}-${{ needs.prepare-base.outputs.pre-commit-key }} @@ -123,12 +123,12 @@ jobs: uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2.2.1 + uses: actions/setup-python@v2.2.2 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -153,12 +153,12 @@ jobs: uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2.2.1 + uses: actions/setup-python@v2.2.2 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ @@ -187,7 +187,7 @@ jobs: uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.2.1 + uses: actions/setup-python@v2.2.2 with: python-version: ${{ matrix.python-version }} - name: Generate partial Python venv restore key @@ -198,7 +198,7 @@ jobs: 'requirements_test_pre_commit.txt') }}" - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: venv key: >- @@ -228,12 +228,12 @@ jobs: uses: actions/checkout@v2.3.4 - name: Set up Python ${{ matrix.python-version }} id: python - uses: actions/setup-python@v2.2.1 + uses: actions/setup-python@v2.2.2 with: python-version: ${{ matrix.python-version }} - name: Restore Python virtual environment id: cache-venv - uses: actions/cache@v2.1.4 + uses: actions/cache@v2.1.6 with: path: venv key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b475ec6..9cfa56c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,13 +17,13 @@ jobs: uses: actions/checkout@v2.3.4 - name: Set up Python ${{ env.DEFAULT_PYTHON }} id: python - uses: actions/setup-python@v2.2.1 + uses: actions/setup-python@v2.2.2 with: python-version: ${{ env.DEFAULT_PYTHON }} - name: Install requirements run: | python -m pip install -U pip twine wheel - python -m pip install -U "setuptools>=56.0.0" + python -m pip install -U "setuptools>=57.1.0" - name: Build distributions run: | python setup.py sdist bdist_wheel diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4e4788..d49e520 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,18 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.12.0 + rev: v2.21.2 hooks: - id: pyupgrade args: [--py38-plus] exclude: &fixtures ^tests/fixtures/.+\.py$ - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.0 + rev: 3.9.2 hooks: - id: flake8 files: ^(python_typing_update|script|tests)/.+\.py$ exclude: *fixtures - repo: https://github.com/PyCQA/isort - rev: 5.8.0 + rev: 5.9.2 hooks: - id: isort exclude: *fixtures diff --git a/.vscode/settings.default.json b/.vscode/settings.default.json index 5fd5288..2dd8fb0 100644 --- a/.vscode/settings.default.json +++ b/.vscode/settings.default.json @@ -7,7 +7,9 @@ "python.linting.flake8Enabled": true, "python.linting.pylintEnabled": true, "python.linting.mypyEnabled": true, - "python.testing.pytestArgs": [], + "python.testing.pytestArgs": [ + "--disable-warnings" + ], "python.testing.unittestEnabled": false, "python.testing.nosetestsEnabled": false, "python.testing.pytestEnabled": true, diff --git a/pylintrc b/pylintrc index 0edbafa..5b85e64 100644 --- a/pylintrc +++ b/pylintrc @@ -1,19 +1,19 @@ [MASTER] ignore= +load-plugins = + pylint.extensions.typing, [BASIC] -good-names= +good-names = i,j,k,_,fp,it,ex,logger [MESSAGE CONTROL] # Reasons disabled: # superfluous-parens - used with := # duplicate-code - for scripts acceptable -disable= +disable = superfluous-parens, - missing-module-docstring, - missing-class-docstring, - missing-function-docstring, + missing-docstring, too-many-instance-attributes, too-many-return-statements, too-many-locals, @@ -25,7 +25,11 @@ disable= duplicate-code, [FORMAT] -max-line-length=119 +max-line-length = 119 [REPORTS] score = no + +[TYPING] +py-version = 3.8 +runtime-typing = no diff --git a/python_typing_update/const.py b/python_typing_update/const.py index e05773d..3a6460a 100644 --- a/python_typing_update/const.py +++ b/python_typing_update/const.py @@ -6,8 +6,8 @@ from enum import Flag, auto from typing import NamedTuple -version = (0, 3, 3) -dev_version = None # Set to `None` for release +version = (0, 3, 4) +dev_version = 0 # Set to `None` for release version_str = '.'.join(map(str, version)) if dev_version is not None: diff --git a/python_typing_update/main.py b/python_typing_update/main.py index 14920eb..fa122b1 100644 --- a/python_typing_update/main.py +++ b/python_typing_update/main.py @@ -136,7 +136,7 @@ async def async_load_file(filename: str) -> tuple[str, FileAttributes]: active_tasks -= 1 return filename, FileAttributes(file_status, imports_set) - results = await asyncio.gather(*[async_load_file(file_) for file_ in filenames]) + results = await asyncio.gather(*(async_load_file(file_) for file_ in filenames)) return dict(results) @@ -177,7 +177,7 @@ async def async_run(args: argparse.Namespace) -> int: builtins.print = lambda *args, **kwargs: None return_values = await asyncio.gather( - *[typing_update(loop, filename, args, attrs.status) for filename, attrs in filenames.items()]) + *(typing_update(loop, filename, args, attrs.status) for filename, attrs in filenames.items())) for status, filename in return_values: if status == 0: files_updated.append(filename) @@ -204,10 +204,10 @@ async def async_run(args: argparse.Namespace) -> int: return 0 files_updated_set: set[str] = set(files_updated) - files_with_comments = sorted([ + files_with_comments = sorted( filename for filename, attrs in filenames.items() if FileStatus.COMMENT in attrs.status and filename in files_updated_set - ]) + ) files_imports_changed: list[str] = [] for file_, attrs in (await async_load_files(args, files_updated_set, check_comments=False)).items(): import_diff = filenames[file_].imports.difference(attrs.imports) diff --git a/requirements.txt b/requirements.txt index 536723d..2d361c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -aiofiles==0.6.0 +aiofiles==0.7.0 autoflake==1.4 -isort==5.8.0 -pyupgrade==2.12.0 -reorder-python-imports==2.4.0 +isort==5.9.2 +pyupgrade==2.21.2 +reorder-python-imports==2.5.0 diff --git a/requirements_black.txt b/requirements_black.txt index 52ee1d9..afa3fbe 100644 --- a/requirements_black.txt +++ b/requirements_black.txt @@ -1 +1 @@ -black==20.8b1 +black==21.7b0 diff --git a/requirements_test.txt b/requirements_test.txt index aeb53d9..6e2f877 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,6 +1,7 @@ -r requirements_test_pre_commit.txt -mypy==0.812 -pre-commit==2.12.0 -pylint==2.7.4 -pytest==6.2.3 -pytest-asyncio==0.14.0 +mypy==0.910 +pre-commit==2.13.0 +pylint==2.9.3 +pytest==6.2.4 +pytest-asyncio==0.15.1 +types-aiofiles==0.1.7 diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 390af90..1c1ab32 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -1,3 +1,3 @@ -flake8==3.9.0 -isort==5.8.0 -pyupgrade==2.12.0 +flake8==3.9.2 +isort==5.9.2 +pyupgrade==2.21.2 diff --git a/setup.cfg b/setup.cfg index c691d5c..130744c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,10 +17,19 @@ classifier = Programming Language :: Python :: 3.9 Topic :: Software Development +[options] +packages = find: +python_requires = >=3.8,<3.10 + +[options.packages.find] +include = + python_typing_update* + +[options.entry_points] +console_scripts = + python-typing-update = python_typing_update.__main__:main + [flake8] -ignore = E203,E231,E701,W503,W504 -# E203,E231,E701 -> walrus -# W503/504 -> line-break-before/after-binary-operator max_line_length = 119 extend_exclude = .github, @@ -32,7 +41,7 @@ extend_exclude = testpaths = tests norecursedirs = fixtures console_output_style = count -log_level=NOTSET +log_level = NOTSET [tool:isort] # https://github.com/PyCQA/isort/wiki/isort-Settings diff --git a/setup.py b/setup.py index 3f756b8..578fd6a 100644 --- a/setup.py +++ b/setup.py @@ -15,15 +15,8 @@ def load_requirements_file(filename: str) -> list[str]: setup( version=version_str, - packages=['python_typing_update'], - python_requires='>=3.8, <3.10', install_requires=load_requirements_file('requirements.txt'), extras_require={ 'black': load_requirements_file('requirements_black.txt'), }, - entry_points={ - 'console_scripts': [ - 'python-typing-update = python_typing_update.__main__:main', - ], - }, )