Skip to content

Commit

Permalink
Merge branch 'trunk' into HTTPDigestAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Apr 20, 2024
2 parents bcb946d + f0c668e commit 57769c9
Show file tree
Hide file tree
Showing 37 changed files with 1,024 additions and 631 deletions.
77 changes: 59 additions & 18 deletions .github/workflows/ci.yaml
Expand Up @@ -12,13 +12,13 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
python-version: '3.11'

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key:
Expand All @@ -29,20 +29,22 @@ jobs:
- run: python -m pip install 'tox<4'

- run: tox -q -p all -e flake8,towncrier,twine,check-manifest
- run: tox -q -p all -e flake8,towncrier,twine,check-manifest,mypy
env:
TOX_PARALLEL_NO_SPINNER: 1

docs:
runs-on: ubuntu-20.04
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.11"

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key:
Expand All @@ -51,7 +53,7 @@ jobs:
${{ runner.os }}-pip-docs-
${{ runner.os }}-pip-
- run: python -m pip install tox
- run: python -m pip install 'tox<4'

- run: tox -q -e docs

Expand All @@ -63,27 +65,39 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.8", "pypy-3.9"]
# Python versions common to lowest and latest
python-version: ["3.8", "3.9", "3.10", "pypy-3.9"]
twisted-version: ["lowest", "latest"]
experimental: [false]

include:
- python-version: "3.8"
twisted-version: "trunk"
experimental: true

# Pythons too new for lowest
- python-version: "3.11"
twisted-version: "latest"
experimental: false

- python-version: "3.12"
twisted-version: "latest"
experimental: false

- python-version: "pypy-3.10"
twisted-version: "latest"
experimental: false

# Experimental trunk build
- python-version: "3.9"
twisted-version: "trunk"
experimental: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key:
Expand All @@ -97,12 +111,14 @@ jobs:
shell: python
run: |
table = {
"3.7": "py37",
"3.8": "py38",
"3.9": "py39",
"3.10": "py310",
"3.11": "py311",
"3.12": "py312",
"pypy-3.8": "pypy3",
"pypy-3.9": "pypy3",
"pypy-3.10": "pypy3",
}
factor = table["${{ matrix.python-version }}"]
print("::set-output name=value::" + factor)
Expand All @@ -117,3 +133,28 @@ jobs:
COVERALLS_REPO_TOKEN: 4nctuKHTnVtbdmty2FgdO3iiWm1nb7xc4
COVERALLS_FLAG_NAME: python_${{ matrix.python-version }}-twisted_${{ matrix.twisted-version }}
COVERALLS_PARALLEL: true

# Helper so that on GitHub repo settings we can configure to single job.
# Then required jobs can be updated directly form the code,
# without having to go the GitHub repo setting -> Protected branch
# and all the clicking.
treq-required:
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ !cancelled() }}
# Add here the jobs that should block the merge of a PR.
needs:
- lint
- docs
- test
steps:
- name: Require all successes
shell: python3 {0}
env:
RESULTS: ${{ toJSON(needs.*.result) }}
run: |
import json
import os
import sys
results = json.loads(os.environ["RESULTS"])
sys.exit(0 if all(result == "success" for result in results) else 1)
5 changes: 3 additions & 2 deletions .gitignore
Expand Up @@ -8,8 +8,9 @@ dist
/docs/html
/.eggs
MANIFEST
.coverage
/.coverage
/.coverage.*
coverage
htmlcov
_trial_temp*
.tox
/.tox
29 changes: 29 additions & 0 deletions CHANGELOG.rst
Expand Up @@ -8,6 +8,35 @@ Changelog

.. towncrier release notes start
23.11.0 (2023-11-03)
====================

Features
--------

- When the collector passed to ``treq.collect(response, collector)`` throws an exception, that error will now be returned to the caller of ``collect()`` via the result ``Deferred``, and the underlying HTTP transport will be closed. (`#347 <https://github.com/twisted/treq/issues/347>`__)
- Python 3.11 is now supported. (`#364 <https://github.com/twisted/treq/issues/364>`__)
- Python 3.12 is now supported. (`#375 <https://github.com/twisted/treq/issues/375>`__)
- PyPy 3.9 is now supported. (`#365 <https://github.com/twisted/treq/issues/365>`__)
- PyPy 3.10 is now supported. (`#374 <https://github.com/twisted/treq/issues/374>`__)


Deprecations and Removals
-------------------------

- The minimum supported Twisted version has increased to 22.10.0. Older versions are no longer tested in CI. (`#374 <https://github.com/twisted/treq/issues/374>`__)
- Support for Python 3.6, which has reached end of support, has been dropped. (`#363 <https://github.com/twisted/treq/issues/363>`__)
- Support for Python 3.7, which reaches end of support 2023-06-27, is deprecated. This is the last release with support for Python 3.7. (`#361 <https://github.com/twisted/treq/issues/361>`__)
- Support for PyPy 3.7, which has reached end of support, has been removed. (`#365 <https://github.com/twisted/treq/issues/365>`__)
- Support for PyPy 3.8, which has reached end of support, is deprecated. This is the last release with support for PyPy 3.8. (`#374 <https://github.com/twisted/treq/issues/374>`__)


Misc
----

- `#349 <https://github.com/twisted/treq/issues/349>`__, `#350 <https://github.com/twisted/treq/issues/350>`__, `#352 <https://github.com/twisted/treq/issues/352>`__


