Conversation
- Annotate the full src tree (utils, useridentities, useridfactories, plugin, services, integration, browser) and ship a py.typed marker. - Introduce structural Protocols (AuthResult/AuthUser/AuthProvider) for the untyped authomatic surface and TypedDicts for the mappings. - Make authomatic_cfg always return a dict, dropping the None checks. - Add a make typecheck target (mypy) wired into make check. - Modernize setuphandlers to use plone.api and plone.base INonInstallable. Closes #111
Promote utils to a package (content/plugin/request/settings), split useridfactories into a package, add vocabularies and a config module, and slim interfaces down to interface definitions. Modernize the IPloneSiteRoot and request (WSGIRequest) imports, and enable typing checks in CI. Refs #112
Add tests for the utils subpackages, the user-id factories and their dispatcher, the vocabularies, the REST and Zope request adapters, and the config validator, mirroring the new package layout. Refs #112
Add export_plugin_data / import_plugin_data helpers to serialize the plugin's user identities to a JSON file and restore them, for use during site migrations. UserIdentity/UserIdentities gain from_dict classmethods to rebuild persistent objects from exported data, and a dependencies.zcml loads plone.restapi so json_compatible is available. Closes #113
Deterministic, human-meaningful user ids are easier to target with permissions and group assignments than random UUIDs. Only affects new installations; existing sites keep their configured value. Closes #114
Cover AuthomaticView: config caching, provider listing, publishTraverse, the identity delegation helpers, and the __call__ branches (config errors, non-root redirect, provider validation, and the anonymous login flow). Raises view.py coverage from ~29% to 97%. Refs #112
- Add 'from __future__ import annotations' to modules using TYPE_CHECKING imports (utils/plugin, useridfactories/*); without it, the annotations were evaluated at import time and raised NameError on Python < 3.14 (3.14 defers annotation evaluation by default, which masked it locally). - Declare mypy as a test dependency so the CI 'uv run mypy src' step runs. - Configure mypy for the PEP 420 native namespace (explicit_package_bases, namespace_packages, mypy_path) to avoid a 'found twice' clash with the installed authomatic distribution. - Fix the two real type errors this surfaced (list_providers accumulator type; _properties_from_identity cfg is a ProviderConfig).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A large modernization pass on the add-on: full type annotations, a package reorganization following cookieplone conventions, new user-identity export/import helpers, a better default user-id factory, and a substantial increase in test coverage.
Changes
Typing (#111)
srctree and shipped apy.typedmarker (PEP 561).Protocols (AuthResult/AuthUser/AuthProvider) for the untypedauthomaticsurface andTypedDicts for the mappings.make typecheck(mypy) target wired intomake checkand CI (check-typing: true).Package reorganization (#112)
utilsto a package (content/plugin/request/settings), splituseridfactoriesinto a package, addedvocabulariesand aconfigmodule.interfacesdown to interface definitions; modernizedIPloneSiteRoot/request (WSGIRequest) imports.Export/import user identities (#113)
export_plugin_data/import_plugin_datahelpers to serialize the plugin's user identities to JSON and restore them, for site migrations.Default user-id factory (#114)
userid_factory_namechanged fromuuidtousername_useridfor deterministic, human-meaningful ids. Existing sites keep their configured value.Testing
make check(lint + format + mypy) and the full suite pass — 144 tests, green on Plone 6.1/6.2 × Python 3.11–3.14.Closes
Closes #111
Closes #112
Closes #113
Closes #114