DSL enhancement proposal
See original GitHub issueAs discussed on Piter Py #5 in person. Here is the proposal discussed with @proofit404 .
Things which we do here:
- Wipe any realization from a
story_suite
decorated class - Use a story suite as a context container. Everything mentioned as steps arguments or results is a context member
- Allow defining some context members explicitly as class attributes, see
PurchaseProduct.payment_allowed
- Define all steps call signatures and a context member to store its result in
- Allow validating context members consistency using annotations
- Allow validating realization methods signatures in runtime using DI, see dry-python/dependencies
- Allow validating realization methods signatures in import time using a story suite class as a metaclass of the realization class similar to ABCMeta
import decimal
import stories
@stories.story_suite
class PurchaseProduct:
payment_allowed: bool
@stories.story
def purchase(self, user: User, product: Product, shipment_details: ShipmentDetails):
self.create_order()
self.calculate_price()
self.request_payment()
self.process_payment() if self.payment_allowed else self.reject_payment()
self.notify_user()
@stories.step
def create_order(
self, user: User, product: Product
) -> stories.Success["order", Order]:
...
@stories.step
def calculate_price(
self, order: Order
) -> stories.Success["price", decimal.Decimal]:
...
@stories.step
def request_payment(
self, user: User, order: Order
) -> stories.Success["payment_allowed", bool]:
...
@stories.step
def process_payment(
self, user: User, price: decimal.Decimal
) -> stories.Success["payment_result", PaymentResult]:
...
@stories.step
def reject_payment(
self, user: User
) -> stories.Success["payment_result", PaymentResult]:
...
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Mitigation - Department of State Lands - Oregon.gov
DSL uses a permit application process to document how a proposed project has reduced adverse effects to aquatic resources and how any unavoidable...
Read more >Create a schema for the new model DSL / data format · Issue #231 ...
This new DSL is already fairly thoroughly documented in Enhancement Proposal EP01 and we have a set of clojure.spec specs for the model...
Read more >Evolution discussion of the new DSL feature behind SwiftUI ...
... a new enhancement to the Swift language in the form a DSL that ... an evolution proposal document that describes the language...
Read more >Uni-DSL™: One DSL for Universal Service. - Texas Instruments
Uni-DSL – One DSL for Universal Service – is a new DSL delivery platform proposed by TI and enabled by TI's next-generation DSL...
Read more >DQS: DSL Quality Management techniques and nomenclature
[9] G.998.4. Improved impulse noise protection for DSL transceivers. ITU-T. 2010. [10] TR-100. ADSL2/ADSL2plus Performance Test Plan. BBF.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I and @sobolevn agreed that some logic in the type hints isn’t the right choice for this library.
Other things listed here are pretty useful. We will implement them eventually but in a different form.
I’ve decided to spit this report into several issues to work on each separately:
@proofit404 shall we build something in public as a POC maybe?