mpt-extension-contrib-due-date
Shared order processing due-date helpers for SoftwareONE MPT extensions built on the Extension SDK. The library sets a maximum date by which an order must be processed and fails the order once that date passes, so orders never hang in processing forever.
It replaces the per-extension due-date logic previously re-implemented in the Adobe and FinOps extensions.
See AGENTS.md for the module documentation map.
Install
pip install mpt-extension-contrib-due-date
Requires the Extension SDK (mpt-extension-sdk >= 6.3, < 7), which is pulled in as a
dependency.
Public API
mpt_extension_contrib.due_date exposes three pipeline steps and one settings
contract:
| Object | Purpose |
|---|---|
SetDueDate(days=N) |
Set today + N days as the due date and persist it (once). |
EnforceDueDate() |
Fail the order when its due date has been reached. |
ResetDueDate() |
Clear the due date, e.g. before completing the order. |
DueDateSettings |
Protocol describing the settings the steps read. |
Usage
Expose the due-date parameter external id in the extension settings:
from dataclasses import dataclass
from typing import Self, override
from mpt_extension_sdk.settings.extension import BaseExtensionSettings
from mpt_extension_contrib.due_date import DueDateSettings
@dataclass(frozen=True)
class ExtensionSettings(BaseExtensionSettings, DueDateSettings):
due_date_parameter: str = "dueDate"
@override
@classmethod
def load(cls) -> Self:
return cls()
Add the steps to an order pipeline:
from mpt_extension_sdk.pipeline import BasePipeline, BaseStep
from mpt_extension_contrib.due_date import EnforceDueDate, ResetDueDate, SetDueDate
class PurchasePipeline(BasePipeline):
@property
def steps(self) -> list[BaseStep]:
return [
SetDueDate(days=14), # assign the deadline on first run
EnforceDueDate(), # fail the order once the deadline passes
# ... order processing steps ...
ResetDueDate(), # clear the deadline before completing
]
The steps read the parameter external id from
context.ext_settings.due_date_parameter and the deadline length from
SetDueDate(days=...).
EnforceDueDate does not fail the order itself: it records the intent on
context.order_state.action and raises DueDateReachedError (a StopStepError
subclass). Following the SDK pipeline-hooks contract, the order is failed by the
extension's pipeline in an on_step_stopped / on_step_failed hook:
from mpt_extension_sdk.errors.step import StopStepError
from mpt_extension_sdk.pipeline import BasePipeline, OrderStatusActionType
from mpt_extension_contrib.due_date import DueDateReachedError
class OrderPipeline(BasePipeline):
async def on_step_stopped(self, step, ctx, error: StopStepError) -> None:
await super().on_step_stopped(step, ctx, error)
action = ctx.order_state.action
if action and not ctx.order_state.handled:
if action.target_status == OrderStatusActionType.FAIL:
await ctx.mpt_api_service.orders.fail(ctx.order_id, action.status_notes)
ctx.order_state.handled = True
The hook above applies any declared action generically. When you need
due-date-specific handling (a notification, a metric, a distinct status note),
identify it by the exception type — isinstance(error, DueDateReachedError) —
since several steps may raise StopStepError in the same pipeline.
Documentation
Metadata
Release files for mpt-extension-contrib-due-date 1.0.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 |
|---|---|---|---|---|
| mpt_extension_contrib_due_date-1.0.0.tar.gz | 8.6 kB | Without provenance | Details for mpt_extension_contrib_due_date-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mpt_extension_contrib_due_date-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mpt_extension_contrib_due_date-1.0.0-py3-none-any.whl |
Total release size: 19.1 kB
Release files / mpt_extension_contrib_due_date-1.0.0.tar.gz
| Download URL | mpt_extension_contrib_due_date-1.0.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a81d6d3d9302782b0fd3d6eebb1acdf70edd239176fe2bb6ecaf33e904a988ea
|
|
BLAKE2b-256 checksum How to use checksums |
0e20acfe92657e0606982038985f075fe3db1633c36674e695e2c57ce79d6362
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mpt_extension_contrib_due_date-1.0.0-py3-none-any.whl
| Download URL | mpt_extension_contrib_due_date-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5936976acdd6d365d465e8420b4d38268950a013e5e4900e9117bdc47d1f87b8
|
|
BLAKE2b-256 checksum How to use checksums |
1e05f18ec6b7a54826d3d61c24f0dd1cc71addbbc8c6d3941d9e3388a62fbb3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for mpt-extension-contrib-due-date 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.