Skip to content

Commit 14ac73e

Browse files
Merge branch 'release/1.16.0'
2 parents 0634a79 + 075216a commit 14ac73e

16 files changed

Lines changed: 590 additions & 379 deletions

.github/workflows/main.yml

Lines changed: 72 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
on:
2-
- push
3-
- pull_request
2+
workflow_dispatch:
3+
pull_request:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]+"
7+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
8+
- "[0-9]+.[0-9]+.[0-9]+dev[0-9]+"
49

510
jobs:
611

@@ -12,18 +17,19 @@ jobs:
1217
os:
1318
- ubuntu-20.04
1419
python-version:
15-
- 2.7
16-
- 3.5
20+
# - 2.7
21+
# - 3.5
1722
- 3.6
1823
- 3.7
1924
- 3.8
2025
- 3.9
2126
- "3.10"
2227
- 3.11
23-
- 3.12-dev
24-
- pypy-2.7
28+
- 3.12
29+
# - pypy-2.7
2530
- pypy-3.8
2631
- pypy-3.9
32+
- pypy-3.10
2733
steps:
2834
- name: Checkout code
2935
uses: actions/checkout@v3
@@ -85,17 +91,19 @@ jobs:
8591
os:
8692
- macos-latest
8793
python-version:
88-
- 2.7
89-
- 3.5
94+
# - 2.7
95+
# - 3.5
9096
- 3.6
9197
- 3.7
9298
- 3.8
9399
- 3.9
94100
- "3.10"
95101
- 3.11
96-
- pypy-2.7
102+
- 3.12
103+
# - pypy-2.7
97104
- pypy-3.8
98105
- pypy-3.9
106+
- pypy-3.10
99107
steps:
100108
- name: Checkout code
101109
uses: actions/checkout@v3
@@ -115,28 +123,28 @@ jobs:
115123
name: coverage
116124
path: .coverage.*
117125

118-
test_windows_py27:
119-
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
120-
runs-on: ${{ matrix.os }}
121-
strategy:
122-
matrix:
123-
os:
124-
- windows-latest
125-
python-version:
126-
- 2.7
127-
steps:
128-
- name: Checkout code
129-
uses: actions/checkout@v3
130-
- name: Setup Python ${{ matrix.python-version }}
131-
uses: actions/setup-python@v4
132-
with:
133-
python-version: ${{ matrix.python-version }}
134-
- name: Update pip
135-
run: python -m pip install -U pip wheel setuptools
136-
- name: Install tox
137-
run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
138-
- name: Test with tox
139-
run: python -m tox -e py27,py27-without-extensions
126+
# test_windows_py27:
127+
# name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
128+
# runs-on: ${{ matrix.os }}
129+
# strategy:
130+
# matrix:
131+
# os:
132+
# - windows-latest
133+
# python-version:
134+
# - 2.7
135+
# steps:
136+
# - name: Checkout code
137+
# uses: actions/checkout@v3
138+
# - name: Setup Python ${{ matrix.python-version }}
139+
# uses: actions/setup-python@v4
140+
# with:
141+
# python-version: ${{ matrix.python-version }}
142+
# - name: Update pip
143+
# run: python -m pip install -U pip wheel setuptools
144+
# - name: Install tox
145+
# run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
146+
# - name: Test with tox
147+
# run: python -m tox -e py27,py27-without-extensions
140148

