From 345325b919455d9fcef00d838bb61221d8f18c1a Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Thu, 25 Aug 2022 08:32:06 -0700 Subject: [PATCH 1/2] Update precommit hooks --- .flake8 | 2 +- .pre-commit-config.yaml | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.flake8 b/.flake8 index 217a665..4994bd6 100644 --- a/.flake8 +++ b/.flake8 @@ -11,6 +11,6 @@ # for error classes selected below. [flake8] -max-line-length = 80 +max-line-length = 88 select = C,E,F,W,B,B950 ignore = E501, W503 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 29ef555..1f928ea 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,17 +3,24 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.3.0 hooks: - - id: check-yaml - - id: end-of-file-fixer - id: trailing-whitespace + - id: end-of-file-fixer + - id: debug-statements + - id: check-ast + - id: mixed-line-ending + - id: check-yaml + args: [--allow-multiple-documents] + - id: check-json + - id: check-toml + - id: check-added-large-files - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 22.6.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 5.0.4 hooks: - id: flake8 pass_filenames: true @@ -21,3 +28,14 @@ repos: rev: 5.10.1 hooks: - id: isort + - repo: https://github.com/asottile/pyupgrade + rev: v2.37.3 + hooks: + - id: pyupgrade + args: [--py38-plus] + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v2.7.1 + hooks: + - id: prettier + files: \.(html|md|yml|yaml) + args: [--prose-wrap=preserve] From c25244de5c97ce48ff379027be5417df21fac941 Mon Sep 17 00:00:00 2001 From: Jarrod Millman Date: Thu, 25 Aug 2022 08:53:50 -0700 Subject: [PATCH 2/2] Fix linting --- .github/workflows/release.yml | 6 ++--- .github/workflows/test.yml | 42 +++++++++++++++++------------------ README.md | 4 ++-- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 49fbeaa..2e42932 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - '*.*' + - "*.*" jobs: release: @@ -14,8 +14,8 @@ jobs: - name: Setup Python 3.10 uses: actions/setup-python@v2 with: - python-version: '3.10' - architecture: 'x64' + python-version: "3.10" + architecture: "x64" - name: Install flit run: pip install flit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ee60845..4075800 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,28 +11,28 @@ jobs: python-version: ["3.10"] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} - - uses: actions/cache@v2 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - restore-keys: | - ${{ runner.os }}-pip- + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} + restore-keys: | + ${{ runner.os }}-pip- - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ".[test]" - pip install ".[lint]" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ".[test]" + pip install ".[lint]" - - name: Lint - run: pre-commit run --all-files --show-diff-on-failure --color always + - name: Lint + run: pre-commit run --all-files --show-diff-on-failure --color always - - name: Test - run: | - PYTHONPATH=. pytest + - name: Test + run: | + PYTHONPATH=. pytest diff --git a/README.md b/README.md index 142309e..9e9b335 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ the imports. However, if used with the above pattern, this results in code duplication, as you now need to declare your submodules and attributes in two places. You can infer the `submodules` and `submod_attrs` arguments (explicitly provided -above to `lazy.attach`) from a stub adjacent to the `.py` file by using the +above to `lazy.attach`) from a stub adjacent to the `.py` file by using the `lazy.attach_stub` function. Carrying on with the example above: @@ -110,7 +110,7 @@ to include `*.pyi` files. ### Early failure With lazy loading, missing imports no longer fail upon loading the -library. During development and testing, you can set the `EAGER_IMPORT` +library. During development and testing, you can set the `EAGER_IMPORT` environment variable to disable lazy loading. ### External libraries