view pyproject.toml @ 7968:d7e79f8eb943

issue2551350 - Python changes for 3.12 with roundup 2.3.0 mailer.py Fix due to change in smtplib.SMTP.starttls() signature. As of 3.3 it can use an optional ssl context argument for certificates/keys. In 3.12 it dropped legacy support for specifing cert/key files as arguments and requires a context. I modified Andrew's original patch to initialize SSLContext with ssl.PROTOCOL_TLS_CLIENT. If there is a cert file specified, enable check_hostname - verify that the cert supplied by the server matches the hostname we supplied. If there is no cert file call load_default_certs() Also opened issue2551351 to look into more SMTP ssmtp tightening. We also should have an option in Roundup to use TLS/SSL (smtps) without using starttls. Note that this code is untested by the test suite due to the need to setup an SMTP server with STARTTLS support. issue2551351 has some notes on this.
author John Rouillard <rouilj@ieee.org>
date Wed, 15 May 2024 00:08:05 -0400
parents 9c58f5940c20
children 736f769b48c8
line wrap: on
line source

[tool.pytest.ini_options]
# Note this only works under python3. Pytest 6.0+ supports
# pyproject.toml and is not available for python 2. These settings can
# be adapted for pytest.ini if you are running under python2.

# For use with packages:
#     python -m pip install pytest-cov pytest-env pytest-randomly

minversion = "6.0"

# Disable randomly by default. There are still a few tests that are
# order dependent. Enable on cli for python3 only using:
#   "-p  randomly"
addopts = "-p no:randomly --durations=10 --strict-markers -r a -v"

# Set the redis password to nothing. Can be overridden on cli using:
#    "-e pytest_redis_pw=mySecretPassword"
env = [
    "D:pytest_redis_pw="
]

# Don't search random directories to find tests.
testpaths = [
    "test",
]

[tool.ruff]
line-length = 128
output-format = "full"

exclude = [
    # ignore code imported/sourced from other places
    "roundup/cgi/PageTemplates/*.py",
    "roundup/cgi/TAL/*.py",
    "roundup/cgi/ZTUtils/*.py",
    "roundup/anypy/vendored/*.py",
    "dicttoxml.py"
]

[tool.ruff.lint]
preview = true
explicit-preview-rules = true

select = [
        "A",   # flake-8-builtins shadowing a builtin
        "ARG", # flake8-unused-arguments
        "B",   # flake8-bugbear
        "C4",  # flake8-comprehensions
        "C901", # McCabe complexity
        "COM", # flake8-commas
        "E",   # errors
           # enable preview rules:
           # Error rules indentation
           "E111", "E112", "E113",
           # Error whitespace in brackets/around punctuation
           #       around params, tabs/space around operators
           "E201", "E202",  "E203", "E211", "E222", "E223", "E224",
           "E225", "E226", "E227",  "E228", "E231", "E241", "E242",
           "E251", "E252", "E271", "E272", "E275",
           # Error blank lines between methods, classes etc.
           "E301", "E302", "E303", "E304", "E305", "E306",
           
        "F",   # pyflakes
        "G",   # logging format _(.... % ...) bad use _(...) % ...
        "I",   # imports
        "INT", # check gettext
        "Q",   # quoting consistancy
        "PERF",   # performance lint
        "PIE794", # duplicate class field definition
        "PL",  # pylint
	"PLW", # warnings
        "RET", # check for inconistent returns
        "RUF", # ruff
        "S",   # bandit - security
        "SIM", # simplify code
        "T10", # flake8-debugger
        "W",   # pycode whitespace warnings
]

ignore = [ 
   # raise from except hander with none or chaining; only python3
   "B904",
   # ### before comments is fine
   "E266",
   # ignore double vs. single quotes
   "Q000", "Q001", "Q002",
   # do not replace x in (a,b) with x in {a,b} (set). python 3.2
   # got a speedup in this; only python 3 
   "PLR6201",
   # 505: allow use of else/elif even if it could be removed.
   # if X: return; elif Z: return; else v ->
   # if X: return; if Z: return; v
   # 506: same but with a raise rather than return
   #"RET505",
   #"RET506",
   # use *list to expand; only python 3
   "RUF005",
   # do not use contextlib.suppress rather than except: pass to suppress
   # exception. contextlib doesn't work in python2 and is slower
   "SIM105",
]


[tool.ruff.lint.per-file-ignores]
"roundup/anypy/*.py" = ["RET505", "RET506"]
"roundup/dehtml.py" = ["E501"]
"roundup/rest.py" = ["E501"]
"roundup/support.py" = ["E401"]
"roundup/security.py" = ["E701"]
"roundup/date.py" = ["E231", "E701"]
"roundup/backends/back_sqlite.py" = [ "E203" ]

[too.ruff.lint.pylint]
max-args = 6
max-branches=20
max-statements = 100

[tool.ruff.lint.mccabe]
max-complexity = 50

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