mpt-extension-contrib-phase-step
Shared provisioning-phase gating for SoftwareONE MPT extensions built on the Extension SDK. A step declares the single provisioning phase it runs for; when the order's phase parameter holds a different value the step is skipped and the pipeline records the skip, instead of the step deciding to no-op inside its own body.
It replaces ad-hoc phase checks inside individual extension steps with one reusable gating mechanism shared across pipelines.
See AGENTS.md for the module documentation map.
Install
pip install mpt-extension-contrib-phase-step
Requires the Extension SDK (mpt-extension-sdk >= 6.3, < 7), which is pulled in as a
dependency.
Public API
mpt_extension_contrib.phase_step exposes a base step, two functions, and one
settings contract:
| Object | Purpose |
|---|---|
PhaseGatedStep(expected_phases) |
Base step that runs only when the order phase is one of expected_phases (a phase or a list of phases); subclass and implement process(). |
require_phase(context, expected_phases) |
Guard for a hand-written pre(): skip the step unless the phase is one of expected_phases. |
advance_phase(context, phase) |
Persist a new phase on the order (and refresh the context) to move the flow forward; call it from process(). |
PhaseStepSettings |
Protocol describing the settings the API reads. |
Design in one line
The SDK already skips a step when its pre() raises SkipStepError (the
pipeline logs the skip and continues). This library adds only the missing
convention — read the phase parameter, compare, raise — as a function and a
thin base step, and keeps phase values and the parameter id out of the library.
No decorators or wrappers: gating is expressed by subclassing and, when needed,
an explicit await super().pre(context).
Usage
Expose the phase 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.phase_step import PhaseStepSettings
@dataclass(frozen=True)
class ExtensionSettings(BaseExtensionSettings, PhaseStepSettings):
phase_parameter: str = "phase"
@override
@classmethod
def load(cls) -> Self:
return cls()
Seed the phase before the first gated step: PhaseGatedStep.pre() runs before
process(), so a first step with an unset phase would skip before it could
initialize it. Set an initial value via a product default or an ungated
initializer step.
Gate a step by subclassing PhaseGatedStep and binding the phase when the
pipeline is composed:
from typing import override
from mpt_extension_sdk.pipeline import BasePipeline, BaseStep, OrderContext
from mpt_extension_contrib.phase_step import PhaseGatedStep
class CreateSubscription(PhaseGatedStep):
@override
async def process(self, context: OrderContext) -> None:
# runs only while the phase parameter equals the bound value
...
class PurchasePipeline(BasePipeline):
@property
def steps(self) -> list[BaseStep]:
return [
CreateSubscription("createSubscription"),
# ... more phase-gated steps ...
]
See Usage for a step that adds its own pre() guard and for
advancing the phase.
Documentation
- Usage — install, configure, gate steps, advance the phase
- Architecture
- Contributing
- Testing
- Releases
Metadata
Release files for mpt-extension-contrib-phase-step 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_phase_step-1.0.0.tar.gz | 8.7 kB | Without provenance | Details for mpt_extension_contrib_phase_step-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mpt_extension_contrib_phase_step-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mpt_extension_contrib_phase_step-1.0.0-py3-none-any.whl |
Total release size: 19.3 kB
Release files / mpt_extension_contrib_phase_step-1.0.0.tar.gz
| Download URL | mpt_extension_contrib_phase_step-1.0.0.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d782c292f0987d39e0a728473f5098c9017923be337707935f2a604e7a384d03
|
|
BLAKE2b-256 checksum How to use checksums |
a7c2642a821ab62a81d71dddc950dbc3790fe1645f4ed4b7f98e9aee71b83918
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","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_phase_step-1.0.0-py3-none-any.whl
| Download URL | mpt_extension_contrib_phase_step-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa48b3ea5c5172ecca1423f91db94123256975b9c1b46be0b49b8ccd4ccda137
|
|
BLAKE2b-256 checksum How to use checksums |
779cc09bf4bc3d1c68e87c99b995f527a2d9a1a75c1fafbe3367149f434ccdc2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.30 {"installer":{"name":"uv","version":"0.11.30","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-phase-step 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.