Skip to content

v0.34.1

Choose a tag to compare

@rustyconover rustyconover released this 18 Sep 04:26

import vgi no longer writes to disk

Function.storage is a lazy descriptor: the default SQLite store is meant to be built the first time something uses it. TableFunctionBase.__init_subclass__ defeated that. It detected abstract classes with a plain getattr() over dir(cls), which invoked the descriptor, which created vgi_storage.db under the user's state directory. vgi defines subclasses of its own, so a bare import vgi did it — and failed with

PermissionError: [Errno 13] Permission denied: '/app/.local'

wherever that directory was not writable, such as a worker container running as a non-root user whose home belongs to root. The worker died before it could serve /health.

The check now reads each attribute with inspect.getattr_static, which returns the raw class attribute without invoking descriptors. It answers the same question, since classmethod, staticmethod and property objects all expose the __isabstractmethod__ of what they wrap. The store is still created on first use.

New tests in tests/test_import_side_effects.py import vgi in a subprocess with an empty home directory and check that nothing is written, that a read-only home does not stop the import, and that abstract detection still recognizes abstract classmethods, staticmethods and properties.