Skip to content

Commit

Permalink
Merge branch 'release/1.16.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamDumpleton committed Nov 9, 2023
2 parents 0634a79 + 075216a commit 14ac73e
Show file tree
Hide file tree
Showing 16 changed files with 590 additions and 379 deletions.
134 changes: 72 additions & 62 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
on:
- push
- pull_request
workflow_dispatch:
pull_request:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+dev[0-9]+"

jobs:

Expand All @@ -12,18 +17,19 @@ jobs:
os:
- ubuntu-20.04
python-version:
- 2.7
- 3.5
# - 2.7
# - 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12-dev
- pypy-2.7
- 3.12
# - pypy-2.7
- pypy-3.8
- pypy-3.9
- pypy-3.10
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -85,17 +91,19 @@ jobs:
os:
- macos-latest
python-version:
- 2.7
- 3.5
# - 2.7
# - 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- "3.10"
- 3.11
- pypy-2.7
- 3.12
# - pypy-2.7
- pypy-3.8
- pypy-3.9
- pypy-3.10
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -115,28 +123,28 @@ jobs:
name: coverage
path: .coverage.*

test_windows_py27:
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
python-version:
- 2.7
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install tox
run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
- name: Test with tox
run: python -m tox -e py27,py27-without-extensions
# test_windows_py27:
# name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os:
# - windows-latest
# python-version:
# - 2.7
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Setup Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Update pip
# run: python -m pip install -U pip wheel setuptools
# - name: Install tox
# run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
# - name: Test with tox
# run: python -m tox -e py27,py27-without-extensions