22.2.0 (2022-02-08)
===================

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Expand Up @@ -3,6 +3,7 @@ include *.rst
include *.md
include LICENSE
include .coveragerc
include src/treq/py.typed
recursive-include docs *
prune docs/_build
prune docs/html
Expand Down
1 change: 1 addition & 0 deletions changelog.d/297.removal.rst
@@ -0,0 +1 @@
Mixing the *json* argument with *files* or *data* now raises `TypeError`.
1 change: 1 addition & 0 deletions changelog.d/302.removal.rst
@@ -0,0 +1 @@
Passing non-string (`str` or `bytes`) values as part of a dict to the *headers* argument now results in a `TypeError`, as does passing any collection other than a `dict` or `Headers` instance.
1 change: 0 additions & 1 deletion changelog.d/347.feature.rst

This file was deleted.

Empty file removed changelog.d/350.misc.rst
Empty file.
Empty file removed changelog.d/352.misc.rst
Empty file.
1 change: 1 addition & 0 deletions changelog.d/355.bugfix.rst
@@ -0,0 +1 @@
:mod:`treq.content.text_content()` no longer generates deprecation warnings due to use of the ``cgi`` module.
1 change: 0 additions & 1 deletion changelog.d/361.removal.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/363.removal.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/365.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/365.removal.rst

This file was deleted.

1 change: 1 addition & 0 deletions changelog.d/366.feature.rst
@@ -0,0 +1 @@
treq now ships type annotations.
1 change: 1 addition & 0 deletions changelog.d/378.removal.rst
@@ -0,0 +1 @@
Support for Python 3.7 and PyPy 3.8, which have reached end of support, has been dropped.
67 changes: 67 additions & 0 deletions pyproject.toml
Expand Up @@ -13,3 +13,70 @@ filename = "CHANGELOG.rst"
directory = "changelog.d"
title_format = "{version} ({project_date})"
issue_format = "`#{issue} <https://github.com/twisted/treq/issues/{issue}>`__"

[tool.mypy]
namespace_packages = true
plugins = "mypy_zope:plugin"

check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
show_column_numbers = true
show_error_codes = true
strict_optional = true
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unreachable = true
warn_unused_ignores = true

disallow_any_decorated = false
disallow_any_explicit = false
disallow_any_expr = false
disallow_any_generics = false
disallow_any_unimported = false
disallow_subclassing_any = false
disallow_untyped_calls = false
disallow_untyped_decorators = false
strict_equality = false

[[tool.mypy.overrides]]
module = [
"treq.content",
]
disallow_untyped_defs = true

[[tool.mypy.overrides]]
module = [
"treq.api",
"treq.auth",
"treq.client",
"treq.multipart",
"treq.response",
"treq.testing",
"treq.test.test_api",
"treq.test.test_auth",
"treq.test.test_client",
"treq.test.test_content",
"treq.test.test_multipart",
"treq.test.test_response",
"treq.test.test_testing",
"treq.test.test_treq_integration",
"treq.test.util",
]
disallow_untyped_defs = false
check_untyped_defs = false

[[tool.mypy.overrides]]
module = [
"treq.test.local_httpbin.child",
"treq.test.local_httpbin.parent",
"treq.test.local_httpbin.shared",
"treq.test.local_httpbin.test.test_child",
"treq.test.local_httpbin.test.test_parent",
"treq.test.local_httpbin.test.test_shared",
]
disallow_untyped_defs = false
check_untyped_defs = false
ignore_missing_imports = true
12 changes: 7 additions & 5 deletions setup.py
Expand Up @@ -7,11 +7,11 @@
"Operating System :: OS Independent",
"Framework :: Twisted",
"Programming Language :: Python",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
Expand All @@ -27,13 +27,15 @@
package_dir={"": "src"},
setup_requires=["incremental"],
use_incremental=True,
python_requires=">=3.6",
python_requires=">=3.7",
install_requires=[
"incremental",
"requests >= 2.1.0",
"hyperlink >= 21.0.0",
"Twisted[tls] >= 18.7.0",
"Twisted[tls] >= 22.10.0", # For #11635
"attrs",
"typing_extensions >= 3.10.0",
"multipart",
],
extras_require={
"dev": [
Expand All @@ -46,7 +48,7 @@
"sphinx<7.0.0", # Removal of 'style' key breaks RTD.
],
},
package_data={"treq": ["_version"]},
package_data={"treq": ["py.typed"]},
author="David Reid",
author_email="dreid@dreid.org",
maintainer="Tom Most",
Expand Down
25 changes: 17 additions & 8 deletions src/treq/__init__.py
@@ -1,11 +1,20 @@
from __future__ import absolute_import, division, print_function
from treq.api import delete, get, head, patch, post, put, request
from treq.content import collect, content, json_content, text_content

from ._version import __version__
from ._version import __version__ as _version

from treq.api import head, get, post, put, patch, delete, request
from treq.content import collect, content, text_content, json_content
__version__: str = _version.base()

__version__ = __version__.base()

__all__ = ['head', 'get', 'post', 'put', 'patch', 'delete', 'request',
'collect', 'content', 'text_content', 'json_content']
__all__ = [
"head",
"get",
"post",
"put",
"patch",
"delete",
"request",
"collect",
"content",
"text_content",
"json_content",
]

0 comments on commit 57769c9

Please sign in to comment.