zope.proxy 5.1__tar.gz → 5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. {zope.proxy-5.1 → zope.proxy-5.3}/.coveragerc +1 -0
  2. {zope.proxy-5.1 → zope.proxy-5.3}/.manylinux-install.sh +15 -8
  3. {zope.proxy-5.1 → zope.proxy-5.3}/CHANGES.rst +15 -0
  4. {zope.proxy-5.1 → zope.proxy-5.3}/MANIFEST.in +0 -1
  5. {zope.proxy-5.1 → zope.proxy-5.3}/PKG-INFO +16 -1
  6. {zope.proxy-5.1 → zope.proxy-5.3}/setup.cfg +0 -3
  7. {zope.proxy-5.1 → zope.proxy-5.3}/setup.py +1 -1
  8. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/_zope_proxy_proxy.c +2 -3
  9. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/tests/test_proxy.py +0 -6
  10. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope.proxy.egg-info/PKG-INFO +16 -1
  11. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope.proxy.egg-info/SOURCES.txt +0 -7
  12. {zope.proxy-5.1 → zope.proxy-5.3}/tox.ini +23 -8
  13. zope.proxy-5.1/appveyor.yml +0 -49
  14. zope.proxy-5.1/docs/_build/doctest/output.txt +0 -25
  15. zope.proxy-5.1/docs/_build/html/_sources/api.rst.txt +0 -95
  16. zope.proxy-5.1/docs/_build/html/_sources/changes.rst.txt +0 -1
  17. zope.proxy-5.1/docs/_build/html/_sources/hacking.rst.txt +0 -311
  18. zope.proxy-5.1/docs/_build/html/_sources/index.rst.txt +0 -20
  19. zope.proxy-5.1/docs/_build/html/_sources/narr.rst.txt +0 -153
  20. {zope.proxy-5.1 → zope.proxy-5.3}/.manylinux.sh +0 -0
  21. {zope.proxy-5.1 → zope.proxy-5.3}/.readthedocs.yaml +0 -0
  22. {zope.proxy-5.1 → zope.proxy-5.3}/CONTRIBUTING.md +0 -0
  23. {zope.proxy-5.1 → zope.proxy-5.3}/COPYRIGHT.txt +0 -0
  24. {zope.proxy-5.1 → zope.proxy-5.3}/LICENSE.txt +0 -0
  25. {zope.proxy-5.1 → zope.proxy-5.3}/README.rst +0 -0
  26. {zope.proxy-5.1 → zope.proxy-5.3}/buildout.cfg +0 -0
  27. {zope.proxy-5.1 → zope.proxy-5.3}/docs/Makefile +0 -0
  28. {zope.proxy-5.1 → zope.proxy-5.3}/docs/api.rst +0 -0
  29. {zope.proxy-5.1 → zope.proxy-5.3}/docs/changes.rst +0 -0
  30. {zope.proxy-5.1 → zope.proxy-5.3}/docs/conf.py +0 -0
  31. {zope.proxy-5.1 → zope.proxy-5.3}/docs/hacking.rst +0 -0
  32. {zope.proxy-5.1 → zope.proxy-5.3}/docs/index.rst +0 -0
  33. {zope.proxy-5.1 → zope.proxy-5.3}/docs/make.bat +0 -0
  34. {zope.proxy-5.1 → zope.proxy-5.3}/docs/narr.rst +0 -0
  35. {zope.proxy-5.1 → zope.proxy-5.3}/docs/requirements.txt +0 -0
  36. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/__init__.py +0 -0
  37. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/__init__.py +0 -0
  38. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/decorator.py +0 -0
  39. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/interfaces.py +0 -0
  40. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/proxy.h +0 -0
  41. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/tests/__init__.py +0 -0
  42. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/tests/test_compile_flags.py +0 -0
  43. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope/proxy/tests/test_decorator.py +0 -0
  44. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope.proxy.egg-info/dependency_links.txt +0 -0
  45. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope.proxy.egg-info/namespace_packages.txt +0 -0
  46. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope.proxy.egg-info/not-zip-safe +0 -0
  47. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope.proxy.egg-info/requires.txt +0 -0
  48. {zope.proxy-5.1 → zope.proxy-5.3}/src/zope.proxy.egg-info/top_level.txt +0 -0
@@ -15,6 +15,7 @@ source =
15
15
  [report]
16
16
  show_missing = true
17
17
  precision = 2
18
+ ignore_errors = True
18
19
  exclude_lines =
19
20
  except ImportError:
20
21
  if __name__ == '__main__':
@@ -28,6 +28,7 @@ yum -y install libffi-devel
28
28
 