test_windows:
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
Expand All @@ -146,16 +154,18 @@ jobs:
os:
- windows-latest
python-version:
- 3.5
# - 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- "3.10"
- 3.11
- pypy-2.7
- 3.12
# - pypy-2.7
- pypy-3.8
- pypy-3.9
- pypy-3.10
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down Expand Up @@ -198,40 +208,40 @@ jobs:
name: dist
path: dist/*

bdist_wheel_legacy:
name: Build wheels (2.7-3.5) on ${{ matrix.os }}
needs:
- test_linux
- test_macos
- test_windows_py27
- test_windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/cibuildwheel@v1.11.1.post1
with:
output-dir: dist
env:
WRAPT_INSTALL_EXTENSIONS: true
CIBW_BUILD: cp27* cp35*
CIBW_SKIP: cp27-win*
CIBW_BUILD_VERBOSITY: 1
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl
# bdist_wheel_legacy:
# name: Build wheels (2.7-3.5) on ${{ matrix.os }}
# needs:
# - test_linux
# - test_macos
# - test_windows_py27
# - test_windows
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-20.04, windows-latest, macos-latest]
# steps:
# - uses: actions/checkout@v3
# - name: Build wheels
# uses: pypa/cibuildwheel@v1.11.1.post1
# with:
# output-dir: dist
# env:
# WRAPT_INSTALL_EXTENSIONS: true
# CIBW_BUILD: cp27* cp35*
# CIBW_SKIP: cp27-win*
# CIBW_BUILD_VERBOSITY: 1
# - uses: actions/upload-artifact@v3
# with:
# name: dist
# path: dist/*.whl

bdist_wheel:
name: Build wheels (3.6+) on ${{ matrix.os }} for ${{ matrix.arch }}
needs:
- test_linux
#- test_aarch64_linux
- test_macos
- test_windows_py27
# - test_windows_py27
- test_windows
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -249,7 +259,7 @@ jobs:
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v2
- name: Build wheels
uses: pypa/cibuildwheel@v2.11.4
uses: pypa/cibuildwheel@v2.16.2
with:
output-dir: dist
env:
Expand All @@ -268,7 +278,7 @@ jobs:
needs:
- test_linux
- test_macos
- test_windows_py27
# - test_windows_py27
- test_windows
runs-on: ubuntu-20.04
steps:
Expand Down
25 changes: 12 additions & 13 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Build documentation with MkDocs
#mkdocs:
# configuration: mkdocs.yml

# Optionally build your docs in additional formats such as PDF
#formats:
# - pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.8
# install:
# - requirements: docs/requirements.txt
# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
41 changes: 41 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
Release Notes
=============

Version 1.16.0
--------------

Note that version 1.16.0 drops support for Python 2.7 and 3.5. Python version
3.6 or later is required.

**New Features**

* The ``patch_function_wrapper()`` decorator now accepts an ``enabled``
argument, which can be a literal boolean value, object that evaluates as
boolean, or a callable object which returns a boolean. In the case of a
callable, determination of whether the wrapper is invoked will be left until
the point of the call. In the other cases, the wrapper will not be applied if
the value evaluates false at the point of applying the wrapper.

**Features Changed**

* The import hook loader and finder objects are now implemented as transparent
object proxies so they properly proxy pass access to attributes/functions of
the wrapped loader or finder.

* Code files in the implementation have been reorganized such that the pure
Python version of the ``ObjectProxy`` class is directly available even if the
C extension variant is being used. This is to allow the pure Python variant to
be used in exceptional cases where the C extension variant is not fully
compatible with the pure Python implementation and the behaviour of the pure
Python variant is what is required. This should only be relied upon if have
absolutely no choice. The pure Python variant is not as performant as the C
extension.

To access the pure Python variant use ``from wrapt.wrappers import ObjectProxy``
instead of just ``from wrapt import ObjectProxy``. Note that prior to this
version if you had used ``from wrapt.wrappers import ObjectProxy`` you would
have got the C extension variant of the class rather than the pure Python
version if the C extension variant was available.

**Bugs Fixed**

* It was not possible to update the ``__class__`` attribute through the
transparent object proxy when relying on the C implementation.

Version 1.15.0
--------------

Expand Down
16 changes: 6 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,20 @@ description = Module for decorators, wrappers and monkey patching.
long_description = file: README.rst
long_description_content_type = text/x-rst
license = BSD
license_file = LICENSE
license_files = LICENSE
platform = any
keywords = wrapper, proxy, decorator
classifiers =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: BSD License
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
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
project_urls =
Expand All @@ -35,7 +33,7 @@ project_urls =

[options]
zip_safe = false
python_requires = >= 2.7, != 3.0.*, != 3.1.*, != 3.2.*, != 3.3.*, != 3.4.*
python_requires = >= 3.6
packages = find:
package_dir =
=src
Expand Down Expand Up @@ -72,24 +70,22 @@ norecursedirs = .tox venv

[tox:tox]
envlist =
py{27,35,36,37,38,39,310,311,312}
py{27,35,36,37,38,39,310,311,312}-{without,install,disable}-extensions,
py{36,37,38,39,310,311,312}
py{36,37,38,39,310,311,312}-{without,install,disable}-extensions,
pypy-without-extensions

[gh-actions]
python =
2.7: py27, py27-without-extensions, py27-install-extensions, py27-disable-extensions
3.5: py35, py35-without-extensions, py35-install-extensions, py35-disable-extensions
3.6: py36, py36-without-extensions, py36-install-extensions, py36-disable-extensions
3.7: py37, py37-without-extensions, py37-install-extensions, py37-disable-extensions
3.8: py38, py38-without-extensions, py38-install-extensions, py38-disable-extensions
3.9: py39, py39-without-extensions, py39-install-extensions, py39-disable-extensions
3.10: py310, py310-without-extensions, py310-install-extensions, py310-disable-extensions
3.11: py311, py311-without-extensions, py311-install-extensions, py311-disable-extensions
3.12: py312, py312-without-extensions, py312-install-extensions, py312-disable-extensions
pypy-2.7: pypy-without-extensions
pypy-3.8: pypy-without-extensions
pypy-3.9: pypy-without-extensions
pypy-3.10: pypy-without-extensions

[testenv]
deps =
Expand Down
11 changes: 7 additions & 4 deletions src/wrapt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
__version_info__ = ('1', '15', '0')
__version_info__ = ('1', '16', '0')
__version__ = '.'.join(__version_info__)

from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper,
BoundFunctionWrapper, WeakFunctionProxy, PartialCallableObjectProxy,
resolve_path, apply_patch, wrap_object, wrap_object_attribute,
from .__wrapt__ import (ObjectProxy, CallableObjectProxy, FunctionWrapper,
BoundFunctionWrapper, PartialCallableObjectProxy)

from .patches import (resolve_path, apply_patch, wrap_object, wrap_object_attribute,
function_wrapper, wrap_function_wrapper, patch_function_wrapper,
transient_function_wrapper)

from .weakrefs import WeakFunctionProxy

from .decorators import (adapter_factory, AdapterFactory, decorator,
synchronized)

Expand Down
14 changes: 14 additions & 0 deletions src/wrapt/__wrapt__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os

from .wrappers import (ObjectProxy, CallableObjectProxy,
PartialCallableObjectProxy, FunctionWrapper,
BoundFunctionWrapper, _FunctionWrapperBase)

try:
if not os.environ.get('WRAPT_DISABLE_EXTENSIONS'):
from ._wrappers import (ObjectProxy, CallableObjectProxy,
PartialCallableObjectProxy, FunctionWrapper,
BoundFunctionWrapper, _FunctionWrapperBase)

except ImportError:
pass
Loading

0 comments on commit 14ac73e

Please sign in to comment.