Run the published surface check instead of this repository's copy of it #4

Closed
opened 2026-09-21 15:20:20 +00:00 by tiagoagueda · 0 comments
Owner

The surface it was waiting for landed in the core (postulo/postulo#229, 1d6cdd7e0):
postulo.plugins.api now carries the notifier contract, the records a sync works on, the
calls that write to a timeline, the details that hang off a contact, and the calendar text.
The core also publishes the check itself as postulo.plugins.testing, so a plugin can
assert the same thing about its own source that Postulo asserts about the ones it ships.

This plugin already imports nothing but postulo.plugins.api, so there is nothing to
move. What it has is its own copy of the AST check in tests/test_surface.py, which is one
more thing to keep current than there needs to be.

Also

  • The core is pinned to main rather than a commit. Pin it to 1d6cdd7e0 or later, so
    postulo.plugins.testing is there to import and the pin says which core these tests
    passed against.

Run the published check

Replace this repository's hand-written copy of the AST check with the core's:

from pathlib import Path

from postulo.plugins.testing import assert_imports_only_the_surface


def test_the_plugin_imports_only_the_surface():
    assert_imports_only_the_surface(
        Path(__file__).resolve().parents[1] / "src" / "postulo_paperless", package="postulo_paperless"
    )

One check rather than several near-copies that can drift apart, and it resolves relative
imports, which the copy here does not.

The surface it was waiting for landed in the core (postulo/postulo#229, `1d6cdd7e0`): `postulo.plugins.api` now carries the notifier contract, the records a sync works on, the calls that write to a timeline, the details that hang off a contact, and the calendar text. The core also publishes the check itself as `postulo.plugins.testing`, so a plugin can assert the same thing about its own source that Postulo asserts about the ones it ships. This plugin already imports nothing but `postulo.plugins.api`, so there is nothing to move. What it has is its own copy of the AST check in `tests/test_surface.py`, which is one more thing to keep current than there needs to be. ## Also - The core is pinned to `main` rather than a commit. Pin it to `1d6cdd7e0` or later, so `postulo.plugins.testing` is there to import and the pin says which core these tests passed against. ## Run the published check Replace this repository's hand-written copy of the AST check with the core's: ```python from pathlib import Path from postulo.plugins.testing import assert_imports_only_the_surface def test_the_plugin_imports_only_the_surface(): assert_imports_only_the_surface( Path(__file__).resolve().parents[1] / "src" / "postulo_paperless", package="postulo_paperless" ) ``` One check rather than several near-copies that can drift apart, and it resolves relative imports, which the copy here does not.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Postulo/postulo-paperless#4
No description provided.