viur-actions
Action-based request handling for ViUR modules.
Features
@actiondecorator andActionModulemixin- Class-init hook wiring (
can<X>/on<X>/then<X>/<X>Skel), falling back to the suffix-less defaults (can/on/then/skel) - Envelope-v2 via a versioned renderer — mounted under
/json/v2/·/vi/v2/byinstall(), selected per-URL. No monkey-patch, no global switch. By default the unversioned/json/·/vi/follow the newest version (v2); passalias_to_newest=Falseto keep them on v1.
Multi-step workflows (drafts, sliding TTL, optimistic locking, cleanup task)
live in the sibling
viur-workflow package. See
CHANGELOG.md for the running summary.
Requirements
- Python ≥ 3.12
- viur-core ≥ 3.8, < 4
Install
pip install spltz-viur-actions
Quick taste
Serve the envelope by mounting the versioned renderer after setup():
from viur.core import setup
import viur.actions
import modules
app = setup(modules)
viur.actions.install() # mounts /json/v2/… + /vi/v2/…; unversioned /json/ · /vi/ follow v2
Declare actions and hooks on a module:
from viur.core.prototypes import List
from viur.actions import action, ActionModule
class Example(ActionModule, List):
@action
def edit(self, key, **kwargs):
...
# Fallback hooks — every action without specific hooks lands here.
# (No `skel`: on a SkelModule viur-core's own `skel` is the base
# skeleton factory, so defining one here would shadow it and recurse.)
def can(self, skel): ...
def on(self, skel): ...
def then(self, skel): ...
# Action-specific overrides — picked up automatically:
def canEdit(self, skel): ...
def editSkel(self): ...
The class-init wiring (__init_subclass__) checks at class definition time
which hooks the module provides, and resolves missing ones to the
suffix-less default chain. Lookup at runtime is constant-time.
Note: these hooks are resolved for your own
@actionbodies (via theruntimehelpers). viur-core's built-inview/edit/… still call their owncanView/onEdited/… directly —canis not a global policy for them.
Development
Two test layers, run separately:
Unit (fast, mocked) — tests/, 100 % coverage gate:
git clone https://github.com/sprengplatz/viur-actions
cd viur-actions
pip install --no-deps -e .
pip install pytest pytest-cov 'coverage[toml]' 'spltz-viur-light-mock>=0.2.0'
pytest # 100% coverage required
spltz-viur-light-mock provides the viur.core.* stand-ins so these run without
the App Engine stack.
Integration (real core) — integration/, no coverage gate:
pip install "viur-core>=3.8,<4" rsa pytest # NOT spltz-viur-light-mock
pip install --no-deps -e .
python -m pytest -c integration/pytest.ini integration
Runs the envelope + signature-parity tests against the real framework — the layer that catches mock-vs-core drift. See integration/README.md.
Coverage policy. The 100 % gate applies to the unit layer only. The integration layer runs without a coverage requirement — a coverage target there would pressure mocking the very framework it exists to exercise.
License
MIT — see LICENSE.
Metadata
Release files for spltz-viur-actions 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spltz_viur_actions-0.4.0.tar.gz | 35.0 kB | With provenance | Details for spltz_viur_actions-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spltz_viur_actions-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for spltz_viur_actions-0.4.0-py3-none-any.whl |
Total release size: 56.3 kB
Release files / spltz_viur_actions-0.4.0.tar.gz
| Download URL | spltz_viur_actions-0.4.0.tar.gz |
|---|---|
| Size | 35.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
605be8f2db9af76d648a8e493d81f1c82809c957449d8ed167656ee01d290e4f
|
|
BLAKE2b-256 checksum How to use checksums |
1a5e6e816c205d6a6410d84e11ca0d677e3a2a88d886e40b244aec955412b936
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency logRelease files / spltz_viur_actions-0.4.0-py3-none-any.whl
| Download URL | spltz_viur_actions-0.4.0-py3-none-any.whl |
|---|---|
| Size | 21.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ce26db3821ed05ec014552236599a3edd3a788500940180dd29d955feac3a9f
|
|
BLAKE2b-256 checksum How to use checksums |
39dedee9b86e6fa8e06f15bab5bb849140c346333edcdac414fabc784c828d31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency logSecurity for spltz-viur-actions 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for spltz_viur_actions-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.