From 388c65b49c3d80ad5dd718ab3068b74a0e9941a2 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Wed, 9 Oct 2019 17:48:14 +0300 Subject: [PATCH] Backport azure (#4159) --- .appveyor.yml | 16 +- .azure-pipelines/ci.yml | 22 +++ .azure-pipelines/deploy.yml | 148 +++++++++++++++++ .azure-pipelines/stage-lint.yml | 141 ++++++++++++++++ .azure-pipelines/stage-test.yml | 105 ++++++++++++ .travis.yml | 275 ++++++++++++++++---------------- Makefile | 27 ++-- aiohttp/__init__.py | 2 +- aiohttp/frozenlist.pyi | 2 +- requirements/ci-wheel.txt | 2 +- requirements/doc-spelling.txt | 1 + requirements/doc.txt | 2 +- requirements/lint.txt | 5 + setup.cfg | 4 +- setup.py | 15 +- 15 files changed, 601 insertions(+), 166 deletions(-) create mode 100644 .azure-pipelines/ci.yml create mode 100644 .azure-pipelines/deploy.yml create mode 100644 .azure-pipelines/stage-lint.yml create mode 100644 .azure-pipelines/stage-test.yml create mode 100644 requirements/lint.txt diff --git a/.appveyor.yml b/.appveyor.yml index 410cff2b6ca..d242ccb8c20 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -33,14 +33,14 @@ test_script: after_test: - "tools/build.cmd %PYTHON%\\python.exe -m codecov -f coverage.xml -X gcov" -artifacts: - - path: dist\* - -deploy_script: - - ps: >- - if($env:appveyor_repo_tag -eq 'True') { - Invoke-Expression "$env:PYTHON\\python.exe -m twine upload dist/* --username $env:PYPI_USER --password $env:PYPI_PASSWD --skip-existing" - } +# artifacts: +# - path: dist\* + +# deploy_script: +# - ps: >- +# if($env:appveyor_repo_tag -eq 'True') { +# Invoke-Expression "$env:PYTHON\\python.exe -m twine upload dist/* --username $env:PYPI_USER --password $env:PYPI_PASSWD --skip-existing" +# } #notifications: # - provider: Webhook diff --git a/.azure-pipelines/ci.yml b/.azure-pipelines/ci.yml new file mode 100644 index 00000000000..c0c6e7b4f99 --- /dev/null +++ b/.azure-pipelines/ci.yml @@ -0,0 +1,22 @@ +trigger: + batch: true + branches: + include: + - master + - ?.?* # matches to backport branches, e.g. 3.6 + exclude: + - refs/tags/* +pr: + autoCancel: true + branches: + include: + - master + +variables: +- group: codecov + +stages: +- template: stage-lint.yml +- template: stage-test.yml + parameters: + codecov.token: '$(codecov.token)' diff --git a/.azure-pipelines/deploy.yml b/.azure-pipelines/deploy.yml new file mode 100644 index 00000000000..7affbceb08e --- /dev/null +++ b/.azure-pipelines/deploy.yml @@ -0,0 +1,148 @@ +trigger: + branches: + include: + - refs/tags/* +pr: none + + +variables: +- group: codecov +- group: twine + + +resources: + containers: + - container: manylinux + image: quay.io/pypa/manylinux1_x86_64 + repositories: + - repository: templates + type: github + name: aio-libs/azure-pipelines + endpoint: aio-libs + +stages: +- template: stage-lint.yml + +- template: stage-test.yml + parameters: + codecov.token: '$(codecov.token)' + +- stage: build + displayName: 'Build' + + jobs: + - job: tarball + displayName: 'Tarball' + pool: + vmImage: 'ubuntu-latest' + + steps: + - template: templates/step-build.yml@templates + parameters: + steps: + - script: | + make cythonize + displayName: 'Cythonize' + - script: | + python setup.py sdist + displayName: 'Make tarball' + + - job: manylinux + displayName: 'Manylinux' + strategy: + matrix: + py35 x64: + python.code: 'cp35-cp35m' + manylinux: 'manylinux_64' + py36 x64: + python.code: 'cp36-cp36m' + manylinux: 'manylinux_64' + py37 x64: + python.code: 'cp37-cp37m' + manylinux: 'manylinux_64' + pool: + vmImage: 'ubuntu-latest' + container: manylinux + steps: + - checkout: self + submodules: true + clean: true + + - script: | + /opt/python/$(python.code)/bin/python -m venv .build-venv + displayName: 'Use Python $(python.code)' + + - script: | + source .build-venv/bin/activate + pip install -U setuptools wheel + displayName: 'Install tools' + + - script: | + source .build-venv/bin/activate + make cythonize + python setup.py bdist_wheel + displayName: 'Make wheel' + + - script: | + auditwheel repair dist/*.whl --wheel-dir wheelhouse/ + displayName: 'Repair wheel' + + - template: templates/step-store-dist.yml@templates + parameters: + folder: wheelhouse + + - job: + strategy: + matrix: + Win py35 x64: + python.version: '3.5' + python.architecture: 'x64' + image: 'windows-latest' + Win py36 x64: + python.version: '3.6' + python.architecture: 'x64' + image: 'windows-latest' + Win py37 x64: + python.version: '3.7' + python.architecture: 'x64' + image: 'windows-latest' + Win py35 x86: + python.version: '3.5' + python.architecture: 'x86' + image: 'windows-latest' + Win py36 x86: + python.version: '3.6' + python.architecture: 'x86' + image: 'windows-latest' + Win py37 x86: + python.version: '3.7' + python.architecture: 'x86' + image: 'windows-latest' + Mac py35: + python.version: '3.5' + image: 'macos-latest' + python.architecture: 'x64' + Mac py36: + python.version: '3.6' + image: 'macos-latest' + python.architecture: 'x64' + Mac py37: + python.version: '3.7' + image: 'macos-latest' + python.architecture: 'x64' + pool: + vmImage: '$(image)' + steps: + - template: templates/step-build.yml@templates + parameters: + python: '$(python.version)' + architecture: '$(python.architecture)' + steps: + - script: | + make cythonize + python setup.py bdist_wheel + displayName: 'Make wheel' + +- template: templates/stage-publish.yml@templates + parameters: + github: release-upload diff --git a/.azure-pipelines/stage-lint.yml b/.azure-pipelines/stage-lint.yml new file mode 100644 index 00000000000..b817c2ef7a5 --- /dev/null +++ b/.azure-pipelines/stage-lint.yml @@ -0,0 +1,141 @@ +stages: +- stage: lint + displayName: 'Run linters' + + jobs: + - job: 'flake8' + pool: + vmImage: 'ubuntu-latest' + + steps: + - checkout: self + submodules: true + clean: true + + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + architecture: 'x64' + + - script: | + pip install -r requirements/lint.txt + displayName: 'Install deps' + + - script: | + make flake8 + displayName: 'Run flake8' + + - job: 'isort' + pool: + vmImage: 'ubuntu-latest' + + steps: + - checkout: self + submodules: true + clean: true + + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + architecture: 'x64' + + - script: | + pip install -e . + displayName: 'Install itself' + env: + AIOHTTP_NO_EXTENSIONS: 1 + + - script: | + pip install -r requirements/lint.txt + displayName: 'Install deps' + + - script: | + make isort-check + displayName: 'Run isort checker' + + - job: 'mypy' + pool: + vmImage: 'ubuntu-latest' + + steps: + - checkout: self + submodules: true + clean: true + + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + architecture: 'x64' + + - script: | + pip install -r requirements/lint.txt + displayName: 'Install deps' + + - script: | + pip install -e . + displayName: 'Install itself' + env: + AIOHTTP_NO_EXTENSIONS: 1 + + - script: | + make mypy + displayName: 'Run black checker' + + - job: 'docs' + pool: + vmImage: 'ubuntu-latest' + + steps: + - checkout: self + submodules: true + clean: true + + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + architecture: 'x64' + + - script: | + apt install libenchant-dev + pip install -r requirements/doc-spelling.txt + displayName: 'Install deps' + + - script: | + make doc + displayName: 'Run docs checker' + env: + AIOHTTP_NO_EXTENSIONS: 1 + + - job: 'twine' + pool: + vmImage: 'ubuntu-latest' + + steps: + - checkout: self + submodules: true + clean: true + + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + architecture: 'x64' + + - script: | + pip install -U twine wheel + python setup.py sdist bdist_wheel + displayName: 'Install deps' + env: + AIOHTTP_NO_EXTENSIONS: 1 + + - script: | + twine check dist/* + displayName: 'Run twine checker' + + - job: 'contributors' + pool: + vmImage: 'ubuntu-latest' + + steps: + - script: | + LC_ALL=C sort -c CONTRIBUTORS.txt + displayName: 'Making sure that CONTRIBUTORS.txt remains sorted' diff --git a/.azure-pipelines/stage-test.yml b/.azure-pipelines/stage-test.yml new file mode 100644 index 00000000000..5dd48520041 --- /dev/null +++ b/.azure-pipelines/stage-test.yml @@ -0,0 +1,105 @@ +parameters: + codecov.token: '' + +stages: +- stage: test + displayName: 'Run tests' + + jobs: + - job: + strategy: + matrix: + Py35-Cython-Linux: + python.version: '3.5' + no_extensions: '' + image: 'ubuntu-latest' + Py36-Cython-Linux: + python.version: '3.6' + no_extensions: '' + image: 'ubuntu-latest' + Py37-Cython-Linux: + python.version: '3.7' + no_extensions: '' + image: 'ubuntu-latest' + Py35-Pure-Linux: + python.version: '3.5' + no_extensions: 'Y' + image: 'ubuntu-latest' + Py36-Pure-Linux: + python.version: '3.6' + no_extensions: 'Y' + image: 'ubuntu-latest' + Py37-Pure-Linux: + python.version: '3.7' + no_extensions: 'Y' + image: 'ubuntu-latest' +# PyPy3-Linux: +# python.version: 'pypy3' +# no_extensions: 'Y' +# image: 'ubuntu-latest' + # Py35-Cython-Win: + # python.version: '3.5' + # no_extensions: '' + # image: 'windows-latest' + # Py36-Cython-Win: + # python.version: '3.6' + # no_extensions: '' + # image: 'windows-latest' + # Py37-Cython-Win: + # python.version: '3.7' + # no_extensions: '' + # image: 'windows-latest' + Py35-Cython-Mac: + python.version: '3.5' + no_extensions: '' + image: 'macos-latest' + Py36-Cython-Mac: + python.version: '3.6' + no_extensions: '' + image: 'macos-latest' + Py37-Cython-Mac: + python.version: '3.7' + no_extensions: '' + image: 'macos-latest' + pool: + vmImage: '$(image)' + + timeoutInMinutes: 10 + + steps: + - checkout: self + clean: true + submodules: true + + - task: UsePythonVersion@0 + inputs: + versionSpec: '$(python.version)' + architecture: 'x64' + + - script: | + python -m pip install --upgrade pip setuptools + displayName: 'Update pip' + + - script: | + make cythonize + condition: eq(variables['no_extensions'], '') + displayName: 'Cythonize' + + - script: | + pip install -r requirements/dev.txt + displayName: 'Install dependencies' + env: + AIOHTTP_NO_EXTENSIONS: '$(no_extensions)' + + - script: | + pytest tests -vv + python -m coverage xml + displayName: 'pytest' + + - script: | + pip install codecov + python -m codecov -f coverage.xml -X gcov + displayName: 'Upload coverage reports' + condition: ne(variables['codecov.token'], '') + env: + CODECOV_TOKEN: '$(codecov.token)' diff --git a/.travis.yml b/.travis.yml index bab4e3779c5..f9372e4eb67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -158,67 +158,67 @@ _helpers: - $HOME/Library/Caches/Homebrew - $PYTHON_INSTALLER_DIR_PATH - $GIT_INSTALLER_DIR_PATH -- &generic_deploy_base - stage: &deploy_stage_name deploy (PYPI upload itself runs only for tagged commits) - <<: *_mainstream_python_base - deploy: &deploy_step - provider: pypi - # `skip_cleanup: true` is required to preserve binary wheels, built - # inside of manylinux1 docker container during `script` step above. - skip_cleanup: true - # `skip-existing: true` is required to skip uploading dists, already - # present in PYPI instead of failing the whole process. - # This happens when other CI (AppVeyor etc.) has already uploaded - # the very same dist (usually sdist). - skip-existing: true - user: __token__ - password: - # Encrypted with `travis encrypt -r aio-libs/aiohttp --api-endpoint 'https://api.travis-ci.com/'`: - secure: >- - LC+sJojSdf4KhjHc/loszfAQmUM/VNHJarmC3sY9Dfa3qUS+2bnXxQmLK+lNw6mlAaoTaz7Y4MQDggAH1pBkP5jKjQrUjArjCNSYIubmfjhFqRYGa1xFrBjEJYjYNEfFzjPx+TUX2+qHKaZ8qp7nxFaPHG4JKuUHZQk7F7J/zs3VufWnYmc+QhOGbWFfcWZwpFly46HNrX78/6Plr84Gsz0Hws3K3GHkyXusX9axlByUpe9VZ+nVcANF6PGzqFwipXEWAe31vYO4MnYuZRotQiWVsaHDb9Ki+OyHVJJ02xp4ooofBsYhgZ8axtWKu8639xtTlOagecjKBenhipOQc6OrVWigyYfARVUDY5bBWQlyyOKh5TJkrTScLf5P6MKQ+Pgj3hkzyDELusgxd7Jkb/CN3GraX7U0808x5TiOcm7/3BO+eR3+mP54n6qAyHB+ckOQzWRHMeGPjOy2eIR3VkVcFzJCpIJwtArjWVzO5KFBzPYdxgz2IVBhZRyg66AlQ+GHFp2sI6rZXOqQnJWZOL+RZe/xqircgwUQQm2MGjwW05K5WT2WEwuGkmRnFwSdcKv+PSrmCIyXoy3neo9u9rPbrwBfBIbPj3MmE51edUy2rS/qw7jLUG683RNXcx/LTXAtd7SZgaWVHnvyukBPi5akyGeV0Pd00Th3tkqYBto= - # Although Travis CI instructs `setup.py` to build source distribution, - # which is default value for distribution option (`distribution: sdist`), - # it will also upload all wheels we've previously built in manylinux1 - # docker container using `twine upload -r pypi dist/*` command. - # Also since commit https://github.com/travis-ci/dpl/commit/90b5e39 - # it is default that Travis PYPI provider has `skip_upload_docs: true` - # set by default. - # Besides above, we don't do cleanup of `dist/*`, because it's being done - # by Travis CI PYPI deployment provider after upload, unconditionally. - on: - tags: true - all_branches: true -- &osx_pypi_deploy_base_1011 - <<: *osx_python_base - <<: *generic_deploy_base - name: &env_os1011_msg Build and deploy to PYPI of OS X 10.11 binary wheel - osx_image: xcode7.3 - script: skip - after_success: [] - python: *py37 - env: - <<: *env_osx_base - PYTHON_VERSION: *py37 - deploy: - <<: *deploy_step - skip_cleanup: false - distributions: bdist_wheel -- &osx_pypi_deploy_base_1012 - <<: *osx_pypi_deploy_base_1011 - name: &env_os1012_msg Build and deploy to PYPI of OS X 10.12 binary wheel - osx_image: xcode8.1 - python: *py37 - env: - <<: *env_osx_base - PYTHON_VERSION: *py37 -- &osx_pypi_deploy_base_1010 - <<: *osx_pypi_deploy_base_1011 - name: &env_os1010_msg Build and deploy to PYPI of OS X 10.10 binary wheel - osx_image: xcode6.4 - python: *py37 - env: - <<: *env_osx_base - PYTHON_VERSION: *py37 +# - &generic_deploy_base +# stage: &deploy_stage_name deploy (PYPI upload itself runs only for tagged commits) +# <<: *_mainstream_python_base +# deploy: &deploy_step +# provider: pypi +# # `skip_cleanup: true` is required to preserve binary wheels, built +# # inside of manylinux1 docker container during `script` step above. +# skip_cleanup: true +# # `skip-existing: true` is required to skip uploading dists, already +# # present in PYPI instead of failing the whole process. +# # This happens when other CI (AppVeyor etc.) has already uploaded +# # the very same dist (usually sdist). +# skip-existing: true +# user: __token__ +# password: +# # Encrypted with `travis encrypt -r aio-libs/aiohttp --api-endpoint 'https://api.travis-ci.com/'`: +# secure: >- +# LC+sJojSdf4KhjHc/loszfAQmUM/VNHJarmC3sY9Dfa3qUS+2bnXxQmLK+lNw6mlAaoTaz7Y4MQDggAH1pBkP5jKjQrUjArjCNSYIubmfjhFqRYGa1xFrBjEJYjYNEfFzjPx+TUX2+qHKaZ8qp7nxFaPHG4JKuUHZQk7F7J/zs3VufWnYmc+QhOGbWFfcWZwpFly46HNrX78/6Plr84Gsz0Hws3K3GHkyXusX9axlByUpe9VZ+nVcANF6PGzqFwipXEWAe31vYO4MnYuZRotQiWVsaHDb9Ki+OyHVJJ02xp4ooofBsYhgZ8axtWKu8639xtTlOagecjKBenhipOQc6OrVWigyYfARVUDY5bBWQlyyOKh5TJkrTScLf5P6MKQ+Pgj3hkzyDELusgxd7Jkb/CN3GraX7U0808x5TiOcm7/3BO+eR3+mP54n6qAyHB+ckOQzWRHMeGPjOy2eIR3VkVcFzJCpIJwtArjWVzO5KFBzPYdxgz2IVBhZRyg66AlQ+GHFp2sI6rZXOqQnJWZOL+RZe/xqircgwUQQm2MGjwW05K5WT2WEwuGkmRnFwSdcKv+PSrmCIyXoy3neo9u9rPbrwBfBIbPj3MmE51edUy2rS/qw7jLUG683RNXcx/LTXAtd7SZgaWVHnvyukBPi5akyGeV0Pd00Th3tkqYBto= +# # Although Travis CI instructs `setup.py` to build source distribution, +# # which is default value for distribution option (`distribution: sdist`), +# # it will also upload all wheels we've previously built in manylinux1 +# # docker container using `twine upload -r pypi dist/*` command. +# # Also since commit https://github.com/travis-ci/dpl/commit/90b5e39 +# # it is default that Travis PYPI provider has `skip_upload_docs: true` +# # set by default. +# # Besides above, we don't do cleanup of `dist/*`, because it's being done +# # by Travis CI PYPI deployment provider after upload, unconditionally. +# on: +# tags: true +# all_branches: true +# - &osx_pypi_deploy_base_1011 +# <<: *osx_python_base +# <<: *generic_deploy_base +# name: &env_os1011_msg Build and deploy to PYPI of OS X 10.11 binary wheel +# osx_image: xcode7.3 +# script: skip +# after_success: [] +# python: *py37 +# env: +# <<: *env_osx_base +# PYTHON_VERSION: *py37 +# deploy: +# <<: *deploy_step +# skip_cleanup: false +# distributions: bdist_wheel +# - &osx_pypi_deploy_base_1012 +# <<: *osx_pypi_deploy_base_1011 +# name: &env_os1012_msg Build and deploy to PYPI of OS X 10.12 binary wheel +# osx_image: xcode8.1 +# python: *py37 +# env: +# <<: *env_osx_base +# PYTHON_VERSION: *py37 +# - &osx_pypi_deploy_base_1010 +# <<: *osx_pypi_deploy_base_1011 +# name: &env_os1010_msg Build and deploy to PYPI of OS X 10.10 binary wheel +# osx_image: xcode6.4 +# python: *py37 +# env: +# <<: *env_osx_base +# PYTHON_VERSION: *py37 os: linux @@ -226,6 +226,7 @@ jobs: fast_finish: true allow_failures: - python: nightly + - python: pypy3.5 include: - name: 3.7 without extensions @@ -300,83 +301,83 @@ jobs: PYTHON_VERSION: *py37 # pypy3.5-5.10.0 fails under OS X because it's unsupported - # Build and deploy manylinux1 binary wheels and source distribution - - <<: *generic_deploy_base - <<: *_reset_steps - env: Build and deploy to PYPI of manylinux1 binary wheels for all supported Pythons and source distribution= - services: - - docker - script: - - pip install -r requirements/cython.txt - - make cythonize - - ./tools/run_docker.sh "aiohttp" - deploy: - <<: *deploy_step + # # Build and deploy manylinux1 binary wheels and source distribution + # - <<: *generic_deploy_base + # <<: *_reset_steps + # env: Build and deploy to PYPI of manylinux1 binary wheels for all supported Pythons and source distribution= + # services: + # - docker + # script: + # - pip install -r requirements/cython.txt + # - make cythonize + # - ./tools/run_docker.sh "aiohttp" + # deploy: + # <<: *deploy_step - # Build and deploy MacOS binary wheels for each OSX+Python combo possible - # OS X 10.10, Python 3.5 - - <<: *osx_pypi_deploy_base_1010 - name: *env_os1010_msg - python: *py35 - env: - <<: *env_osx_base - PYTHON_VERSION: *py35 - # OS X 10.10, Python 3.6 - - <<: *osx_pypi_deploy_base_1010 - name: *env_os1010_msg - python: *py36 - env: - <<: *env_osx_base - PYTHON_VERSION: *py36 - # OS X 10.10, Python 3.7 - - <<: *osx_pypi_deploy_base_1010 - name: *env_os1010_msg - python: *py37 - env: - <<: *env_osx_base - PYTHON_VERSION: *py37 - # OS X 10.11, Python 3.5 - - <<: *osx_pypi_deploy_base_1011 - name: *env_os1011_msg - python: *py35 - env: - <<: *env_osx_base - PYTHON_VERSION: *py35 - # OS X 10.11, Python 3.6 - - <<: *osx_pypi_deploy_base_1011 - name: *env_os1011_msg - python: *py36 - env: - <<: *env_osx_base - PYTHON_VERSION: *py36 - # OS X 10.11, Python 3.7 - - <<: *osx_pypi_deploy_base_1011 - name: *env_os1011_msg - python: *py37 - env: - <<: *env_osx_base - PYTHON_VERSION: *py37 - # OS X 10.12, Python 3.5 - - <<: *osx_pypi_deploy_base_1012 - name: *env_os1012_msg - python: *py35 - env: - <<: *env_osx_base - PYTHON_VERSION: *py35 - # OS X 10.12, Python 3.6 - - <<: *osx_pypi_deploy_base_1012 - name: *env_os1012_msg - python: *py36 - env: - <<: *env_osx_base - PYTHON_VERSION: *py36 - # OS X 10.12, Python 3.7 - - <<: *osx_pypi_deploy_base_1012 - name: *env_os1012_msg - python: *py37 - env: - <<: *env_osx_base - PYTHON_VERSION: *py37 + # # Build and deploy MacOS binary wheels for each OSX+Python combo possible + # # OS X 10.10, Python 3.5 + # - <<: *osx_pypi_deploy_base_1010 + # name: *env_os1010_msg + # python: *py35 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py35 + # # OS X 10.10, Python 3.6 + # - <<: *osx_pypi_deploy_base_1010 + # name: *env_os1010_msg + # python: *py36 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py36 + # # OS X 10.10, Python 3.7 + # - <<: *osx_pypi_deploy_base_1010 + # name: *env_os1010_msg + # python: *py37 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py37 + # # OS X 10.11, Python 3.5 + # - <<: *osx_pypi_deploy_base_1011 + # name: *env_os1011_msg + # python: *py35 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py35 + # # OS X 10.11, Python 3.6 + # - <<: *osx_pypi_deploy_base_1011 + # name: *env_os1011_msg + # python: *py36 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py36 + # # OS X 10.11, Python 3.7 + # - <<: *osx_pypi_deploy_base_1011 + # name: *env_os1011_msg + # python: *py37 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py37 + # # OS X 10.12, Python 3.5 + # - <<: *osx_pypi_deploy_base_1012 + # name: *env_os1012_msg + # python: *py35 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py35 + # # OS X 10.12, Python 3.6 + # - <<: *osx_pypi_deploy_base_1012 + # name: *env_os1012_msg + # python: *py36 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py36 + # # OS X 10.12, Python 3.7 + # - <<: *osx_pypi_deploy_base_1012 + # name: *env_os1012_msg + # python: *py37 + # env: + # <<: *env_osx_base + # PYTHON_VERSION: *py37 stages: - *doc_stage_name diff --git a/Makefile b/Makefile index 53b69b2c76a..c8339c4f081 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # Some simple testing tasks (sorry, UNIX only). PYXS = $(wildcard aiohttp/*.pyx) +SRC = aiohttp examples tests setup.py all: test @@ -17,10 +18,9 @@ cythonize: .install-cython $(PYXS:.pyx=.c) pip install -r requirements/dev.txt @touch .install-deps + isort: - isort -rc aiohttp - isort -rc tests - isort -rc examples + isort -rc $(SRC) flake: .flake @@ -39,14 +39,23 @@ flake: .flake fi @touch .flake -check_changes: - ./tools/check_changes.py + +flake8: + flake8 $(SRC) mypy: .flake - if python -c "import sys; sys.exit(sys.implementation.name!='cpython')"; then \ - mypy aiohttp; \ + mypy aiohttp + +isort-check: + @if ! isort -rc --check-only $(SRC); then \ + echo "Import sort errors, run 'make isort' to fix them!!!"; \ + isort --diff -rc $(SRC); \ + false; \ fi +check_changes: + ./tools/check_changes.py + .develop: .install-deps $(shell find aiohttp -type f) .flake check_changes mypy # pip install -e . @touch .develop @@ -120,7 +129,7 @@ doc-spelling: @make -C docs spelling SPHINXOPTS="-W -E" install: - @pip install -U pip + @pip install -U 'pip' @pip install -Ur requirements/dev.txt -.PHONY: all build flake test vtest cov clean doc +.PHONY: all build flake test vtest cov clean doc mypy diff --git a/aiohttp/__init__.py b/aiohttp/__init__.py index c9e002812eb..9474ce3a01a 100644 --- a/aiohttp/__init__.py +++ b/aiohttp/__init__.py @@ -1,4 +1,4 @@ -__version__ = '3.6.1' +__version__ = '3.6.2a0' from typing import Tuple # noqa diff --git a/aiohttp/frozenlist.pyi b/aiohttp/frozenlist.pyi index 65913a5f50d..81ca25cd471 100644 --- a/aiohttp/frozenlist.pyi +++ b/aiohttp/frozenlist.pyi @@ -16,7 +16,7 @@ _Arg = Union[List[_T], Iterable[_T]] class FrozenList(MutableSequence[_T], Generic[_T]): - def __init__(self, items: Optional[_Arg[_T]]=None) -> None: ... + def __init__(self, items: Optional[_Arg[_T]]=...) -> None: ... @property def frozen(self) -> bool: ... diff --git a/requirements/ci-wheel.txt b/requirements/ci-wheel.txt index 074a459eb21..cc353a7468b 100644 --- a/requirements/ci-wheel.txt +++ b/requirements/ci-wheel.txt @@ -22,4 +22,4 @@ aiodns==2.0.0; platform_system!="Windows" # required c-ares will not build on w codecov==2.0.15 uvloop==0.12.1; platform_system!="Windows" and implementation_name=="cpython" and python_version<"3.7" # MagicStack/uvloop#14 idna-ssl==1.1.0; python_version<"3.7" -typing_extensions==3.7.2; python_version<"3.7" +typing_extensions==3.7.4; python_version<"3.7" diff --git a/requirements/doc-spelling.txt b/requirements/doc-spelling.txt index f29d9fc4ff7..36bd32de0af 100644 --- a/requirements/doc-spelling.txt +++ b/requirements/doc-spelling.txt @@ -1 +1,2 @@ +-r doc.txt sphinxcontrib-spelling==4.3.0; platform_system!="Windows" # We only use it in Travis CI diff --git a/requirements/doc.txt b/requirements/doc.txt index b548175c1bf..1fb8b9c2a57 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -1,5 +1,5 @@ sphinx==2.2.0 sphinxcontrib-asyncio==0.2.0 -pygments>=2.1 +pygments==2.4.2 aiohttp-theme==0.1.5 sphinxcontrib-blockdiag==1.5.5 diff --git a/requirements/lint.txt b/requirements/lint.txt new file mode 100644 index 00000000000..5abb13712fc --- /dev/null +++ b/requirements/lint.txt @@ -0,0 +1,5 @@ +mypy==0.730; implementation_name=="cpython" +flake8==3.7.8 +flake8-pyi==19.3.0; python_version >= "3.6" +black==19.3b0; python_version >= "3.6" +isort==4.3.21 diff --git a/setup.cfg b/setup.cfg index f7b55b1c23a..d8357499e80 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,7 @@ max-line-length=79 zip_ok = false [flake8] -ignore = N801,N802,N803,E226,W504,E252 +ignore = N801,N802,N803,E226,W504,E252,E301,E302,E704,W503,W504,F811 max-line-length=79 [isort] @@ -20,7 +20,7 @@ include_trailing_comma=True force_grid_wrap=0 use_parentheses=True -known_third_party=jinja2 +known_third_party=jinja2,pytest,multidict,yarl,gunicorn,freezegun,async_generator known_first_party=aiohttp,aiohttp_jinja2,aiopg [report] diff --git a/setup.py b/setup.py index ac6457af823..8039b517846 100644 --- a/setup.py +++ b/setup.py @@ -1,21 +1,25 @@ -import codecs import pathlib import re import sys from distutils.command.build_ext import build_ext -from distutils.errors import (CCompilerError, DistutilsExecError, - DistutilsPlatformError) +from distutils.errors import ( + CCompilerError, + DistutilsExecError, + DistutilsPlatformError, +) from setuptools import Extension, setup - if sys.version_info < (3, 5, 3): raise RuntimeError("aiohttp 3.x requires Python 3.5.3+") here = pathlib.Path(__file__).parent -if (here / '.git').exists() and not (here / 'vendor/http-parser/README.md').exists(): +if ( + (here / '.git').exists() and + not (here / 'vendor/http-parser/README.md').exists() +): print("Install submodules when building from git clone", file=sys.stderr) print("Hint:", file=sys.stderr) print(" git submodule update --init", file=sys.stderr) @@ -60,7 +64,6 @@ def build_extension(self, ext): raise BuildFailed() - txt = (here / 'aiohttp' / '__init__.py').read_text('utf-8') try: version = re.findall(r"^__version__ = '([^']+)'\r?$",