GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — dry-python.github.io/docs/index.md at develop · dry-python/dry-python.github.io

Expand file tree

/

index.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
72 lines (50 loc) · 1.95 KB
/

index.md

Copy path

File metadata and controls

72 lines (50 loc) · 1.95 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

logo


A set of libraries for pluggable business logic components

The easiest way to make your code simple to reason about.

dry-python is a collection of libraries aimed to help you to build an application in your domain.

Stories

You can define business logic processes with clear DSL.

>>> from stories import story, arguments

>>> class BuySubscription:
...     @story
...     @arguments("price_id", "user")
...     def buy(I):
...         I.find_price
...         I.check_balance
...         I.persist_payment
...         I.persist_subscription
...         I.send_subscription_notification
...         I.show_category

Dependencies

You can integrate it into frameworks you already use.

>>> from dependencies import Injector, operation, this
>>> from dependencies.contrib.django import view
>>> from django.http import HttpResponse
>>> from django.shortcuts import redirect

>>> @view
... class BuySubscriptionView(Injector):
...     buy_subscription = workflows.BuySubscription.buy
...     price_id = this.kwargs["id"]
...
...     @operation
...     def post(buy_subscription, price_id, user):
...         result = buy_subscription.run(price_id, user)
...         if result.is_success:
...             return redirect(result.value)
...         elif result.failed_on("check_balance"):
...             return HttpResponse("<h1>Error: not enough money</h1>")

And a framework of your choice will not even notice the change.

>>> from app.views import BuySubscriptionView

>>> urlpatterns = [
...     path("buy_subscription/<int:id>/", BuySubscriptionView.as_view()),
... ]

— ⭐️ —

Drylabs maintains dry-python and helps those who want to use it inside their organizations.

Read more at drylabs.io

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.