Skip to content

Commit 403b912

Browse files
committed
supported python version updates; lint; use native namespace packages
1 parent cac86ce commit 403b912

23 files changed

+493
-141
lines changed

.coveragerc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
[run]
22
source = nti.ntiids
3+
# New in 5.0; required for the GHA coveralls submission.
4+
relative_files = True
5+
omit =
6+
*/flycheck_*py
7+
*/benchmarks/*py
38

49
[report]
510
exclude_lines =
611
pragma: no cover
712
raise NotImplementedError
13+
raise AssertionError
14+
Python 2
815
if __name__ == .__main__.:

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Keep GitHub Actions up to date with GitHub's Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
4+
version: 2
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: /
8+
groups:
9+
github-actions:
10+
patterns:
11+
- "*" # Group all Actions updates into a single larger pull request
12+
schedule:
13+
interval: monthly

.github/workflows/tests.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: tests
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
PYTHONHASHSEED: 1042466059
7+
ZOPE_INTERFACE_STRICT_IRO: 1
8+
9+
10+
jobs:
11+
test:
12+
strategy:
13+
matrix:
14+
python-version:
15+
- "pypy-3.10"
16+
- "3.11"
17+
- "3.12"
18+
- "3.13"
19+
extras:
20+
- "[test,docs]"
21+
# include:
22+
# - python-version: "3.13"
23+
# extras: "[test,docs,gevent,pyramid]"
24+
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
cache: 'pip'
33+
cache-dependency-path: 'setup.py'
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install -U pip setuptools wheel
37+
python -m pip install -U coverage
38+
python -m pip install -v -U -e ".${{ matrix.extras }}"
39+
- name: Test
40+
run: |
41+
python -m coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress
42+
coverage run -a -m sphinx -b doctest -d docs/_build/doctrees docs docs/_build/doctests
43+
coverage combine || true
44+
coverage report -i || true
45+
- name: Lint
46+
if: matrix.python-version == '3.12'
47+
run: |
48+
python -m pip install -U pylint
49+
pylint src
50+
- name: Submit to Coveralls
51+
uses: coverallsapp/github-action@v2
52+
with:
53+
parallel: true
54+
55+
coveralls_finish:
56+
needs: test
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Coveralls Finished
60+
uses: coverallsapp/github-action@v2
61+
with:
62+
parallel-finished: true

.pylintrc

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
[MASTER]
2+
load-plugins=pylint.extensions.bad_builtin,
3+
pylint.extensions.check_elif,
4+
pylint.extensions.code_style,
5+
pylint.extensions.dict_init_mutate,
6+
pylint.extensions.docstyle,
7+
pylint.extensions.dunder,
8+
pylint.extensions.comparison_placement,
9+
pylint.extensions.confusing_elif,
10+
pylint.extensions.for_any_all,
11+
pylint.extensions.consider_refactoring_into_while_condition,
12+
pylint.extensions.mccabe,
13+
pylint.extensions.eq_without_hash,
14+
pylint.extensions.redefined_variable_type,
15+
pylint.extensions.overlapping_exceptions,
16+
pylint.extensions.docparams,
17+
pylint.extensions.private_import,
18+
pylint.extensions.set_membership,
19+
pylint.extensions.typing,
20+
21+
# magic_value wants you to not use arbitrary strings and numbers
22+
# inline in the code. But it's overzealous and has way too many false
23+
# positives. Trust people to do the most readable thing.
24+
# pylint.extensions.magic_value
25+
26+
# Empty comment would be good, except it detects blank lines within
27+
# a single comment block.
28+
#
29+
# Those are often used to separate paragraphs, like here.
30+
# pylint.extensions.empty_comment,
31+
32+
# consider_ternary_expression is a nice check, but is also overzealous.
33+
# Trust the human to do the readable thing.
34+
# pylint.extensions.consider_ternary_expression,
35+
36+
# redefined_loop_name tends to catch us with things like
37+
# for name in (a, b, c): name = name + '_column' ...
38+
# pylint.extensions.redefined_loop_name,
39+
40+
# This wants you to turn ``x in (1, 2)`` into ``x in {1, 2}``.
41+
# They both result in the LOAD_CONST bytecode, one a tuple one a
42+
# frozenset. In theory a set lookup using hashing is faster than
43+
# a linear scan of a tuple; but if the tuple is small, it can often
44+
# actually be faster to scan the tuple.
45+
# pylint.extensions.set_membership,
46+
47+
# Fix zope.cachedescriptors.property.Lazy; the property-classes doesn't seem to
48+
# do anything.
49+
# https://stackoverflow.com/questions/51160955/pylint-how-to-specify-a-self-defined-property-decorator-with-property-classes
50+
# For releases prior to 2.14.2, this needs to be a one-line, quoted string. After that,
51+
# a multi-line string.
52+
# - Make zope.cachedescriptors.property.Lazy look like a property;
53+
# fixes pylint thinking it is a method.
54+
# - Run in Pure Python mode (ignore C extensions that respect this);
55+
# fixes some issues with zope.interface, like IFoo.providedby(ob)
56+
# claiming not to have the right number of parameters...except no, it does not.
57+
init-hook =
58+
import astroid.bases
59+
astroid.bases.POSSIBLE_PROPERTIES.add('Lazy')
60+
astroid.bases.POSSIBLE_PROPERTIES.add('LazyOnClass')
61+
astroid.bases.POSSIBLE_PROPERTIES.add('readproperty')
62+
astroid.bases.POSSIBLE_PROPERTIES.add('non_overridable')
63+
import os
64+
os.environ['PURE_PYTHON'] = ("1")
65+
# Ending on a quoted string
66+
# breaks pylint 2.14.5 (it strips the trailing quote. This is
67+
# probably because it tries to handle one-line quoted strings as well as multi-blocks).
68+
# The parens around it fix the issue.
69+
70+
71+
[MESSAGES CONTROL]
72+
73+
# Disable the message, report, category or checker with the given id(s). You
74+
# can either give multiple identifier separated by comma (,) or put this option
75+
# multiple time (only on the command line, not in the configuration file where
76+
# it should appear only once).
77+
# NOTE: comments must go ABOVE the statement. In Python 2, mixing in
78+
# comments disables all directives that follow, while in Python 3, putting
79+
# comments at the end of the line does the same thing (though Py3 supports
80+
# mixing)
81+
82+
83+
# invalid-name, ; We get lots of these, especially in scripts. should fix many of them
84+
# protected-access, ; We have many cases of this; legit ones need to be examinid and commented, then this removed
85+
# no-self-use, ; common in superclasses with extension points
86+
# too-few-public-methods, ; Exception and marker classes get tagged with this
87+
# exec-used, ; should tag individual instances with this, there are some but not too many
88+
# global-statement, ; should tag individual instances
89+
# multiple-statements, ; "from gevent import monkey; monkey.patch_all()"
90+
# locally-disabled, ; yes, we know we're doing this. don't replace one warning with another
91+
# cyclic-import, ; most of these are deferred imports
92+
# too-many-arguments, ; these are almost always because that's what the stdlib does
93+
# redefined-builtin, ; likewise: these tend to be keyword arguments like len= in the stdlib
94+
# undefined-all-variable, ; XXX: This crashes with pylint 1.5.4 on Travis (but not locally on Py2/3
95+
# ; or landscape.io on Py3). The file causing the problem is unclear. UPDATE: identified and disabled
96+
# that file.
97+
# see https://github.com/PyCQA/pylint/issues/846
98+
# useless-suppression: the only way to avoid repeating it for specific statements everywhere that we
99+
# do Py2/Py3 stuff is to put it here. Sadly this means that we might get better but not realize it.
100+
# duplicate-code: Yeah, the compatibility ssl modules are much the same
101+
# In pylint 1.8.0, inconsistent-return-statements are created for the wrong reasons.
102+
# This code raises it, even though there is only one return (the implicit ``return None`` is presumably
103+
# what triggers it):
104+
# def foo():
105+
# if baz:
106+
# return 1
107+
# In Pylint 2dev1, needed for Python 3.7, we get spurious "useless return" errors:
108+
# @property
109+
# def foo(self):
110+
# return None # generates useless-return
111+
# Pylint 2.4 adds import-outside-toplevel. But we do that a lot to defer imports because of patching.
112+
# Pylint 2.4 adds self-assigning-variable. But we do *that* to avoid unused-import when we
113+
# "export" the variable and dont have a __all__.
114+
# Pylint 2.6+ adds some python-3-only things that dont apply: raise-missing-from, super-with-arguments, consider-using-f-string, redundant-u-string-prefix
115+
# cyclic import is added because it pylint is spuriously detecting that
116+
# consider-using-assignment-expr wants you to transform things like:
117+
# foo = get_foo()
118+
# if foo: ...
119+
#
120+
# Into ``if (foo := get_foo()):``
121+
# But there are a *lot* of those. Trust people to do the right, most
122+
# readable, thing
123+
#
124+
# docstring-first-line-empty: That's actually our standard, based on Django.
125+
# XXX: unclear on the docstring warnings, missing-type-doc, missing-param-doc,
126+
# differing-param-doc, differing-type-doc (are the last two replacements for the first two?)
127+
#
128+
# They should be addressed, in general they are a good thing, but sometimes they are
129+
# unnecessary.
130+
disable=wrong-import-position,
131+
wrong-import-order,
132+
missing-docstring,
133+
ungrouped-imports,
134+
invalid-name,
135+
too-few-public-methods,
136+
global-statement,
137+
locally-disabled,
138+
too-many-arguments,
139+
useless-suppression,
140+
duplicate-code,
141+
useless-object-inheritance,
142+
import-outside-toplevel,
143+
self-assigning-variable,
144+
consider-using-f-string,
145+
consider-using-assignment-expr,
146+
use-dict-literal,
147+
missing-type-doc,
148+
missing-param-doc,
149+
differing-param-doc,
150+
differing-type-doc,
151+
compare-to-zero,
152+
docstring-first-line-empty,
153+
154+
enable=consider-using-augmented-assign
155+
156+
[FORMAT]
157+
max-line-length=100
158+
max-module-lines=1100
159+
160+
[MISCELLANEOUS]
161+
# List of note tags to take in consideration, separated by a comma.
162+
#notes=FIXME,XXX,TODO
163+
# Disable that, we don't want them to fail the lint CI job.
164+
notes=
165+
166+
[VARIABLES]
167+
168+
dummy-variables-rgx=_.*
169+
init-import=true
170+
171+
[TYPECHECK]
172+
173+
# List of members which are set dynamically and missed by pylint inference
174+
# system, and so shouldnt trigger E1101 when accessed. Python regular
175+
# expressions are accepted.
176+
generated-members=REQUEST,acl_users,aq_parent,providedBy
177+
178+
179+
# Tells whether missing members accessed in mixin class should be ignored. A
180+
# mixin class is detected if its name ends with "mixin" (case insensitive).
181+
# XXX: deprecated in 2.14; replaced with ignored-checks-for-mixins.
182+
# The defaults for that value seem to be what we want
183+
#ignore-mixin-members=yes
184+
185+
# List of classes names for which member attributes should not be checked
186+
# (useful for classes with attributes dynamically set). This can work
187+
# with qualified names.
188+
#ignored-classes=SSLContext, SSLSocket, greenlet, Greenlet, parent, dead
189+
190+
191+
# List of module names for which member attributes should not be checked
192+
# (useful for modules/projects where namespaces are manipulated during runtime
193+
# and thus existing member attributes cannot be deduced by static analysis. It
194+
# supports qualified module names, as well as Unix pattern matching.
195+
#ignored-modules=gevent._corecffi,gevent.os,os,greenlet,threading,gevent.libev.corecffi,gevent.socket,gevent.core,gevent.testing.support
196+
ignored-modules=psycopg2.errors
197+
198+
[DESIGN]
199+
max-attributes=12
200+
max-parents=10
201+
# Bump complexity up one.
202+
max-complexity=11
203+
204+
[BASIC]
205+
# Prospector turns ot unsafe-load-any-extension by default, but
206+
# pylint leaves it off. This is the proximal cause of the
207+
# undefined-all-variable crash.
208+
unsafe-load-any-extension = yes
209+
# This does not seem to work, hence the init-hook
210+
property-classes=zope.cachedescriptors.property.Lazy,zope.cachedescriptors.property.Cached
211+
212+
[CLASSES]
213+
# List of interface methods to ignore, separated by a comma. This is used for
214+
# instance to not check methods defines in Zope's Interface base class.
215+
216+
217+
218+
# Local Variables:
219+
# mode: conf
220+
# End:

.readthedocs.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Some things can only be configured on the RTD dashboard.
6+
# Those that we may have changed from the default include:
7+
8+
# Analytics code:
9+
# Show Version Warning: False
10+
# Single Version: True
11+
12+
# Required
13+
version: 2
14+
15+
# Build documentation in the docs/ directory with Sphinx
16+
sphinx:
17+
builder: html
18+
configuration: docs/conf.py
19+
20+
# Set the version of Python and requirements required to build your
21+
# docs
22+
23+
build:
24+
# os is required for some reason
25+
os: ubuntu-22.04
26+
tools:
27+
python: "3.11"
28+
29+
python:
30+
install:
31+
- method: pip
32+
path: .
33+
extra_requirements:
34+
- docs

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ include nose2.cfg
1010
include tox.ini
1111
include .travis.yml
1212
include *.txt
13+
include *.yml
14+
include .pylintrc
1315
exclude .nti_cover_package
1416
recursive-include docs *.py
1517
recursive-include docs *.rst

babel.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

doc-requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)