141149
test_windows:
142150
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
@@ -146,16 +154,18 @@ jobs:
146154
os:
147155
- windows-latest
148156
python-version:
149-
- 3.5
157+
# - 3.5
150158
- 3.6
151159
- 3.7
152160
- 3.8
153161
- 3.9
154162
- "3.10"
155163
- 3.11
156-
- pypy-2.7
164+
- 3.12
165+
# - pypy-2.7
157166
- pypy-3.8
158167
- pypy-3.9
168+
- pypy-3.10
159169
steps:
160170
- name: Checkout code
161171
uses: actions/checkout@v3
@@ -198,40 +208,40 @@ jobs:
198208
name: dist
199209
path: dist/*
200210

201-
bdist_wheel_legacy:
202-
name: Build wheels (2.7-3.5) on ${{ matrix.os }}
203-
needs:
204-
- test_linux
205-
- test_macos
206-
- test_windows_py27
207-
- test_windows
208-
runs-on: ${{ matrix.os }}
209-
strategy:
210-
matrix:
211-
os: [ubuntu-20.04, windows-latest, macos-latest]
212-
steps:
213-
- uses: actions/checkout@v3
214-
- name: Build wheels
215-
uses: pypa/cibuildwheel@v1.11.1.post1
216-
with:
217-
output-dir: dist
218-
env:
219-
WRAPT_INSTALL_EXTENSIONS: true
220-
CIBW_BUILD: cp27* cp35*
221-
CIBW_SKIP: cp27-win*
222-
CIBW_BUILD_VERBOSITY: 1
223-
- uses: actions/upload-artifact@v3
224-
with:
225-
name: dist
226-
path: dist/*.whl
211+
# bdist_wheel_legacy:
212+
# name: Build wheels (2.7-3.5) on ${{ matrix.os }}
213+
# needs:
214+
# - test_linux
215+
# - test_macos
216+
# - test_windows_py27
217+
# - test_windows
218+
# runs-on: ${{ matrix.os }}
219+
# strategy:
220+
# matrix:
221+
# os: [ubuntu-20.04, windows-latest, macos-latest]
222+
# steps:
223+
# - uses: actions/checkout@v3
224+
# - name: Build wheels
225+
# uses: pypa/cibuildwheel@v1.11.1.post1
226+
# with:
227+
# output-dir: dist
228+
# env:
229+
# WRAPT_INSTALL_EXTENSIONS: true
230+
# CIBW_BUILD: cp27* cp35*
231+
# CIBW_SKIP: cp27-win*
232+
# CIBW_BUILD_VERBOSITY: 1
233+
# - uses: actions/upload-artifact@v3
234+
# with:
235+
# name: dist
236+
# path: dist/*.whl
227237

228238
bdist_wheel:
229239
name: Build wheels (3.6+) on ${{ matrix.os }} for ${{ matrix.arch }}
230240
needs:
231241
- test_linux
232242
#- test_aarch64_linux
233243
- test_macos
234-
- test_windows_py27
244+
# - test_windows_py27
235245
- test_windows
236246
runs-on: ${{ matrix.os }}
237247
strategy:
@@ -249,7 +259,7 @@ jobs:
249259
if: ${{ matrix.arch == 'aarch64' }}
250260
uses: docker/setup-qemu-action@v2
251261
- name: Build wheels
252-
uses: pypa/cibuildwheel@v2.11.4
262+
uses: pypa/cibuildwheel@v2.16.2
253263
with:
254264
output-dir: dist
255265
env:
@@ -268,7 +278,7 @@ jobs:
268278
needs:
269279
- test_linux
270280
- test_macos
271-
- test_windows_py27
281+
# - test_windows_py27
272282
- test_windows
273283
runs-on: ubuntu-20.04
274284
steps:

.readthedocs.yaml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1+
# .readthedocs.yaml
12
# Read the Docs configuration file
23
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
34

45
# Required
56
version: 2
67

8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
714
# Build documentation in the docs/ directory with Sphinx
815
sphinx:
916
configuration: docs/conf.py
1017

11-
# Build documentation with MkDocs
12-
#mkdocs:
13-
# configuration: mkdocs.yml
14-
15-
# Optionally build your docs in additional formats such as PDF
16-
#formats:
17-
# - pdf
18-
19-
# Optionally set the version of Python and requirements required to build your docs
20-
python:
21-
version: 3.8
22-
# install:
23-
# - requirements: docs/requirements.txt
18+
# We recommend specifying your dependencies to enable reproducible builds:
19+
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
20+
# python:
21+
# install:
22+
# - requirements: docs/requirements.txt

docs/changes.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,47 @@
11
Release Notes
22
=============
33

4+
Version 1.16.0
5+
--------------
6+
7+
Note that version 1.16.0 drops support for Python 2.7 and 3.5. Python version
8+
3.6 or later is required.
9+
10+
**New Features**
11+
12+
* The ``patch_function_wrapper()`` decorator now accepts an ``enabled``
13+
argument, which can be a literal boolean value, object that evaluates as
14+
boolean, or a callable object which returns a boolean. In the case of a
15+
callable, determination of whether the wrapper is invoked will be left until
16+
the point of the call. In the other cases, the wrapper will not be applied if
17+
the value evaluates false at the point of applying the wrapper.
18+
19+
**Features Changed**
20+
21+
* The import hook loader and finder objects are now implemented as transparent
22+
object proxies so they properly proxy pass access to attributes/functions of
23+
the wrapped loader or finder.
24+
25+
* Code files in the implementation have been reorganized such that the pure
26+
Python version of the ``ObjectProxy`` class is directly available even if the
27+
C extension variant is being used. This is to allow the pure Python variant to
28+
be used in exceptional cases where the C extension variant is not fully
29+
compatible with the pure Python implementation and the behaviour of the pure
30+
Python variant is what is required. This should only be relied upon if have
31+
absolutely no choice. The pure Python variant is not as performant as the C
32+
extension.
33+
34+
To access the pure Python variant use ``from wrapt.wrappers import ObjectProxy``
35+
instead of just ``from wrapt import ObjectProxy``. Note that prior to this
36+
version if you had used ``from wrapt.wrappers import ObjectProxy`` you would
37+
have got the C extension variant of the class rather than the pure Python
38+
version if the C extension variant was available.
39+
40+
**Bugs Fixed**
41+
42+
* It was not possible to update the ``__class__`` attribute through the
43+
transparent object proxy when relying on the C implementation.
44+
445
Version 1.15.0
546
--------------
647

setup.cfg

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@ description = Module for decorators, wrappers and monkey patching.
1010
long_description = file: README.rst
1111
long_description_content_type = text/x-rst
1212
license = BSD
13-
license_file = LICENSE
13+
license_files = LICENSE
1414
platform = any
1515
keywords = wrapper, proxy, decorator
1616
classifiers =
1717
Development Status :: 5 - Production/Stable
1818
License :: OSI Approved :: BSD License
19-
Programming Language :: Python :: 2
20-
Programming Language :: Python :: 2.7
2119
Programming Language :: Python :: 3
22-
Programming Language :: Python :: 3.5
2320
Programming Language :: Python :: 3.6
2421
Programming Language :: Python :: 3.7
2522
Programming Language :: Python :: 3.8
2623
Programming Language :: Python :: 3.9
2724
Programming Language :: Python :: 3.10
2825
Programming Language :: Python :: 3.11
26+
Programming Language :: Python :: 3.12
2927
Programming Language :: Python :: Implementation :: CPython
3028
Programming Language :: Python :: Implementation :: PyPy
3129
project_urls =
@@ -35,7 +33,7 @@ project_urls =
3533

3634
[options]
3735
zip_safe = false
38-
python_requires = >= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*, != 3.4.*
36+
python_requires = >= 3.6
3937
packages = find:
4038
package_dir =
4139
=src
@@ -72,24 +70,22 @@ norecursedirs = .tox venv
7270

7371
[tox:tox]
7472
envlist =
75-
py{27,35,36,37,38,39,310,311,312}
76-
py{27,35,36,37,38,39,310,311,312}-{without,install,disable}-extensions,
73+
py{36,37,38,39,310,311,312}
74+
py{36,37,38,39,310,311,312}-{without,install,disable}-extensions,
7775
pypy-without-extensions
7876

7977
[gh-actions]
8078
python =
81-
2.7: py27, py27-without-extensions, py27-install-extensions, py27-disable-extensions
82-
3.5: py35, py35-without-extensions, py35-install-extensions, py35-disable-extensions
8379
3.6: py36, py36-without-extensions, py36-install-extensions, py36-disable-extensions
8480
3.7: py37, py37-without-extensions, py37-install-extensions, py37-disable-extensions
8581
3.8: py38, py38-without-extensions, py38-install-extensions, py38-disable-extensions
8682
3.9: py39, py39-without-extensions, py39-install-extensions, py39-disable-extensions
8783
3.10: py310, py310-without-extensions, py310-install-extensions, py310-disable-extensions
8884
3.11: py311, py311-without-extensions, py311-install-extensions, py311-disable-extensions
8985
3.12: py312, py312-without-extensions, py312-install-extensions, py312-disable-extensions
90-
pypy-2.7: pypy-without-extensions
9186
pypy-3.8: pypy-without-extensions
9287
pypy-3.9: pypy-without-extensions
88+
pypy-3.10: pypy-without-extensions
9389

9490
[testenv]
9591
deps =

src/wrapt/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
__version_info__ = ('1', '15', '0')
1+
__version_info__ = ('1', '16', '0')
22
__version__ = '.'.join(__version_info__)
33

4-
from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper,
5-
BoundFunctionWrapper, WeakFunctionProxy, PartialCallableObjectProxy,
6-
resolve_path, apply_patch, wrap_object, wrap_object_attribute,
4+
from .__wrapt__ import (ObjectProxy, CallableObjectProxy, FunctionWrapper,
5+
BoundFunctionWrapper, PartialCallableObjectProxy)
6+
7+
from .patches import (resolve_path, apply_patch, wrap_object, wrap_object_attribute,
78
function_wrapper, wrap_function_wrapper, patch_function_wrapper,
89
transient_function_wrapper)
910

11+
from .weakrefs import WeakFunctionProxy
12+
1013
from .decorators import (adapter_factory, AdapterFactory, decorator,
1114
synchronized)
1215

src/wrapt/__wrapt__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import os
2+
3+
from .wrappers import (ObjectProxy, CallableObjectProxy,
4+
PartialCallableObjectProxy, FunctionWrapper,
5+
BoundFunctionWrapper, _FunctionWrapperBase)
6+
7+
try:
8+
if not os.environ.get('WRAPT_DISABLE_EXTENSIONS'):
9+
from ._wrappers import (ObjectProxy, CallableObjectProxy,
10+
PartialCallableObjectProxy, FunctionWrapper,
11+
BoundFunctionWrapper, _FunctionWrapperBase)
12+
13+
except ImportError:
14+
pass

0 commit comments

Comments
 (0)