annotate pyproject.toml @ 7882:77c109725a7e

fix: import/export under windows. Export used native \r\n line endings on windows. This results in blank lines when read and Roundup crashes on import. Use \n line endings when writing due to the hard coded \n or \r (but not \r\n) line terminator expected by csv.reader(). Also updates CHANGES.txt to cover this and a the fix for {Otk,Session}.clear() when backed by dumb dbm on windows.
author John Rouillard <rouilj@ieee.org>
date Thu, 18 Apr 2024 19:36:32 -0400
parents 9c58f5940c20
children 736f769b48c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7822
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
1 [tool.pytest.ini_options]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
2 # Note this only works under python3. Pytest 6.0+ supports
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
3 # pyproject.toml and is not available for python 2. These settings can
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
4 # be adapted for pytest.ini if you are running under python2.
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
5
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
6 # For use with packages:
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
7 # python -m pip install pytest-cov pytest-env pytest-randomly
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
8
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
9 minversion = "6.0"
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
10
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
11 # Disable randomly by default. There are still a few tests that are
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
12 # order dependent. Enable on cli for python3 only using:
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
13 # "-p randomly"
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
14 addopts = "-p no:randomly --durations=10 --strict-markers -r a -v"
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
15
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
16 # Set the redis password to nothing. Can be overridden on cli using:
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
17 # "-e pytest_redis_pw=mySecretPassword"
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
18 env = [
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
19 "D:pytest_redis_pw="
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
20 ]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
21
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
22 # Don't search random directories to find tests.
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
23 testpaths = [
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
24 "test",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
25 ]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
26
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
27 [tool.ruff]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
28 line-length = 128
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
29 output-format = "full"
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
30
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
31 exclude = [
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
32 # ignore code imported/sourced from other places
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
33 "roundup/cgi/PageTemplates/*.py",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
34 "roundup/cgi/TAL/*.py",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
35 "roundup/cgi/ZTUtils/*.py",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
36 "roundup/anypy/vendored/*.py",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
37 "dicttoxml.py"
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
38 ]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
39
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
40 [tool.ruff.lint]
7831
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
41 preview = true
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
42 explicit-preview-rules = true
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
43
7822
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
44 select = [
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
45 "A", # flake-8-builtins shadowing a builtin
7831
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
46 "ARG", # flake8-unused-arguments
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
47 "B", # flake8-bugbear
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
48 "C4", # flake8-comprehensions
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
49 "C901", # McCabe complexity
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
50 "COM", # flake8-commas
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
51 "E", # errors
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
52 # enable preview rules:
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
53 # Error rules indentation
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
54 "E111", "E112", "E113",
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
55 # Error whitespace in brackets/around punctuation
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
56 # around params, tabs/space around operators
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
57 "E201", "E202", "E203", "E211", "E222", "E223", "E224",
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
58 "E225", "E226", "E227", "E228", "E231", "E241", "E242",
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
59 "E251", "E252", "E271", "E272", "E275",
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
60 # Error blank lines between methods, classes etc.
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
61 "E301", "E302", "E303", "E304", "E305", "E306",
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
62
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
63 "F", # pyflakes
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
64 "G", # logging format _(.... % ...) bad use _(...) % ...
7822
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
65 "I", # imports
7831
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
66 "INT", # check gettext
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
67 "Q", # quoting consistancy
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
68 "PERF", # performance lint
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
69 "PIE794", # duplicate class field definition
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
70 "PL", # pylint
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
71 "PLW", # warnings
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
72 "RET", # check for inconistent returns
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
73 "RUF", # ruff
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
74 "S", # bandit - security
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
75 "SIM", # simplify code
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
76 "T10", # flake8-debugger
9c58f5940c20 chore(lint)
John Rouillard <rouilj@ieee.org>
parents: 7822
diff changeset
77 "W", # pycode whitespace warnings
7822
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
78 ]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
79
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
80 ignore = [
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
81 # raise from except hander with none or chaining; only python3
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
82 "B904",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
83 # ### before comments is fine
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
84 "E266",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
85 # ignore double vs. single quotes
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
86 "Q000", "Q001", "Q002",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
87 # do not replace x in (a,b) with x in {a,b} (set). python 3.2
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
88 # got a speedup in this; only python 3
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
89 "PLR6201",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
90 # 505: allow use of else/elif even if it could be removed.
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
91 # if X: return; elif Z: return; else v ->
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
92 # if X: return; if Z: return; v
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
93 # 506: same but with a raise rather than return
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
94 #"RET505",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
95 #"RET506",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
96 # use *list to expand; only python 3
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
97 "RUF005",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
98 # do not use contextlib.suppress rather than except: pass to suppress
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
99 # exception. contextlib doesn't work in python2 and is slower
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
100 "SIM105",
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
101 ]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
102
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
103
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
104 [tool.ruff.lint.per-file-ignores]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
105 "roundup/anypy/*.py" = ["RET505", "RET506"]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
106 "roundup/dehtml.py" = ["E501"]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
107 "roundup/rest.py" = ["E501"]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
108 "roundup/support.py" = ["E401"]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
109 "roundup/security.py" = ["E701"]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
110 "roundup/date.py" = ["E231", "E701"]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
111 "roundup/backends/back_sqlite.py" = [ "E203" ]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
112
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
113 [too.ruff.lint.pylint]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
114 max-args = 6
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
115 max-branches=20
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
116 max-statements = 100
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
117
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
118 [tool.ruff.lint.mccabe]
1b7162938988 test: add pyproject.toml: set pytest and ruff project defaults
John Rouillard <rouilj@ieee.org>
parents:
diff changeset
119 max-complexity = 50

Roundup Issue Tracker: http://roundup-tracker.org/