Products.PythonScripts 5.0__tar.gz → 5.1__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 (53) hide show
  1. Products.PythonScripts-5.1/.pre-commit-config.yaml +28 -0
  2. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/CHANGES.rst +13 -0
  3. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/MANIFEST.in +1 -0
  4. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/PKG-INFO +25 -3
  5. Products.PythonScripts-5.1/pyproject.toml +21 -0
  6. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/setup.cfg +1 -4
  7. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/setup.py +4 -3
  8. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/PythonScript.py +24 -7
  9. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/testPythonScript.py +48 -2
  10. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/www/pyScriptEdit.dtml +1 -1
  11. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/PKG-INFO +25 -3
  12. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/SOURCES.txt +2 -0
  13. Products.PythonScripts-5.1/tox.ini +77 -0
  14. Products.PythonScripts-5.0/tox.ini +0 -83
  15. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/CONTRIBUTING.md +0 -0
  16. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/COPYRIGHT.txt +0 -0
  17. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/LICENSE.txt +0 -0
  18. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/README.rst +0 -0
  19. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/buildout.cfg +0 -0
  20. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/Extensions/RemotePS.py +0 -0
  21. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/Utility.py +0 -0
  22. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/__init__.py +0 -0
  23. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/configure.zcml +0 -0
  24. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/standard.py +0 -0
  25. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/__init__.py +0 -0
  26. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/testBindings.py +0 -0
  27. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/big_boolean.ps +0 -0
  28. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/boolean_map.ps +0 -0
  29. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/class.__name__.ps +0 -0
  30. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/complete.ps +0 -0
  31. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/complex_print.ps +0 -0
  32. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/fibonacci.ps +0 -0
  33. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/filepath.ps +0 -0
  34. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/for_loop.ps +0 -0
  35. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/global_is_declaration.ps +0 -0
  36. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/mutate_literals.ps +0 -0
  37. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/ns_bind.ps +0 -0
  38. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/ns_bind_invalid.ps +0 -0
  39. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/simple_print.ps +0 -0
  40. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/subversive_except.ps +0 -0
  41. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/try_except.ps +0 -0
  42. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/tuple_unpack_assignment.ps +0 -0
  43. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/tests/tscripts/while_loop.ps +0 -0
  44. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/www/default_content +0 -0
  45. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/www/pyScriptAdd.dtml +0 -0
  46. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/PythonScripts/www/pyScriptProxy.dtml +0 -0
  47. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products/__init__.py +0 -0
  48. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/dependency_links.txt +0 -0
  49. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/entry_points.txt +0 -0
  50. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/namespace_packages.txt +0 -0
  51. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/not-zip-safe +0 -0
  52. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/requires.txt +0 -0
  53. {Products.PythonScripts-5.0 → Products.PythonScripts-5.1}/src/Products.PythonScripts.egg-info/top_level.txt +0 -0
@@ -0,0 +1,28 @@
1
+ # Generated from:
2
+ # https://github.com/zopefoundation/meta/tree/master/config/zope-product
3
+ minimum_pre_commit_version: '3.6'
4
+ repos:
5
+ - repo: https://github.com/pycqa/isort
6
+ rev: "5.13.2"
7
+ hooks:
8
+ - id: isort
9
+ - repo: https://github.com/hhatto/autopep8
10
+ rev: "v2.3.1"
11
+ hooks:
12
+ - id: autopep8
13
+ args: [--in-place, --aggressive, --aggressive]
14
+ - repo: https://github.com/asottile/pyupgrade
15
+ rev: v3.17.0
16
+ hooks:
17
+ - id: pyupgrade
18
+ args: [--py38-plus]
19
+ - repo: https://github.com/isidentical/teyit
20
+ rev: 0.4.3
21
+ hooks:
22
+ - id: teyit
23
+ - repo: https://github.com/PyCQA/flake8
24
+ rev: "7.1.1"
25
+ hooks:
26
+ - id: flake8
27
+ additional_dependencies:
28
+ - flake8-debugger == 4.1.2
@@ -1,6 +1,19 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ 5.1 (2024-10-16)
5
+ ----------------
6
+
7
+ - Fix behavior when uploading no file in ``Zope >= 5.8.1``.
8
+
9
+ - Add support for Python 3.12 and 3.13
10
+
11
+ - Drop support for Python 3.7.
12
+
13
+ - Show Python Scripts source code in tracebacks.
14
+ `#64 <https://github.com/zopefoundation/Products.PythonScripts/issues/64>`_
15
+
16
+
4
17
  5.0 (2023-02-01)
5
18
  ----------------
6
19
 
@@ -5,6 +5,7 @@ include *.rst
5
5
  include *.txt
6
6
  include buildout.cfg
7
7
  include tox.ini
8
+ include .pre-commit-config.yaml
8
9
 
9
10
  recursive-include src *.py
10
11
  include src/Products/PythonScripts/www/default_content
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Products.PythonScripts
3
- Version: 5.0
3
+ Version: 5.1
4
4
  Summary: Provides support for restricted execution of Python scripts in Zope.
5
5
  Home-page: https://github.com/zopefoundation/Products.PythonScripts
6
6
  Author: Zope Foundation and Contributors
@@ -16,14 +16,23 @@ Classifier: License :: OSI Approved :: Zope Public License
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.7
20
19
  Classifier: Programming Language :: Python :: 3.8
21
20
  Classifier: Programming Language :: Python :: 3.9
22
21
  Classifier: Programming Language :: Python :: 3.10
23
22
  Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
24
25
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
- Requires-Python: >=3.7
26
+ Requires-Python: >=3.8
26
27
  License-File: LICENSE.txt
28
+ Requires-Dist: setuptools
29
+ Requires-Dist: AccessControl
30
+ Requires-Dist: Acquisition
31
+ Requires-Dist: DateTime
32
+ Requires-Dist: DocumentTemplate
33
+ Requires-Dist: RestrictedPython>=4.0b5
34
+ Requires-Dist: zExceptions
35
+ Requires-Dist: Zope>=4.1.2
27
36
 
28
37
  .. image:: https://github.com/zopefoundation/Products.PythonScripts/actions/workflows/tests.yml/badge.svg
29
38
  :target: https://github.com/zopefoundation/Products.PythonScripts/actions/workflows/tests.yml
@@ -117,6 +126,19 @@ in the Products directory.
117
126
  Changelog
118
127
  =========
119
128
 
129
+ 5.1 (2024-10-16)
130
+ ----------------
131
+
132
+ - Fix behavior when uploading no file in ``Zope >= 5.8.1``.
133
+
134
+ - Add support for Python 3.12 and 3.13
135
+
136
+ - Drop support for Python 3.7.
137
+
138
+ - Show Python Scripts source code in tracebacks.
139
+ `#64 <https://github.com/zopefoundation/Products.PythonScripts/issues/64>`_
140
+
141
+
120
142
  5.0 (2023-02-01)
121
143
  ----------------
122
144
 
@@ -0,0 +1,21 @@
1
+ #
2
+ # Generated from:
3
+ # https://github.com/zopefoundation/meta/tree/master/config/zope-product
4
+
5
+ [build-system]
6
+ requires = ["setuptools < 74"]
7
+ build-backend = "setuptools.build_meta"
8
+
9
+ [tool.coverage.run]
10
+ branch = true
11
+ source = ["Products.PythonScripts"]
12
+
13
+ [tool.coverage.report]
14
+ fail_under = 83
15
+ precision = 2
16
+ ignore_errors = true
17
+ show_missing = true
18
+ exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"]
19
+
20
+ [tool.coverage.html]
21
+ directory = "parts/htmlcov"
@@ -1,6 +1,3 @@
1
- [bdist_wheel]
2
- universal = 0
3
-
4
1
  [flake8]
5
2
  doctests = 1
6
3
  no-accept-encodings = True
@@ -15,7 +12,7 @@ ignore =
15
12
  force_single_line = True
16
13
  combine_as_imports = True
17
14
  sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
18
- known_third_party = six, docutils, pkg_resources, pytz
15
+ known_third_party = docutils, pkg_resources, pytz
19
16
  known_zope =
20
17
  known_first_party =
21
18
  default_section = ZOPE
@@ -17,7 +17,7 @@ from setuptools import setup
17
17
 
18
18
 
19
19
  setup(name='Products.PythonScripts',
20
- version='5.0',
20
+ version='5.1',
21
21
  url='https://github.com/zopefoundation/Products.PythonScripts',
22
22
  project_urls={
23
23
  'Issue Tracker': ('https://github.com/zopefoundation/'
@@ -44,14 +44,15 @@ setup(name='Products.PythonScripts',
44
44
  'Operating System :: OS Independent',
45
45
  'Programming Language :: Python',
46
46
  'Programming Language :: Python :: 3',
47
- 'Programming Language :: Python :: 3.7',
48
47
  'Programming Language :: Python :: 3.8',
49
48
  'Programming Language :: Python :: 3.9',
50
49
  'Programming Language :: Python :: 3.10',
51
50
  'Programming Language :: Python :: 3.11',
51
+ 'Programming Language :: Python :: 3.12',
52
+ 'Programming Language :: Python :: 3.13',
52
53
  'Programming Language :: Python :: Implementation :: CPython',
53
54
  ],
54
- python_requires='>=3.7',
55
+ python_requires='>=3.8',
55
56
  install_requires=[
56
57
  'setuptools',
57
58
  'AccessControl',
@@ -16,7 +16,9 @@ This product provides support for Script objects containing restricted
16
16
  Python code.
17
17
  """
18
18
 
19
+ import importlib.abc
19
20
  import importlib.util
21
+ import linecache
20
22
  import marshal
21
23
  import os
22
24
  import re
@@ -56,7 +58,7 @@ LOG = getLogger('PythonScripts')
56
58
  Python_magic = importlib.util.MAGIC_NUMBER
57
59
 
58
60
  # This should only be incremented to force recompilation.
59
- Script_magic = 4
61
+ Script_magic = 5
60
62
  _log_complaint = (
61
63
  'Some of your Scripts have stale code cached. Since Zope cannot'
62
64
  ' use this code, startup will be slightly slower until these Scripts'
@@ -97,6 +99,17 @@ def manage_addPythonScript(self, id, title='', file=None, REQUEST=None,
97
99
  return ''
98
100
 
99
101
 
102
+ class PythonScriptLoader(importlib.abc.Loader):
103
+ """PEP302 loader to display source code in tracebacks
104
+ """
105
+
106
+ def __init__(self, source):
107
+ self._source = source
108
+
109
+ def get_source(self, name):
110
+ return self._source
111
+
112
+
100
113
  class PythonScript(Script, Historical, Cacheable):
101
114
  """Web-callable scripts written in a safe subset of Python.
102
115
 
@@ -179,12 +192,12 @@ class PythonScript(Script, Historical, Cacheable):
179
192
  if self.wl_isLocked():
180
193
  raise ResourceLockedError('The script is locked via WebDAV.')
181
194
 
195
+ if not file:
196
+ return self.ZPythonScriptHTML_editForm(
197
+ self, REQUEST,
198
+ manage_tabs_message='No file specified',
199
+ manage_tabs_type='warning')
182
200
  if not isinstance(file, str):
183
- if not file:
184
- return self.ZPythonScriptHTML_editForm(
185
- self, REQUEST,
186
- manage_tabs_message='No file specified',
187
- manage_tabs_type='warning')
188
201
  file = file.read()
189
202
 
190
203
  self.write(file)
@@ -234,7 +247,7 @@ class PythonScript(Script, Historical, Cacheable):
234
247
  self._params,
235
248
  body=self._body or 'pass',
236
249
  name=self.id,
237
- filename=self.meta_type,
250
+ filename=getattr(self, '_filepath', None) or self.get_filepath(),
238
251
  globalize=bind_names)
239
252
 
240
253
  code = compile_result.code
@@ -261,6 +274,7 @@ class PythonScript(Script, Historical, Cacheable):
261
274
  fc.co_argcount)
262
275
  self.Python_magic = Python_magic
263
276
  self.Script_magic = Script_magic
277
+ linecache.clearcache()
264
278
  self._v_change = 0
265
279
 
266
280
  def _newfun(self, code):
@@ -331,6 +345,8 @@ class PythonScript(Script, Historical, Cacheable):
331
345
  PythonScriptTracebackSupplement, self, -1)
332
346
  safe_globals['__file__'] = getattr(
333
347
  self, '_filepath', None) or self.get_filepath()
348
+ safe_globals['__loader__'] = PythonScriptLoader(self._body)
349
+
334
350
  function = types.FunctionType(
335
351
  function_code, safe_globals, None, function_argument_definitions)
336
352
 
@@ -556,6 +572,7 @@ InitializeClass(PythonScript)
556
572
 
557
573
  class PythonScriptTracebackSupplement:
558
574
  """Implementation of ITracebackSupplement"""
575
+
559
576
  def __init__(self, script, line=0):
560
577
  self.object = script
561
578
  # If line is set to -1, it means to use tb_lineno.
@@ -15,6 +15,7 @@ import contextlib
15
15
  import io
16
16
  import os
17
17
  import sys
18
+ import traceback
18
19
  import unittest
19
20
  import warnings
20
21
  from urllib.error import HTTPError
@@ -241,7 +242,8 @@ class TestPythonScriptNoAq(PythonScriptTestBase):
241
242
  self.assertEqual(ps.read(), ps.manage_DAVget())
242
243
 
243
244
  def test_PUT_native_string(self):
244
- ps = makerequest(self._filePS('complete'))
245
+ container = DummyFolder('container')
246
+ ps = makerequest(self._filePS('complete').__of__(container))
245
247
  self.assertEqual(ps.title, 'This is a title')
246
248
  self.assertEqual(ps.body(), 'print(foo+bar+baz)\nreturn printed\n')
247
249
  self.assertEqual(ps.params(), 'foo, bar, baz=1')
@@ -265,7 +267,8 @@ return \xe4\xe9\xee\xf6\xfc
265
267
  self.assertEqual(ps.params(), 'oops')
266
268
 
267
269
  def test_PUT_bytes(self):
268
- ps = makerequest(self._filePS('complete'))
270
+ container = DummyFolder('container')
271
+ ps = makerequest(self._filePS('complete').__of__(container))
269
272
  self.assertEqual(ps.title, 'This is a title')
270
273
  self.assertEqual(ps.body(), 'print(foo+bar+baz)\nreturn printed\n')
271
274
  self.assertEqual(ps.params(), 'foo, bar, baz=1')
@@ -588,3 +591,46 @@ class PythonScriptBrowserTests(FunctionalTestCase):
588
591
 
589
592
  # Cleanup
590
593
  noSecurityManager()
594
+
595
+
596
+ class TestTraceback(FunctionalTestCase, PythonScriptTestBase):
597
+
598
+ def _format_exception(self):
599
+ return "".join(traceback.format_exception(*sys.exc_info()))
600
+
601
+ def test_source_code_in_traceback(self):
602
+ ps = self._newPS("1 / 0")
603
+ try:
604
+ ps()
605
+ except ZeroDivisionError:
606
+ formatted_exception = self._format_exception()
607
+ self.assertIn("1 / 0", formatted_exception)
608
+
609
+ ps.write("2 / 0")
610
+ try:
611
+ ps()
612
+ except ZeroDivisionError:
613
+ formatted_exception = self._format_exception()
614
+ self.assertIn("2 / 0", formatted_exception)
615
+
616
+ def test_multiple_scripts_in_traceback(self):
617
+ from Products.PythonScripts.PythonScript import manage_addPythonScript
618
+
619
+ script1_body = "container.script2()"
620
+ manage_addPythonScript(
621
+ self.folder,
622
+ "script1",
623
+ file=script1_body,
624
+ )
625
+ script2_body = "1 / 0"
626
+ manage_addPythonScript(
627
+ self.folder,
628
+ "script2",
629
+ file=script2_body,
630
+ )
631
+ try:
632
+ self.folder.script1()
633
+ except ZeroDivisionError:
634
+ formatted_exception = self._format_exception()
635
+ self.assertIn(script1_body, formatted_exception)
636
+ self.assertIn(script2_body, formatted_exception)
@@ -16,7 +16,7 @@
16
16
  <div class="form-group row ">
17
17
  <label for="params" class="form-label col-sm-3 col-md-2">Parameter List</label>
18
18
  <div class="col-sm-9 col-md-10">
19
- <input id="params" class="form-control" type="text" name="params" value="&dtml-params;" />
19
+ <input id="params" class="form-control code" type="text" name="params" value="&dtml-params;" />
20
20
  </div>
21
21
  </div>
22
22
  </dtml-with>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Products.PythonScripts
3
- Version: 5.0
3
+ Version: 5.1
4
4
  Summary: Provides support for restricted execution of Python scripts in Zope.
5
5
  Home-page: https://github.com/zopefoundation/Products.PythonScripts
6
6
  Author: Zope Foundation and Contributors
@@ -16,14 +16,23 @@ Classifier: License :: OSI Approved :: Zope Public License
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.7
20
19
  Classifier: Programming Language :: Python :: 3.8
21
20
  Classifier: Programming Language :: Python :: 3.9
22
21
  Classifier: Programming Language :: Python :: 3.10
23
22
  Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Programming Language :: Python :: 3.13
24
25
  Classifier: Programming Language :: Python :: Implementation :: CPython
25
- Requires-Python: >=3.7
26
+ Requires-Python: >=3.8
26
27
  License-File: LICENSE.txt
28
+ Requires-Dist: setuptools
29
+ Requires-Dist: AccessControl
30
+ Requires-Dist: Acquisition
31
+ Requires-Dist: DateTime
32
+ Requires-Dist: DocumentTemplate
33
+ Requires-Dist: RestrictedPython>=4.0b5
34
+ Requires-Dist: zExceptions
35
+ Requires-Dist: Zope>=4.1.2
27
36
 
28
37
  .. image:: https://github.com/zopefoundation/Products.PythonScripts/actions/workflows/tests.yml/badge.svg
29
38
  :target: https://github.com/zopefoundation/Products.PythonScripts/actions/workflows/tests.yml
@@ -117,6 +126,19 @@ in the Products directory.
117
126
  Changelog
118
127
  =========
119
128
 
129
+ 5.1 (2024-10-16)
130
+ ----------------
131
+
132
+ - Fix behavior when uploading no file in ``Zope >= 5.8.1``.
133
+
134
+ - Add support for Python 3.12 and 3.13
135
+
136
+ - Drop support for Python 3.7.
137
+
138
+ - Show Python Scripts source code in tracebacks.
139
+ `#64 <https://github.com/zopefoundation/Products.PythonScripts/issues/64>`_
140
+
141
+
120
142
  5.0 (2023-02-01)
121
143
  ----------------
122
144
 
@@ -1,3 +1,4 @@
1
+ .pre-commit-config.yaml
1
2
  CHANGES.rst
2
3
  CONTRIBUTING.md
3
4
  COPYRIGHT.txt
@@ -5,6 +6,7 @@ LICENSE.txt
5
6
  MANIFEST.in
6
7
  README.rst
7
8
  buildout.cfg
9
+ pyproject.toml
8
10
  setup.cfg
9
11
  setup.py
10
12
  tox.ini
@@ -0,0 +1,77 @@
1
+ # Generated from:
2
+ # https://github.com/zopefoundation/meta/tree/master/config/zope-product
3
+ [tox]
4
+ minversion = 3.18
5
+ envlist =
6
+ release-check
7
+ lint
8
+ py38
9
+ py39
10
+ py310
11
+ py311
12
+ py312
13
+ py313
14
+ coverage
15
+
16
+ [testenv]
17
+ skip_install = true
18
+ deps =
19
+ setuptools < 74
20
+ zc.buildout >= 3.1
21
+ wheel > 0.37
22
+ setenv =
23
+ commands_pre =
24
+ {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
25
+ commands =
26
+ {envbindir}/test {posargs:-cv}
27
+
28
+ [testenv:setuptools-latest]
29
+ basepython = python3
30
+ deps =
31
+ git+https://github.com/pypa/setuptools.git\#egg=setuptools
32
+ zc.buildout >= 3.1
33
+ wheel > 0.37
34
+
35
+
36
+ [testenv:release-check]
37
+ description = ensure that the distribution is ready to release
38
+ basepython = python3
39
+ skip_install = true
40
+ deps =
41
+ setuptools < 74
42
+ twine
43
+ build
44
+ check-manifest
45
+ check-python-versions >= 0.20.0
46
+ wheel
47
+ commands_pre =
48
+ commands =
49
+ check-manifest
50
+ check-python-versions --only setup.py,tox.ini,.github/workflows/tests.yml
51
+ python -m build --sdist --no-isolation
52
+ twine check dist/*
53
+
54
+ [testenv:lint]
55
+ description = This env runs all linters configured in .pre-commit-config.yaml
56
+ basepython = python3
57
+ skip_install = true
58
+ deps =
59
+ pre-commit
60
+ commands_pre =
61
+ commands =
62
+ pre-commit run --all-files --show-diff-on-failure
63
+
64
+ [testenv:coverage]
65
+ basepython = python3
66
+ skip_install = true
67
+ allowlist_externals =
68
+ {[testenv]allowlist_externals}
69
+ mkdir
70
+ deps =
71
+ {[testenv]deps}
72
+ coverage[toml]
73
+ commands =
74
+ mkdir -p {toxinidir}/parts/htmlcov
75
+ coverage run {envbindir}/test {posargs:-cv}
76
+ coverage html
77
+ coverage report
@@ -1,83 +0,0 @@
1
- # Generated from:
2
- # https://github.com/zopefoundation/meta/tree/master/config/zope-product
3
- [tox]
4
- minversion = 3.18
5
- envlist =
6
- lint
7
- py37
8
- py38
9
- py39
10
- py310
11
- py311
12
- coverage
13
-
14
- [testenv]
15
- skip_install = true
16
- deps =
17
- zc.buildout >= 3.0.1
18
- wheel > 0.37
19
- commands_pre =
20
- {envbindir}/buildout -nc {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
21
- commands =
22
- {envdir}/bin/test {posargs:-cv}
23
-
24
- [testenv:lint]
25
- basepython = python3
26
- commands_pre =
27
- mkdir -p {toxinidir}/parts/flake8
28
- allowlist_externals =
29
- mkdir
30
- commands =
31
- isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
32
- flake8 {toxinidir}/src {toxinidir}/setup.py
33
- check-manifest
34
- check-python-versions
35
- deps =
36
- check-manifest
37
- check-python-versions
38
- flake8
39
- isort
40
- # Useful flake8 plugins that are Python and Plone specific:
41
- flake8-coding
42
- flake8-debugger
43
- mccabe
44
-
45
- [testenv:isort-apply]
46
- basepython = python3
47
- commands_pre =
48
- deps =
49
- isort
50
- commands =
51
- isort {toxinidir}/src {toxinidir}/setup.py []
52
-
53
- [testenv:coverage]
54
- basepython = python3
55
- skip_install = true
56
- allowlist_externals =
57
- mkdir
58
- deps =
59
- {[testenv]deps}
60
- coverage
61
- commands =
62
- mkdir -p {toxinidir}/parts/htmlcov
63
- coverage run {envdir}/bin/test {posargs:-cv}
64
- coverage html
65
- coverage report -m --fail-under=83
66
-
67
- [coverage:run]
68
- branch = True
69
- source = Products.PythonScripts
70
-
71
- [coverage:report]
72
- precision = 2
73
- exclude_lines =
74
- pragma: no cover
75
- pragma: nocover
76
- except ImportError:
77
- raise NotImplementedError
78
- if __name__ == '__main__':
79
- self.fail
80
- raise AssertionError
81
-
82
- [coverage:html]
83
- directory = parts/htmlcov