Skip to content

Commit

Permalink
Merge branch 'trunk' into release-21.2.0-10091
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigc authored Mar 24, 2021
2 parents 51ac9ac + ce02fa1 commit c606576
Show file tree
Hide file tree
Showing 407 changed files with 2,816 additions and 2,430 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ source=
[report]
precision = 2
ignore_errors = True
exclude_lines =
if TYPE_CHECKING
\s*\.\.\.$
35 changes: 27 additions & 8 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
## Scope and purpose
<!--
## Remove this section

Add a few words about why this PR is needed and what is its scope.
Have a look at [our developer documentation](https://twistedmatrix.com/trac/wiki/TwistedDevelopment#SubmittingaPatch) before submitting your Pull Request.

Add mentions of things that are not covered here and are planed to be done
in separate PRs.
Note that the Trac ticket, news fragment, and review submission portions of this process apply to *all* pull requests, no matter how small;
if you don't do them, it's likely that nobody will even notice your PR needs a review.
-->

## Scope and purpose

## Remove this section
Add a few words about why this PR is needed and what is its scope.

Please have a look at [our developer documentation](https://twistedmatrix.com/trac/wiki/TwistedDevelopment#SubmittingaPatch) before submitting your Pull Request.
Add any comments about trade-offs (if any) made in this PR and the reasoning behind them.

Please note that the trac ticket, news fragment, and review submission portions of this process apply to *all* pull requests, no matter how small; if you don't do them, it's likely that nobody will even notice your PR needs a review.
Add mentions of things that are not covered here and are planed to be done in separate PRs.


## Contributor Checklist:

* [ ] The associated ticket in Trac is here: https://twistedmatrix.com/trac/ticket/<!-- Create a new one at https://twistedmatrix.com/trac/newticket and replace this comment with the ticket number. -->
* [ ] I ran `tox -e lint` to format my patch to meet the [Twisted Coding Standard](https://twistedmatrix.com/documents/current/core/development/policy/coding-standard.html)
* [ ] I have created a newsfragment in src/twisted/newsfragments/ (see: [News files](https://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles))
* [ ] I have updated the automated tests.
* [ ] The title of the PR starts with the associated Trac ticket number (without the `#` character).
* [ ] I have updated the automated tests and checked that all checks for the PR are green.
* [ ] I have submitted the associated Trac ticket for review by adding the word `review` to the keywords field in Trac, and putting a link to this PR in the comment; it shows up in https://twisted.reviews/ now.
* [ ] I have added `twisted/twisted-contributors` teams to the PR `Reviewers`.
* [ ] The merge commit will use the below format
The first line is automatically generated by GitHub based on PR ID and branch name.
The other lines generated by GitHub should be replaced.

```
Merge pull request #123 from twisted/4356-branch-name-with-trac-id

Author: <github_username>, <github_usernames_if_more_authors>
Reviewer: <github_username>, <github_usernames_if_more_reviewers>
Fixes: ticket:<trac_ticket_number>, ticket:<another_if_more_in_one_PR>

Long description providing a summary of these changes.
(as long as you wish)
```
130 changes: 64 additions & 66 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
name: Run tests
# Try to get a short workflow name and a job name that start with Python
# version to make it easier to check the status inside GitHub UI.
name: CI

on:
push:
Expand All @@ -8,69 +10,60 @@ on:
pull_request:
branches: [ trunk ]

jobs:
testing:
runs-on: ubuntu-20.04
env:
TOXENV: "alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push"
strategy:
matrix:
python-version: ['3.5.4', 3.5, 3.6, 3.7, 3.8, 3.9, pypy-3.6, pypy-3.7]

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Display Python information
run: |
python --version
python -c "import sys; print(sys.prefix)"
python -c "import sys; print(sys.exec_prefix)"
python -c "import sys; print(sys.executable)"
python -c "import struct; print(struct.calcsize('P') * 8)"
python -c "print('\nENVIRONMENT VARIABLES\n=====================\n\n')"
python -c "import os; [ print(e,v) for (e,v) in os.environ.items() ]"
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'setup.py',
'setup.cfg', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
tox --notest

- name: Test
run: |
python --version
tox -q
defaults:
run:
shell: bash


# We need a builder without IPv6. This is going to be slower than all the
# others, but that's ok.
testing_no_ipv6:
jobs:
testing:
runs-on: ubuntu-20.04
env:
DISABLE_IPV6: yes
TOXENV: "alldeps-withcov-posix,coverage-prepare,codecov-push,coveralls-push"
TOXENV: "${{ matrix.tox-env }}"
CODECOV_OPTIONS: "-n 'lnx-${{ matrix.python-version }}-${{ matrix.tox-env }}${{ matrix.noipv6 }}'"
TRIAL_ARGS: "${{ matrix.trial-args }}"
name: ${{ matrix.python-version }}${{ matrix.noipv6 }}-${{ matrix.tox-env }}
strategy:
fail-fast: false
matrix:
python-version: [3.6]
# Run on the minimum micro Python version that we can get on CI.
# When updating the minimum Python version here, also update the
# `python_requires` from `setup.cfg`.
# Run on latest minor release of each major python version.
python-version: [3.6, 3.7, 3.8, 3.9, 3.10.0-alpha.5]
tox-env: ['alldeps-withcov-posix']
noipv6: ['']
# As of 9 March 2021 GHA VM have 2 CPUs - Azure Standard_DS2_v2
# Trial distributed jobs enabled to speed up the CI jobs.
trial-args: ['-j 4']

include:

# `nodeps` is created to make sure we don't have import errors in the
# runtime and production code.
# The minimum supported Python version should be used to maximize
# coverage of code that otherwise depends on backports.
# Distributed test run is disabled here so that we also have
# end to end functional test usage for non-distributed trial runs.
- python-version: 3.6.7
tox-env: nodeps-withcov-posix
trial-args: ''
# `noipv6` is created to make sure all is OK on an OS which doesn't
# have IPv6 available.
# Any supported Python version is OK for this job.
- python-version: 3.6
tox-env: alldeps-withcov-posix
noipv6: -noipv6
# On PYPY concurrent test jobs result in random failures so for now
# run non-distributed tests.
- python-version: pypy-3.6
tox-env: alldeps-withcov-posix
trial-args:
- python-version: pypy-3.7
tox-env: alldeps-withcov-posix
trial-args:


steps:
- uses: actions/checkout@v2
Expand All @@ -95,16 +88,15 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- name: Display Python information
- name: Disable IPv6
if: matrix.noipv6
run: |
python --version
python -c "import sys; print(sys.prefix)"
python -c "import sys; print(sys.exec_prefix)"
python -c "import sys; print(sys.executable)"
python -c "import struct; print(struct.calcsize('P') * 8)"
python -c "print('\nENVIRONMENT VARIABLES\n=====================\n\n')"
python -c "import os; [ print(e,v) for (e,v) in os.environ.items() ]"
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
ip a
- uses: twisted/python-info-action@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
Expand All @@ -115,6 +107,11 @@ jobs:
python --version
tox -q
- name: Publish coverage
# We want to publish coverage even on failure.
if: contains(matrix['tox-env'], 'withcov') || failure()
run: tox -e coverage-prepare,codecov-push,coveralls-push


pypi-publish:
# https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
Expand All @@ -130,11 +127,12 @@ jobs:

- name: Test
run: |
python --version
python -m pip install --upgrade pip tox pep517
rm -rf dist/*
tox -e release-prepare
- uses: twisted/python-info-action@v1

- name: Display structure of files to be pushed
run: ls -R dist/

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.3
rev: v2.10.0
hooks:
- id: pyupgrade
args: ["--py3-plus"]
args: ["--py36-plus"]

- repo: https://github.com/psf/black
rev: 20.8b1
Expand All @@ -21,7 +21,7 @@ repos:
- id: yesqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
rev: v3.4.0
hooks:
- id: check-merge-conflict
- id: check-toml
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Installation Requirements

To install Twisted, you need:

- Python 3.5/3.6/3.7.
- Python 3.6/3.7/3.8/3.9

- `setuptools <https://pypi.python.org/pypi/setuptools>`_
(installed automatically if you use pip).
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For information on changes in this release, see the `NEWS <NEWS.rst>`_ file.
What is this?
-------------

Twisted is an event-based framework for internet applications, supporting Python 3.5+.
Twisted is an event-based framework for internet applications, supporting Python 3.6+.
It includes modules for many different purposes, including the following:

- ``twisted.web``: HTTP clients and servers, HTML templating, and a WSGI server
Expand Down
6 changes: 3 additions & 3 deletions admin/check_tag_version_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
run_version = sys.argv[1]

if not run_version.startswith(TAG_PREFIX):
print("Not a twisted release tag name '{}.".format(run_version))
print(f"Not a twisted release tag name '{run_version}.")
sys.exit(1)

run_version = run_version[len(TAG_PREFIX) :]

if run_version != branch_version:
print("Branch is at '{}' while tag is '{}'".format(branch_version, run_version))
print(f"Branch is at '{branch_version}' while tag is '{run_version}'")
exit(1)

print("All good. Branch and tag versions match for '{}'.".format(branch_version))
print(f"All good. Branch and tag versions match for '{branch_version}'.")
sys.exit(0)
13 changes: 13 additions & 0 deletions admin/dump_all_version_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import os
import sys
import pkg_resources

print("::group::Python info")
print(sys.prefix)
print(sys.exec_prefix)
print(sys.executable)
print(sys.version)
print(sys.platform)
print("::endgroup::")

if os.environ.get("CI", "").lower() == "true":
# On CI show the exact deps found at runtime.
# Skipped on local dev to speed up the test execution.
print("::group::Deps info")
for ep in pkg_resources.iter_entry_points(group="console_scripts", name="pip"):
ep.load()(["freeze", "--all"])
break
print("::endgroup::")
11 changes: 9 additions & 2 deletions azure-pipelines/run_test_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ parameters:
- name: pythonVersion
type: string
values:
- '3.5'
- '3.6'
- '3.7'
- '3.8'
Expand All @@ -27,6 +26,10 @@ parameters:
default: false

steps:
- checkout: self
clean: true
fetchDepth: 1

- task: UsePythonVersion@0
displayName: "Use Python ${{ parameters.pythonVersion }}"
inputs:
Expand All @@ -49,6 +52,8 @@ steps:
- script: 'python -m tox -e alldeps-withcov-posix'
displayName: 'Run tests'
continueOnError: ${{ parameters.allowFailure }}
env:
TRIAL_ARGS: "-j 4"

- ${{ if eq(parameters.platform, 'windows') }}:
- script: 'python -m tox -e alldeps-withcov-windows'
Expand All @@ -57,5 +62,7 @@ steps:
env:
TWISTED_REACTOR: ${{ parameters.windowsReactor }}

- script: 'python -m tox -e coverage-prepare,coveralls-push'
- bash: |
python -m tox -e coverage-prepare,coveralls-push
bash <(curl -s https://codecov.io/bash) -n "${{ parameters.platform }}-${{ parameters.pythonVersion }}-alldeps-withcov"
displayName: 'Report coverage'
3 changes: 0 additions & 3 deletions azure-pipelines/tests_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- template: 'macos_test_jobs.yml'
parameters:
pythonVersions:
py35: "3.5"
py36: "3.6"
py37: "3.7"
py38: "3.8"
Expand All @@ -28,7 +27,6 @@ jobs:
- template: 'windows_test_jobs.yml'
parameters:
pythonVersions:
py35: "3.5"
py36: "3.6"
py37: "3.7"
py38: "3.8"
Expand All @@ -38,7 +36,6 @@ jobs:
- template: 'windows_test_jobs.yml'
parameters:
pythonVersions:
py35: "3.5"
py36: "3.6"
py37: "3.7"
py38: "3.8"
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines/windows_test_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Set PYTHONUTF8 environment variable to force UTF-8 mode on Python 3.7+
# on Windows.
#
# Set PYTHONIOENCODING to force UTF-8 encoding on Python 3.5 and Python 3.6.
# Set PYTHONIOENCODING to force UTF-8 encoding on Python 3.6.
# This allows people with non-ASCII characters in their names to file pull requests
# and not trigger CI errors.
PYTHONUTF8: 1
Expand Down
4 changes: 2 additions & 2 deletions docs/conch/examples/demo_insults.tac
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class DemoProtocol(insults.TerminalProtocol):
self.height = height

def unhandledControlSequence(self, seq):
log.msg("Client sent something weird: {!r}".format(seq))
log.msg(f"Client sent something weird: {seq!r}")

def keystrokeReceived(self, keyID, modifier):
if keyID == "+":
Expand All @@ -223,7 +223,7 @@ class DemoProtocol(insults.TerminalProtocol):
elif keyID == "/":
self.rate *= 1.1
else:
log.msg("Client sent: {!r}".format(keyID))
log.msg(f"Client sent: {keyID!r}")
return

self._call.stop()
Expand Down
Loading

0 comments on commit c606576

Please sign in to comment.