29
29
  tox_env_map() {
30
30
  case $1 in
31
+ *"cp313"*) echo 'py313';;
31
32
  *"cp37"*) echo 'py37';;
32
33
  *"cp38"*) echo 'py38';;
33
34
  *"cp39"*) echo 'py39';;
@@ -41,14 +42,20 @@ tox_env_map() {
41
42
  # Compile wheels
42
43
  for PYBIN in /opt/python/*/bin; do
43
44
  if \
44
- [[ "${PYBIN}" == *"cp311"* ]] || \
45
- [[ "${PYBIN}" == *"cp312"* ]] || \
46
- [[ "${PYBIN}" == *"cp37"* ]] || \
47
- [[ "${PYBIN}" == *"cp38"* ]] || \
48
- [[ "${PYBIN}" == *"cp39"* ]] || \
49
- [[ "${PYBIN}" == *"cp310"* ]] ; then
50
- "${PYBIN}/pip" install -e /io/
51
- "${PYBIN}/pip" wheel /io/ -w wheelhouse/
45
+ [[ "${PYBIN}" == *"cp313/"* ]] || \
46
+ [[ "${PYBIN}" == *"cp311/"* ]] || \
47
+ [[ "${PYBIN}" == *"cp312/"* ]] || \
48
+ [[ "${PYBIN}" == *"cp37/"* ]] || \
49
+ [[ "${PYBIN}" == *"cp38/"* ]] || \
50
+ [[ "${PYBIN}" == *"cp39/"* ]] || \
51
+ [[ "${PYBIN}" == *"cp310/"* ]] ; then
52
+ if [[ "${PYBIN}" == *"cp313/"* ]] ; then
53
+ "${PYBIN}/pip" install --pre -e /io/
54
+ "${PYBIN}/pip" wheel /io/ --pre -w wheelhouse/
55
+ else
56
+ "${PYBIN}/pip" install -e /io/
57
+ "${PYBIN}/pip" wheel /io/ -w wheelhouse/
58
+ fi
52
59
  if [ `uname -m` == 'aarch64' ]; then
53
60
  cd /io/
54
61
  ${PYBIN}/pip install tox
@@ -2,6 +2,21 @@
2
2
  Changes
3
3
  =========
4
4
 
5
+ 5.3 (2024-08-07)
6
+ ================
7
+
8
+ - Build Windows wheels on GHA.
9
+
10
+ - Correct return type for ``wrap_hash`` (fixes build on ``i386``).
11
+ (`#61 <https://github.com/zopefoundation/zope.proxy/issues/61>`_)
12
+
13
+
14
+ 5.2 (2024-02-09)
15
+ ================
16
+
17
+ - Add preliminary support for Python 3.13 as of 3.13a3.
18
+
19
+
5
20
  5.1 (2023-10-05)
6
21
  ================
7
22
 
@@ -5,7 +5,6 @@ include *.rst
5
5
  include *.txt
6
6
  include buildout.cfg
7
7
  include tox.ini
8
- include appveyor.yml
9
8
  include .coveragerc
10
9
 
11
10
  recursive-include docs *.py
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zope.proxy
3
- Version: 5.1
3
+ Version: 5.3
4
4
  Summary: Generic Transparent Proxies
5
5
  Home-page: http://github.com/zopefoundation/zope.proxy
6
6
  Author: Zope Foundation and Contributors
@@ -80,6 +80,21 @@ Complete documentation is at https://zopeproxy.readthedocs.io
80
80
  Changes
81
81
  =========
82
82
 
83
+ 5.3 (2024-08-07)
84
+ ================
85
+
86
+ - Build Windows wheels on GHA.
87
+
88
+ - Correct return type for ``wrap_hash`` (fixes build on ``i386``).
89
+ (`#61 <https://github.com/zopefoundation/zope.proxy/issues/61>`_)
90
+
91
+
92
+ 5.2 (2024-02-09)
93
+ ================
94
+
95
+ - Add preliminary support for Python 3.13 as of 3.13a3.
96
+
97
+
83
98
  5.1 (2023-10-05)
84
99
  ================
85
100
 
@@ -1,6 +1,3 @@
1
- [bdist_wheel]
2
- universal = 0
3
-
4
1
  [zest.releaser]
5
2
  create-wheel = no
6
3
 
@@ -79,7 +79,7 @@ else:
79
79
  headers = [os.path.join('src', 'zope', 'proxy', 'proxy.h')]
80
80
 
81
81
  setup(name='zope.proxy',
82
- version='5.1',
82
+ version='5.3',
83
83
  author='Zope Foundation and Contributors',
84
84
  author_email='zope-dev@zope.org',
85
85
  description='Generic Transparent Proxies',
@@ -311,7 +311,7 @@ wrap_repr(PyObject *wrapper)
311
311
  return PyObject_Repr(Proxy_GET_OBJECT(wrapper));
312
312
  }
313
313
 
314
- static long
314
+ static Py_hash_t
315
315
  wrap_hash(PyObject *self)
316
316
  {
317
317
  return PyObject_Hash(Proxy_GET_OBJECT(self));
@@ -321,8 +321,7 @@ static PyObject *
321
321
  wrap_call(PyObject *self, PyObject *args, PyObject *kw)
322
322
  {
323
323
  if (kw)
324
- return PyEval_CallObjectWithKeywords(Proxy_GET_OBJECT(self),
325
- args, kw);
324
+ return PyObject_Call(Proxy_GET_OBJECT(self), args, kw);
326
325
  else
327
326
  return PyObject_CallObject(Proxy_GET_OBJECT(self), args);
328
327
  }
@@ -44,12 +44,6 @@ class PyProxyBaseTestCase(unittest.TestCase):
44
44
  getslice = '__getitem__'
45
45
  setslice = '__setitem__'
46
46
 
47
- # Avoid DeprecationWarning for assertRaisesRegexp on Python 3 while
48
- # coping with Python 2 not having the Regex spelling variant
49
- assertRaisesRegex = getattr(
50
- unittest.TestCase, 'assertRaisesRegex',
51
- getattr(unittest.TestCase, 'assertRaisesRegexp', None))
52
-
53
47
  def _getTargetClass(self):
54
48
  from zope.proxy import PyProxyBase
55
49
  return PyProxyBase
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zope.proxy
3
- Version: 5.1
3
+ Version: 5.3
4
4
  Summary: Generic Transparent Proxies
5
5
  Home-page: http://github.com/zopefoundation/zope.proxy
6
6
  Author: Zope Foundation and Contributors
@@ -80,6 +80,21 @@ Complete documentation is at https://zopeproxy.readthedocs.io
80
80
  Changes
81
81
  =========
82
82
 
83
+ 5.3 (2024-08-07)
84
+ ================
85
+
86
+ - Build Windows wheels on GHA.
87
+
88
+ - Correct return type for ``wrap_hash`` (fixes build on ``i386``).
89
+ (`#61 <https://github.com/zopefoundation/zope.proxy/issues/61>`_)
90
+
91
+
92
+ 5.2 (2024-02-09)
93
+ ================
94
+
95
+ - Add preliminary support for Python 3.13 as of 3.13a3.
96
+
97
+
83
98
  5.1 (2023-10-05)
84
99
  ================
85
100
 
@@ -8,7 +8,6 @@ COPYRIGHT.txt
8
8
  LICENSE.txt
9
9
  MANIFEST.in
10
10
  README.rst
11
- appveyor.yml
12
11
  buildout.cfg
13
12
  setup.cfg
14
13
  setup.py
@@ -22,12 +21,6 @@ docs/index.rst
22
21
  docs/make.bat
23
22
  docs/narr.rst
24
23
  docs/requirements.txt
25
- docs/_build/doctest/output.txt
26
- docs/_build/html/_sources/api.rst.txt
27
- docs/_build/html/_sources/changes.rst.txt
28
- docs/_build/html/_sources/hacking.rst.txt
29
- docs/_build/html/_sources/index.rst.txt
30
- docs/_build/html/_sources/narr.rst.txt
31
24
  src/zope/__init__.py
32
25
  src/zope.proxy.egg-info/PKG-INFO
33
26
  src/zope.proxy.egg-info/SOURCES.txt
@@ -10,14 +10,18 @@ envlist =
10
10
  py310,py310-pure
11
11
  py311,py311-pure
12
12
  py312,py312-pure
13
+ py313,py313-pure
13
14
  pypy3
14
15
  docs
15
16
  coverage
16
17
 
17
18
  [testenv]
18
19
  usedevelop = true
20
+ pip_pre = py313: true
19
21
  deps =
22
+ setuptools < 69
20
23
  py37: urllib3 < 2
24
+ Sphinx
21
25
  setenv =
22
26
  pure: PURE_PYTHON=1
23
27
  !pure-!pypy3: PURE_PYTHON=0
@@ -44,21 +48,32 @@ commands =
44
48
  coverage run -m zope.testrunner --test-path=src {posargs:-vc}
45
49
  coverage html -i
46
50
  coverage report -i -m --fail-under=99
51
+ [testenv:release-check]
52
+ description = ensure that the distribution is ready to release
53
+ basepython = python3
54
+ skip_install = true
55
+ deps =
56
+ twine
57
+ build
58
+ check-manifest
59
+ check-python-versions >= 0.20.0
60
+ wheel
61
+ commands_pre =
62
+ commands =
63
+ check-manifest
64
+ check-python-versions --only setup.py,tox.ini,.github/workflows/tests.yml
65
+ python -m build --sdist --no-isolation
66
+ twine check dist/*
47
67
 
48
68
  [testenv:lint]
49
69
  basepython = python3
50
70
  skip_install = true
71
+ deps =
72
+ isort
73
+ flake8
51
74
  commands =
52
75
  isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
53
76
  flake8 src setup.py
54
- check-manifest
55
- check-python-versions
56
- deps =
57
- check-manifest
58
- check-python-versions >= 0.19.1
59
- wheel
60
- flake8
61
- isort
62
77
 
63
78
  [testenv:isort-apply]
64
79
  basepython = python3
@@ -1,49 +0,0 @@
1
- # Generated from:
2
- # https://github.com/zopefoundation/meta/tree/master/config/c-code
3
- environment:
4
- # Currently the builds use @mgedmin's Appveyor account. The PyPI token belongs
5
- # to zope.wheelbuilder, which is managed by @mgedmin and @dataflake.
6
- global:
7
- TWINE_USERNAME: __token__
8
- TWINE_PASSWORD:
9
- secure: aoZC/+rvJKg8B5GMGIxd1bg9UDShk28EhfPQFKI9zy7kzygdgj0XuaK619sLe3s4B08bIJaIUAThxEvWq13IvdLb5Oyk8B9qubd+NnDiNuw8WCGy4owYnbl+61fUVVKJIf1ETQyGDooYrEuBo798/+ycQbilTpmncAHZb2KyZkmA210fcWr7OhwmlRtC4IiW7GPCaxU6qhzLlP5pnS2Tl+yy/qx2DiW2fKWqUqynrb1ZMsk6ygN4qV72glTY6wV0eYboAGlghrws1x5+Z10Yug==
10
-
11
- matrix:
12
- - python: 37-x64
13
- - python: 38-x64
14
- - python: 39-x64
15
- - python: 310-x64
16
- - python: 311-x64
17
- - python: 312-x64
18
-
19
- install:
20
- - "SET PYTHONVERSION=%PYTHON%"
21
- - "SET PATH=C:\\Python%PYTHON%;c:\\Python%PYTHON%\\scripts;%PATH%"
22
- - ps: |
23
- $env:PYTHON = "C:\\Python${env:PYTHON}"
24
- if (-not (Test-Path $env:PYTHON)) {
25
- curl -o install_python.ps1 https://raw.githubusercontent.com/matthew-brett/multibuild/11a389d78892cf90addac8f69433d5e22bfa422a/install_python.ps1
26
- .\install_python.ps1
27
- }
28
- - ps: if (-not (Test-Path $env:PYTHON)) { throw "No $env:PYTHON" }
29
- - echo "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 > "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat"
30
- - python -m pip install -U pip
31
- - pip install -U setuptools wheel
32
- - pip install -U -e .[test]
33
-
34
- matrix:
35
- fast_finish: true
36
-
37
- build_script:
38
- - python -W ignore setup.py -q bdist_wheel
39
-
40
- test_script:
41
- - zope-testrunner --test-path=src
42
- artifacts:
43
- - path: 'dist\*.whl'
44
- name: wheel
45
-
46
- deploy_script:
47
- - ps: if ($env:APPVEYOR_REPO_TAG -eq $TRUE) { pip install twine; twine upload --skip-existing dist\*.whl }
48
-
49
- deploy: on
@@ -1,25 +0,0 @@
1
- Results of doctest builder run on 2023-10-05 12:40:24
2
- =====================================================
3
-
4
- Document: narr
5
- --------------
6
- 1 items passed all tests:
7
- 37 tests in default
8
- 37 tests in 1 items.
9
- 37 passed and 0 failed.
10
- Test passed.
11
-
12
- Document: api
13
- -------------
14
- 1 items passed all tests:
15
- 23 tests in default
16
- 23 tests in 1 items.
17
- 23 passed and 0 failed.
18
- Test passed.
19
-
20
- Doctest summary
21
- ===============
22
- 60 tests
23
- 0 failures in tests
24
- 0 failures in setup code
25
- 0 failures in cleanup code
@@ -1,95 +0,0 @@
1
- :mod:`zope.proxy` API
2
- =====================
3
-
4
- :mod:`zope.proxy.interfaces`
5
- ----------------------------
6
-
7
- .. automodule:: zope.proxy.interfaces
8
-
9
- .. autointerface:: IProxyIntrospection
10
- :members:
11
- :member-order: bysource
12
-
13
-
14
- :mod:`zope.proxy`
15
- -----------------
16
-
17
- .. automodule:: zope.proxy
18
- :members:
19
-
20
-
21
- :mod:`zope.proxy.decorator`
22
- ---------------------------
23
-
24
- .. automodule:: zope.proxy.decorator
25
-
26
- .. doctest::
27
-
28
- >>> from zope.interface import Interface
29
- >>> from zope.interface import directlyProvides
30
- >>> from zope.interface import implementer
31
- >>> class I1(Interface):
32
- ... pass
33
- >>> class I2(Interface):
34
- ... pass
35
- >>> class I3(Interface):
36
- ... pass
37
- >>> class I4(Interface):
38
- ... pass
39
- >>> from zope.proxy.decorator import SpecificationDecoratorBase
40
- >>> @implementer(I1)
41
- ... class D1(SpecificationDecoratorBase):
42
- ... pass
43
- >>> @implementer(I2)
44
- ... class D2(SpecificationDecoratorBase):
45
- ... pass
46
- >>> @implementer(I3)
47
- ... class X(object):
48
- ... pass
49
- >>> x = X()
50
- >>> directlyProvides(x, I4)
51
-
52
- Interfaces of X are ordered with the directly-provided interfaces first.
53
-
54
- .. doctest::
55
-
56
- >>> from zope.interface import providedBy
57
- >>> [interface.getName() for interface in list(providedBy(x))]
58
- ['I4', 'I3']
59
-
60
- When we decorate objects, what order should the interfaces come
61
- in? One could argue that decorators are less specific, so they
62
- should come last.
63
-
64
- .. doctest::
65
-
66
- >>> [interface.getName() for interface in list(providedBy(D1(x)))]
67
- ['I4', 'I3', 'I1']
68
-
69
- >>> [interface.getName() for interface in list(providedBy(D2(D1(x))))]
70
- ['I4', 'I3', 'I1', 'I2']
71
-
72
- SpecificationDecorators also work with old-style classes:
73
-
74
- .. doctest::
75
-
76
- >>> @implementer(I3)
77
- ... class X:
78
- ... pass
79
-
80
- >>> x = X()
81
- >>> directlyProvides(x, I4)
82
-
83
- >>> [interface.getName() for interface in list(providedBy(x))]
84
- ['I4', 'I3']
85
-
86
- >>> [interface.getName() for interface in list(providedBy(D1(x)))]
87
- ['I4', 'I3', 'I1']
88
-
89
- >>> [interface.getName() for interface in list(providedBy(D2(D1(x))))]
90
- ['I4', 'I3', 'I1', 'I2']
91
-
92
- .. autoclass:: DecoratorSpecificationDescriptor
93
- :members:
94
-
95
- .. autoclass:: SpecificationDecoratorBase
@@ -1 +0,0 @@
1
- .. include:: ../CHANGES.rst
@@ -1,311 +0,0 @@
1
- Hacking on :mod:`zope.proxy`
2
- ============================
3
-
4
-
5
- Getting the Code
6
- ################
7
-
8
- The main repository for :mod:`zope.proxy` is in the Zope Foundation
9
- Github repository:
10
-
11
- https://github.com/zopefoundation/zope.proxy
12
-
13
- You can get a read-only checkout from there:
14
-
15
- .. code-block:: sh
16
-
17
- $ git clone https://github.com/zopefoundation/zope.proxy.git
18
-
19
- or fork it and get a writeable checkout of your fork:
20
-
21
- .. code-block:: sh
22
-
23
- $ git clone git@github.com/jrandom/zope.proxy.git
24
-
25
- The project also mirrors the trunk from the Github repository as a
26
- Bazaar branch on Launchpad:
27
-
28
- https://code.launchpad.net/zope.proxy
29
-
30
- You can branch the trunk from there using Bazaar:
31
-
32
- .. code-block:: sh
33
-
34
- $ bzr branch lp:zope.proxy
35
-
36
-
37
- Working in a ``virtualenv``
38
- ###########################
39
-
40
- Installing
41
- ----------
42
-
43
- If you use the ``virtualenv`` package to create lightweight Python
44
- development environments, you can run the tests using nothing more
45
- than the ``python`` binary in a virtualenv. First, create a scratch
46
- environment:
47
-
48
- .. code-block:: sh
49
-
50
- $ /path/to/virtualenv --no-site-packages /tmp/hack-zope.proxy
51
-
52
- Next, get this package registered as a "development egg" in the
53
- environment:
54
-
55
- .. code-block:: sh
56
-
57
- $ /tmp/hack-zope.proxy/bin/python setup.py develop
58
-
59
- Running the tests
60
- -----------------
61
-
62
- Then, you canrun the tests using the build-in ``setuptools`` testrunner:
63
-
64
- .. code-block:: sh
65
-
66
- $ /tmp/hack-zope.proxy/bin/python setup.py test -q
67
- ...................................................................................................................................................
68
- ----------------------------------------------------------------------
69
- Ran 147 tests in 0.010s
70
-
71
- OK
72
-
73
-
74
- If you have the :mod:`nose` package installed in the virtualenv, you can
75
- use its testrunner too:
76
-
77
- .. code-block:: sh
78
-
79
- $ /tmp/hack-zope.proxy/bin/easy_install nose
80
- ...
81
- $ /tmp/hack-zope.proxy/bin/nosetests
82
- .....................................................................................................................................................
83
- ----------------------------------------------------------------------
84
- Ran 149 tests in 0.107s
85
-
86
- OK
87
-
88
- If you have the :mod:`coverage` pacakge installed in the virtualenv,
89
- you can see how well the tests cover the code:
90
-
91
- .. code-block:: sh
92
-
93
- $ /tmp/hack-zope.proxy/bin/easy_install nose coverage
94
- ...
95
- $ /tmp/hack-zope.proxy/bin/nosetests --with coverage
96
- .....................................................................................................................................................
97
- Name Stmts Miss Cover Missing
98
- -----------------------------------------------------
99
- zope.proxy 271 0 100%
100
- zope.proxy._compat 2 0 100%
101
- zope.proxy.decorator 18 0 100%
102
- zope.proxy.interfaces 10 0 100%
103
- -----------------------------------------------------
104
- TOTAL 301 0 100%
105
- ----------------------------------------------------------------------
106
- Ran 149 tests in 0.148s
107
-
108
- OK
109
-
110
-
111
- Building the documentation
112
- --------------------------
113
-
114
- :mod:`zope.proxy` uses the nifty :mod:`Sphinx` documentation system
115
- for building its docs. Using the same virtualenv you set up to run the
116
- tests, you can build the docs:
117
-
118
- .. code-block:: sh
119
-
120
- $ /tmp/hack-zope.proxy/bin/easy_install Sphinx
121
- ...
122
- $ cd docs
123
- $ /tmp/hack-zope.proxy/bin/sphinx-build \
124
- -b html -d _build/doctrees . _build/html
125
- ...
126
- build succeeded.
127
-
128
- You can also test the code snippets in the documentation:
129
-
130
- .. code-block:: sh
131
-
132
- $ /tmp/hack-zope.proxy/bin/sphinx-build \
133
- -b doctest -d _build/doctrees . _build/doctest
134
- ...
135
- running tests...
136
-
137
- Document: api
138
- -------------
139
- 1 items passed all tests:
140
- 23 tests in default
141
- 23 tests in 1 items.
142
- 23 passed and 0 failed.
143
- Test passed.
144
-
145
- Document: narr
146
- --------------
147
- 1 items passed all tests:
148
- 37 tests in default
149
- 37 tests in 1 items.
150
- 37 passed and 0 failed.
151
- Test passed.
152
-
153
- Doctest summary
154
- ===============
155
- 60 tests
156
- 0 failures in tests
157
- 0 failures in setup code
158
- 0 failures in cleanup code
159
- build succeeded.
160
-
161
-
162
-
163
- Using :mod:`zc.buildout`
164
- ########################
165
-
166
- Setting up the buildout
167
- -----------------------
168
-
169
- :mod:`zope.proxy` ships with its own :file:`buildout.cfg` file and
170
- :file:`bootstrap.py` for setting up a development buildout:
171
-
172
- .. code-block:: sh
173
-
174
- $ /path/to/python2.6 bootstrap.py
175
- ...
176
- Generated script '.../bin/buildout'
177
- $ bin/buildout
178
- Develop: '/home/jrandom/projects/Zope/BTK/event/.'
179
- ...
180
- Generated script '.../bin/test'.
181
-
182
- Running the tests
183
- -----------------
184
-
185
- You can now run the tests:
186
-
187
- .. code-block:: sh
188
-
189
- $ bin/test --all
190
- Running zope.testing.testrunner.layer.UnitTests tests:
191
- Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
192
- Ran 147 tests with 0 failures and 0 errors in 0.000 seconds.
193
- Tearing down left over layers:
194
- Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
195
-
196
-
197
-
198
- Using :mod:`tox`
199
- ################
200
-
201
- Running Tests on Multiple Python Versions
202
- -----------------------------------------
203
-
204
- `tox <http://tox.testrun.org/latest/>`_ is a Python-based test automation
205
- tool designed to run tests against multiple Python versions. It creates
206
- a ``virtualenv`` for each configured version, installs the current package
207
- and configured dependencies into each ``virtualenv``, and then runs the
208
- configured commands.
209
-
210
- :mod:`zope.proxy` configures the following :mod:`tox` environments via
211
- its ``tox.ini`` file:
212
-
213
- - The ``py26``, ``py27``, ``py33``, ``py34``, and ``pypy`` environments
214
- builds a ``virtualenv`` with ``pypy``,
215
- installs :mod:`zope.proxy` and dependencies, and runs the tests
216
- via ``python setup.py test -q``.
217
-
218
- - The ``coverage`` environment builds a ``virtualenv`` with ``python2.6``,
219
- installs :mod:`zope.proxy`, installs
220
- :mod:`nose` and :mod:`coverage`, and runs ``nosetests`` with statement
221
- coverage.
222
-
223
- - The ``docs`` environment builds a virtualenv with ``python2.6``, installs
224
- :mod:`zope.proxy`, installs ``Sphinx`` and
225
- dependencies, and then builds the docs and exercises the doctest snippets.
226
-
227
- This example requires that you have a working ``python2.6`` on your path,
228
- as well as installing ``tox``:
229
-
230
- .. code-block:: sh
231
-
232
- $ tox -e py26
233
- GLOB sdist-make: .../zope.proxy/setup.py
234
- py26 sdist-reinst: .../zope.proxy/.tox/dist/zope.proxy-4.0.2dev.zip
235
- py26 runtests: commands[0]
236
- ...
237
- ----------------------------------------------------------------------
238
- Ran 147 tests in 0.000s
239
-
240
- OK
241
- ___________________________________ summary ____________________________________
242
- py26: commands succeeded
243
- congratulations :)
244
-
245
- Running ``tox`` with no arguments runs all the configured environments,
246
- including building the docs and testing their snippets:
247
-
248
- .. code-block:: sh
249
-
250
- $ tox
251
- GLOB sdist-make: .../zope.proxy/setup.py
252
- py26 sdist-reinst: .../zope.proxy/.tox/dist/zope.proxy-4.0.2dev.zip
253
- py26 runtests: commands[0]
254
- ...
255
- Doctest summary
256
- ===============
257
- 60 tests
258
- 0 failures in tests
259
- 0 failures in setup code
260
- 0 failures in cleanup code
261
- build succeeded.
262
- ___________________________________ summary ____________________________________
263
- py26: commands succeeded
264
- py27: commands succeeded
265
- py32: commands succeeded
266
- pypy: commands succeeded
267
- coverage: commands succeeded
268
- docs: commands succeeded
269
- congratulations :)
270
-
271
-
272
- Contributing to :mod:`zope.proxy`
273
- #################################
274
-
275
- Submitting a Bug Report
276
- -----------------------
277
-
278
- :mod:`zope.proxy` tracks its bugs on Github:
279
-
280
- https://github.com/zopefoundation/zope.proxy/issues
281
-
282
- Please submit bug reports and feature requests there.
283
-
284
-
285
- Sharing Your Changes
286
- --------------------
287
-
288
- .. note::
289
-
290
- Please ensure that all tests are passing before you submit your code.
291
- If possible, your submission should include new tests for new features
292
- or bug fixes, although it is possible that you may have tested your
293
- new code by updating existing tests.
294
-
295
- If have made a change you would like to share, the best route is to fork
296
- the Githb repository, check out your fork, make your changes on a branch
297
- in your fork, and push it. You can then submit a pull request from your
298
- branch:
299
-
300
- https://github.com/zopefoundation/zope.proxy/pulls
301
-
302
- If you branched the code from Launchpad using Bazaar, you have another
303
- option: you can "push" your branch to Launchpad:
304
-
305
- .. code-block:: sh
306
-
307
- $ bzr push lp:~jrandom/zope.proxy/cool_feature
308
-
309
- After pushing your branch, you can link it to a bug report on Github,
310
- or request that the maintainers merge your branch using the Launchpad
311
- "merge request" feature.
@@ -1,20 +0,0 @@
1
- :mod:`zope.proxy`
2
- =================
3
-
4
- Contents:
5
-
6
- .. toctree::
7
- :maxdepth: 2
8
-
9
- narr
10
- api
11
- hacking
12
- changes
13
-
14
-
15
- Indices and tables
16
- ==================
17
-
18
- * :ref:`genindex`
19
- * :ref:`modindex`
20
- * :ref:`search`
@@ -1,153 +0,0 @@
1
- :mod:`zope.proxy` Narrative Documentation
2
- =========================================
3
-
4
- Subclassing :class:`ProxyBase`
5
- ------------------------------
6
-
7
- If you subclass a proxy, instances of the subclass have access to
8
- data defined in the class, including descriptors.
9
-
10
- Your subclass instances don't get instance dictionaries, but they
11
- can have slots.
12
-
13
- .. doctest::
14
-
15
- >>> from zope.proxy import ProxyBase
16
- >>> class MyProxy(ProxyBase):
17
- ... __slots__ = 'x', 'y'
18
- ...
19
- ... def f(self):
20
- ... return self.x
21
-
22
- >>> l = [1, 2, 3]
23
- >>> p = MyProxy(l)
24
-
25
- You can use attributes defined by the class, including slots:
26
-
27
- .. doctest::
28
-
29
- >>> p.x = 'x'
30
- >>> p.x
31
- 'x'
32
- >>> p.f()
33
- 'x'
34
-
35
- You can also use attributes of the proxied object:
36
-
37
- .. doctest::
38
-
39
- >>> p
40
- [1, 2, 3]
41
- >>> p.pop()
42
- 3
43
- >>> p
44
- [1, 2]
45
-
46
-
47
- Using get descriptors in proxy classes
48
- --------------------------------------
49
-
50
- A non-data descriptor in a proxy class doesn't hide an attribute on
51
- a proxied object or prevent writing the attribute.
52
-
53
- .. doctest::
54
-
55
- >>> class ReadDescr(object):
56
- ... def __get__(self, i, c):
57
- ... return 'read'
58
-
59
- >>> from zope.proxy import ProxyBase
60
- >>> class MyProxy(ProxyBase):
61
- ... __slots__ = ()
62
- ...
63
- ... z = ReadDescr()
64
- ... q = ReadDescr()
65
-
66
- >>> class MyOb:
67
- ... q = 1
68
-
69
- >>> o = MyOb()
70
- >>> p = MyProxy(o)
71
- >>> p.q
72
- 1
73
-
74
- >>> p.z
75
- 'read'
76
-
77
- >>> p.z = 1
78
- >>> o.z, p.z
79
- (1, 1)
80
-
81
-
82
- Marking proxy attributes as non-overridable
83
- -------------------------------------------
84
-
85
- Normally, methods defined in proxies are overridden by
86
- methods of proxied objects. This applies to all non-data
87
- descriptors. The non_overridable function can be used to
88
- convert a non-data descriptor to a data descriptor that disallows
89
- writes. This function can be used as a decorator to make functions
90
- defined in proxy classes take precedence over functions defined
91
- in proxied objects.
92
-
93
- .. doctest::
94
-
95
- >>> from zope.proxy import ProxyBase
96
- >>> from zope.proxy import non_overridable
97
- >>> class MyProxy(ProxyBase):
98
- ... __slots__ = ()
99
- ...
100
- ... @non_overridable
101
- ... def foo(self):
102
- ... return 'MyProxy foo'
103
-
104
- >>> class MyOb:
105
- ... def foo(self):
106
- ... return 'MyOb foo'
107
-
108
- >>> o = MyOb()
109
- >>> p = MyProxy(o)
110
- >>> p.foo()
111
- 'MyProxy foo'
112
-
113
-
114
- Changing the proxied object
115
- ---------------------------
116
-
117
- .. doctest::
118
-
119
- >>> from zope.proxy import ProxyBase
120
- >>> from zope.proxy import setProxiedObject, getProxiedObject
121
-
122
- >>> class C(object):
123
- ... pass
124
-
125
- >>> c1 = C()
126
- >>> c2 = C()
127
-
128
- >>> p = ProxyBase(c1)
129
-
130
- `setProxiedObject()` allows us to change the object a proxy refers to,
131
- returning the previous referent:
132
-
133
- .. doctest::
134
-
135
- >>> old = setProxiedObject(p, c2)
136
- >>> old is c1
137
- True
138
-
139
- >>> getProxiedObject(p) is c2
140
- True
141
-
142
- The first argument to `setProxiedObject()` must be a proxy; other objects
143
- cause it to raise an exception:
144
-
145
- .. doctest::
146
-
147
- >>> try:
148
- ... setProxiedObject(c1, None)
149
- ... except TypeError:
150
- ... print("TypeError raised")
151
- ... else:
152
- ... print("Expected TypeError not raised")
153
- TypeError raised
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes