From 6d6d277ea5dd0356edb39a8a7f3536a86ff36832 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 14 Aug 2020 15:27:22 -0400 Subject: [PATCH 1/5] fix: pre-commit check was broken --- .pre-commit-config.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 15c843f9..5d207281 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,8 +14,9 @@ repos: - id: end-of-file-fixer exclude: cibuildwheel/resources/pinned_docker_images.cfg - repo: https://github.com/pre-commit/mirrors-mypy - rev: '' # Use the sha / tag you want to point at + rev: v0.782 hooks: - id: mypy - files: cibuildwheel|test - exclude: cibuildwheel/resources + files: cibuildwheel/|test/ + entry: mypy + pass_filenames: false From 17c83ad78bda3991c90c9d0e98dcf3c1dbca7831 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 14 Aug 2020 15:46:07 -0400 Subject: [PATCH 2/5] ci: move formatting check to pre-commit + GitHub --- .circleci/config.yml | 17 ----------------- .github/workflows/test.yml | 8 ++++++++ 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index cf0e47b2..66777904 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,22 +1,6 @@ version: 2 jobs: - flake8-mypy: - docker: - - image: circleci/python:3.6 - steps: - - checkout - - - run: - name: Install flake8 & mypy - command: sudo python -m pip install flake8 mypy - - run: - name: flake8 - command: flake8 - - run: - name: mypy - command: mypy - osx-python3.6: macos: xcode: "9.4.1" @@ -54,6 +38,5 @@ workflows: version: 2 all-tests: jobs: - - flake8-mypy - osx-python3.6 - linux-python3.6 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 41c02da4..340a578f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,14 @@ on: - 'docs/**' jobs: + pre-commit: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: pre-commit/action@v2.0.0 + test: # skip branch builds on joerick/cibuildwheel, but always build `master` and pull requests if: github.repository != 'joerick/cibuildwheel' || github.ref == 'refs/heads/master' || github.event_name == 'pull_request' From 448d6538d785f7dfda15eed7356c2704ee1048ac Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 14 Aug 2020 15:28:09 -0400 Subject: [PATCH 3/5] chore: run pre-commit autoupdate --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d207281..df546622 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,13 +1,13 @@ repos: - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.1 + rev: 3.8.3 hooks: - id: flake8 pass_filenames: true # this seems to need to be here in addition to setup.cfg exclude: cibuildwheel/resources/ - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v3.2.0 hooks: - id: check-yaml - id: check-merge-conflict From 9df68df5259345ab9e323646235cc3d0204fcaf4 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 14 Aug 2020 16:12:24 -0400 Subject: [PATCH 4/5] style: add a few more checks --- .pre-commit-config.yaml | 45 +++++++++++++++++--------------- appveyor.yml | 6 ++--- cibuildwheel/docker_container.py | 5 ++-- docs/deliver-to-pypi.md | 4 +-- docs/extra.css | 2 +- docs/index.md | 4 +-- setup.cfg | 3 ++- 7 files changed, 37 insertions(+), 32 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df546622..a01336bf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,22 +1,25 @@ repos: -- repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.3 - hooks: - - id: flake8 - pass_filenames: true - # this seems to need to be here in addition to setup.cfg - exclude: cibuildwheel/resources/ -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 - hooks: - - id: check-yaml - - id: check-merge-conflict - - id: end-of-file-fixer - exclude: cibuildwheel/resources/pinned_docker_images.cfg -- repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.782 - hooks: - - id: mypy - files: cibuildwheel/|test/ - entry: mypy - pass_filenames: false +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.3 + hooks: + - id: flake8 + exclude: cibuildwheel/resources/ + additional_dependencies: [flake8-bugbear] + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: check-case-conflict + - id: check-merge-conflict + - id: check-yaml + - id: end-of-file-fixer + exclude: cibuildwheel/resources/pinned_docker_images.cfg + - id: mixed-line-ending + - id: trailing-whitespace + +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.782 + hooks: + - id: mypy + files: cibuildwheel/|test/ + pass_filenames: false diff --git a/appveyor.yml b/appveyor.yml index 401eeb11..5162f1b6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ environment: - # workaround an appveyor bug on macos + # workaround an appveyor bug on macos # see https://github.com/appveyor/ci/issues/3376#issuecomment-611314299 APPVEYOR_CONSOLE_DISABLE_PTY: true matrix: @@ -11,8 +11,8 @@ environment: APPVEYOR_JOB_NAME: "python37-x64-macos-mojave" # while pypy libffi dependency is failing the build, allow failures on macos -matrix: - allow_failures: +matrix: + allow_failures: - APPVEYOR_BUILD_WORKER_IMAGE: macos-mojave stack: python 3.7 diff --git a/cibuildwheel/docker_container.py b/cibuildwheel/docker_container.py index 8c3a608b..a58eb750 100644 --- a/cibuildwheel/docker_container.py +++ b/cibuildwheel/docker_container.py @@ -117,11 +117,12 @@ class DockerContainer: return [PurePath(p) for p in path_strs] - def call(self, args: Sequence[Union[str, PathLike]], env: Dict[str, str] = {}, + def call(self, args: Sequence[Union[str, PathLike]], env: Optional[Dict[str, str]] = None, capture_output=False, cwd: Optional[Union[str, PathLike]] = None) -> str: + chdir = f'cd {cwd}' if cwd else '' env_assignments = ' '.join(f'{shlex.quote(k)}={shlex.quote(v)}' - for k, v in env.items()) + for k, v in env.items()) if env is not None else '' command = ' '.join(shlex.quote(str(a)) for a in args) end_of_message = str(uuid.uuid4()) diff --git a/docs/deliver-to-pypi.md b/docs/deliver-to-pypi.md index 5c1fb2ee..a68ba928 100644 --- a/docs/deliver-to-pypi.md +++ b/docs/deliver-to-pypi.md @@ -9,14 +9,14 @@ After you've built your wheels, you'll probably want to deliver them to PyPI. On your development machine, do the following... ```bash -# Clear out your 'dist' folder. +# Clear out your 'dist' folder. rm -rf dist # Make a source distribution python setup.py sdist # 🏃🏻 # Go and download your wheel files from wherever you put them. e.g. your CI -# provider can be configured to store them for you. Put them all into the +# provider can be configured to store them for you. Put them all into the # 'dist' folder. # Upload using 'twine' (you may need to 'pip install twine') diff --git a/docs/extra.css b/docs/extra.css index 4a965b22..5da96b0b 100644 --- a/docs/extra.css +++ b/docs/extra.css @@ -59,7 +59,7 @@ h1, h2, h3, h4, h5, h6 { background-color: #eff1f3; font-size: 85%; font-weight: bold; - + border-top-left-radius: 3px; border-top-right-radius: 3px; diff --git a/docs/index.md b/docs/index.md index cfadd421..627209b0 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,9 +2,9 @@ title: Home --- -{% +{% includemarkdown "../README.md" - start="" + start="" end="" %} diff --git a/setup.cfg b/setup.cfg index e98764a2..8202be43 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,6 @@ [flake8] -ignore = E501,W503,E741,E226 +ignore = E501,W503,E741,E226,B950 +select = C,E,F,W,B,B9 application-import-names = cibuildwheel exclude = cibuildwheel/resources/, From a0d67a7a90df2d6d340a625c9b1ae04012d25ac4 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Sun, 16 Aug 2020 14:15:28 -0400 Subject: [PATCH 5/5] ci: suggestion from @joerick Co-authored-by: Joe Rickerby --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 340a578f..9e4eea1b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on: jobs: pre-commit: - name: Format + name: Pre-commit checks (mypy, flake8, etc.) runs-on: ubuntu-latest steps: - uses: actions/checkout@v2