diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8773c9677..e35b1c74e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ on: - ?.?* schedule: - cron: '0 6 * * *' # Daily 6AM UTC build - + jobs: @@ -68,7 +68,7 @@ jobs: needs: lint strategy: matrix: - pyver: [3.6, 3.7, 3.8, 3.9] + pyver: [3.6, 3.7, 3.8, 3.9, 3.10.0-rc.2] no-extensions: ['', 'Y'] os: [ubuntu, macos, windows] exclude: @@ -102,12 +102,12 @@ jobs: restore-keys: | pip-ci-${{ runner.os }}-${{ matrix.pyver }}-{{ matrix.no-extensions }}- - name: Install cython - if: ${{ matrix.no-extensions == '' }} + if: ${{ matrix.no-extensions == '' }} uses: py-actions/py-dependency-install@v2 with: path: requirements/cython.txt - name: Cythonize - if: ${{ matrix.no-extensions == '' }} + if: ${{ matrix.no-extensions == '' }} run: | make cythonize - name: Install dependencies @@ -148,11 +148,9 @@ jobs: needs: pre-deploy steps: - name: Checkout - uses: actions/checkout@v2 - - name: Setup Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 + uses: actions/checkout@v2.3.4 + - name: Setup Python + uses: actions/setup-python@v2.2.2 - name: Install cython uses: py-actions/py-dependency-install@v2 with: @@ -169,119 +167,76 @@ jobs: name: dist path: dist - build-linux: - name: Linux + build-wheels: + name: Build wheels on ${{ matrix.os }} ${{ matrix.qemu }} + runs-on: ${{ matrix.os }}-latest + needs: pre-deploy strategy: matrix: - pyver: [cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39] - arch: [x86_64, aarch64, i686, ppc64le, s390x] - fail-fast: false - runs-on: ubuntu-latest - env: - py: /opt/python/${{ matrix.pyver }}/bin/python - img: quay.io/pypa/manylinux2014_${{ matrix.arch }} - needs: pre-deploy + os: [ubuntu, windows, macos] + qemu: [''] + include: + # Split ubuntu job for the sake of speed-up + - os: ubuntu + qemu: aarch64 + - os: ubuntu + qemu: ppc64le + - os: ubuntu + qemu: s390x steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v2.3.4 - name: Set up QEMU - id: qemu + if: ${{ matrix.qemu }} uses: docker/setup-qemu-action@v1 - - name: Available platforms - run: echo ${{ steps.qemu.outputs.platforms }} - - name: Setup Python 3.8 - uses: actions/setup-python@v2 with: - python-version: 3.8 - - name: Install cython - if: ${{ matrix.no-extensions == '' }} - uses: py-actions/py-dependency-install@v2 - with: - path: requirements/cython.txt - - name: Cythonize - if: ${{ matrix.no-extensions == '' }} - run: | - make cythonize - - name: Install tools - run: | - docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ - ${{ env.img }} ${{ env.py }} -m pip install -U setuptools wheel - - name: Make wheel - run: | - docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ - ${{ env.img }} ${{ env.py }} setup.py bdist_wheel - - name: Repair wheel wheel - run: | - docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \ - ${{ env.img }} auditwheel repair dist/*.whl --wheel-dir wheelhouse/ - - name: Upload artifacts - uses: actions/upload-artifact@v2 - with: - name: dist - path: wheelhouse/* - - build-binary: - name: Binary wheels - strategy: - matrix: - pyver: [3.6, 3.7, 3.8, 3.9] - os: [macos, windows] - arch: [x86, x64] - exclude: - - os: macos - arch: x86 - fail-fast: false - runs-on: ${{ matrix.os }}-latest - needs: pre-deploy - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.pyver }} - architecture: ${{ matrix.arch }} + platforms: all + id: qemu + - name: Prepare emulation + run: | + if [[ -n "${{ matrix.qemu }}" ]]; then + # Build emulated architectures only if QEMU is set, + # use default "auto" otherwise + echo "CIBW_ARCHS_LINUX=${{ matrix.qemu }}" >> $GITHUB_ENV + fi + shell: bash + - name: Setup Python + uses: actions/setup-python@v2.2.2 - name: Install cython - if: ${{ matrix.no-extensions == '' }} uses: py-actions/py-dependency-install@v2 with: path: requirements/cython.txt - name: Cythonize - if: ${{ matrix.no-extensions == '' }} run: | make cythonize - - name: Install dependencies - run: | - python -m pip install -U setuptools wheel - - name: Make wheel - run: - python setup.py bdist_wheel - - name: Upload artifacts - uses: actions/upload-artifact@v2 + - name: Build wheels + uses: pypa/cibuildwheel@v2.2.0a1 + env: + CIBW_ARCHS_MACOS: x86_64 arm64 universal2 + - uses: actions/upload-artifact@v2 with: name: dist - path: dist + path: ./wheelhouse/*.whl deploy: name: Deploy - needs: [build-linux, build-binary, build-tarball] + environment: release + needs: [build-tarball, build-wheels] runs-on: ubuntu-latest steps: - - name: Setup Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: 3.8 - - name: Install twine - run: | - python -m pip install twine - - name: Download dists - uses: actions/download-artifact@v2 - with: - name: dist - path: dist - - name: PyPI upload - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - twine upload dist/* + - name: Checkout + uses: actions/checkout@v2.3.4 + - name: Login + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token + - name: Make Release + uses: aio-libs/create-release@v1.2.1 + with: + changes_file: CHANGES.rst + name: yarl + version_file: yarl/__init__.py + github_token: ${{ secrets.GITHUB_TOKEN }} + pypi_token: ${{ secrets.PYPI_API_TOKEN }} + artifact: dist + fix_issue_regex: "`#(\\d+) `" + fix_issue_repl: "(#\\1)" diff --git a/CHANGES/.TEMPLATE.rst b/CHANGES/.TEMPLATE.rst deleted file mode 100644 index bc6016baf..000000000 --- a/CHANGES/.TEMPLATE.rst +++ /dev/null @@ -1,36 +0,0 @@ -{# TOWNCRIER TEMPLATE #} -{% for section, _ in sections.items() %} -{% set underline = underlines[0] %}{% if section %}{{section}} -{{ underline * section|length }}{% set underline = underlines[1] %} - -{% endif %} - -{% if sections[section] %} -{% for category, val in definitions.items() if category in sections[section]%} -{{ definitions[category]['name'] }} -{{ underline * definitions[category]['name']|length }} - -{% if definitions[category]['showcontent'] %} -{% for text, values in sections[section][category].items() %} -- {{ text }} - {{ values|join(',\n ') }} -{% endfor %} - -{% else %} -- {{ sections[section][category]['']|join(', ') }} - -{% endif %} -{% if sections[section][category]|length == 0 %} -No significant changes. - -{% else %} -{% endif %} - -{% endfor %} -{% else %} -No significant changes. - - -{% endif %} -{% endfor %} ----- diff --git a/CHANGES/622.feature.1.rst b/CHANGES/622.feature.1.rst new file mode 100644 index 000000000..899207223 --- /dev/null +++ b/CHANGES/622.feature.1.rst @@ -0,0 +1 @@ +Added support for Python 3.10. diff --git a/CHANGES/622.feature.2.rst b/CHANGES/622.feature.2.rst new file mode 100644 index 000000000..f29e90790 --- /dev/null +++ b/CHANGES/622.feature.2.rst @@ -0,0 +1 @@ +Started shipping platform-specific wheels with the ``musl`` tag targeting typical Alpine Linux runtimes. diff --git a/CHANGES/622.feature.3.rst b/CHANGES/622.feature.3.rst new file mode 100644 index 000000000..6652d85ce --- /dev/null +++ b/CHANGES/622.feature.3.rst @@ -0,0 +1 @@ +Started shipping platform-specific arm64 wheels for Apple Silicon. diff --git a/CHANGES/README.rst b/CHANGES/README.rst new file mode 100644 index 000000000..4165e47d4 --- /dev/null +++ b/CHANGES/README.rst @@ -0,0 +1,86 @@ +.. _Adding change notes with your PRs: + +Adding change notes with your PRs +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +It is very important to maintain a log for news of how +updating to the new version of the software will affect +end-users. This is why we enforce collection of the change +fragment files in pull requests as per `Towncrier philosophy`_. + +The idea is that when somebody makes a change, they must record +the bits that would affect end-users only including information +that would be useful to them. Then, when the maintainers publish +a new release, they'll automatically use these records to compose +a change log for the respective version. It is important to +understand that including unnecessary low-level implementation +related details generates noise that is not particularly useful +to the end-users most of the time. And so such details should be +recorded in the Git history rather than a changelog. + +Alright! So how to add a news fragment? +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +``yarl`` uses `towncrier `_ +for changelog management. +To submit a change note about your PR, add a text file into the +``CHANGES/`` folder. It should contain an +explanation of what applying this PR will change in the way +end-users interact with the project. One sentence is usually +enough but feel free to add as many details as you feel necessary +for the users to understand what it means. + +**Use the past tense** for the text in your fragment because, +combined with others, it will be a part of the "news digest" +telling the readers **what changed** in a specific version of +the library *since the previous version*. You should also use +reStructuredText syntax for highlighting code (inline or block), +linking parts of the docs or external sites. + +Finally, name your file following the convention that Towncrier +understands: it should start with the number of an issue or a +PR followed by a dot, then add a patch type, like ``feature``, +``doc``, ``misc`` etc., and add ``.rst`` as a suffix. If you +need to add more than one fragment, you may add an optional +sequence number (delimited with another period) between the type +and the suffix. + +In general the name will follow ``..rst`` pattern, +where the categories are: + +- ``feature``: Any new feature +- ``bugfix``: A bug fix +- ``doc``: A change to the documentation +- ``misc``: Changes internal to the repo like CI, test and build changes +- ``removal``: For deprecations and removals of an existing feature or behavior + +A pull request may have more than one of these components, for example +a code change may introduce a new feature that deprecates an old +feature, in which case two fragments should be added. It is not +necessary to make a separate documentation fragment for documentation +changes accompanying the relevant code changes. + +Examples for adding changelog entries to your Pull Requests +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +File :file:`CHANGES/603.removal.1.rst`: + +.. code-block:: rst + + Droped Python 3.5 support; Python 3.6 is the minimal supported Python version. + +File :file:`CHANGES/550.bugfix.rst`: + +.. code-block:: rst + + Started shipping Windows wheels for the x86 architecture. + +File :file:`CHANGES/553.feature.rst`: + +.. code-block:: rst + + Added support for ``GenericAliases`` (``MultiDict[str]``) under Python 3.9 and higher. + + +.. _Towncrier philosophy: + https://towncrier.readthedocs.io/en/actual-freaking-docs/#philosophy diff --git a/LICENSE b/LICENSE index cc5cfd679..0099356cf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION @@ -92,33 +92,33 @@ meet the following conditions: (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and + Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and + stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2016-2018, Andrew Svetlov and aio-libs team + Copyright 2016-2021, Andrew Svetlov and aio-libs team Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/pyproject.toml b/pyproject.toml index 3cd69a29d..e62ec3f59 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,16 @@ +[build-system] +requires = ["setuptools>=40", "wheel"] + [tool.towncrier] package = "yarl" filename = "CHANGES.rst" directory = "CHANGES/" title_format = "{version} ({project_date})" -template = "CHANGES/.TEMPLATE.rst" issue_format = "`#{issue} `_" + + +[tool.cibuildwheel] +test-requires = "-r requirements/ci.txt" +test-command = "pytest {project}/tests" +# don't build PyPy wheels, install from source instead +skip = "pp*" \ No newline at end of file diff --git a/setup.py b/setup.py index 813efc494..b39fd364b 100644 --- a/setup.py +++ b/setup.py @@ -58,6 +58,7 @@ def read(name): "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Internet :: WWW/HTTP", ], author="Andrew Svetlov", diff --git a/yarl/__init__.py b/yarl/__init__.py index db4e94817..c0dc5656d 100644 --- a/yarl/__init__.py +++ b/yarl/__init__.py @@ -1,5 +1,5 @@ from ._url import URL, cache_clear, cache_configure, cache_info -__version__ = "1.6.3" +__version__ = "1.7.0a0" __all__ = ("URL", "cache_clear", "cache_configure", "cache_info")