Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Guará

PyPI Downloads

Guará is a Python framework for business logic expression. It allows you to write production code and tests as executable domain language, combining:

  • Business Logic Language → expresses domain behavior using Ubiquitous Language (DDD)
  • Test Framework → orchestrates scenarios using Given / When / Then

Instead of focusing only on technical assertions, Guará enables you to describe business scenarios as code, making production code and tests readable by developers and domain experts.

Core Idea

Guará turns code into business narratives:

  • Transactions → represent actions (use cases)
  • Assertions (it) → represent business expectations
  • Application DSL → orchestrates flows in domain language

Syntax

Application.when(DoSomething [,with_parameter=value, ...]).expects(it.Matches, a_condition)

Example in Action

Modeling

from guara.application import Application
from guara import it
from transactions import HasBalance, BuyAsset, UpdatePortfolio


def main():
    finance_app = Application()
    (
        finance_app.given(HasBalance)
        .when(BuyAsset, symbol="AAPL", amount=2000)
        .and_(UpdatePortfolio)
        .expects(it.IsEqualTo, 20)
    )

UI Testing

from guara.application import Application
from guara import it
from selenium import webdriver
from transactions import OpenApp, ChangeToPortuguese, NavigateToInfoPage, CloseApp


def test_sample_web_page():
    app = Application(webdriver.Chrome())
    app.given(OpenApp, url="https://anyhost.com/")
    app.when(ChangeToPortuguese).expects(it.IsEqualTo, CONTENT_IN_PORTUGUESE)
    app.when(NavigateToInfoPage).then(it.Contains, "This project was born")
    app.execute(CloseApp)

Documentation

For more information, check: https://guara.readthedocs.io/en/latest/

Metadata

Release files for guara 0.0.26rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for guara 0.0.26rc3
File Size Uploaded
guara-0.0.26rc3.tar.gz 921.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for guara 0.0.26rc3
File Interpreter ABI Platform
guara-0.0.26rc3-py3-none-any.whl Python 3 none any Details

Total release size: 945.7 kB

Release files / guara-0.0.26rc3.tar.gz

Download URL guara-0.0.26rc3.tar.gz
Size 921.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cf39d58fb586903ef0dce383008da4de2df0f350193ccf3b922b4fc2bb4e59d3
BLAKE2b-256 checksum
How to use checksums
e559940181dccf6d0bf9c7724f7eda46352b6928395b7f3e9d2e380d0ec19417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / guara-0.0.26rc3-py3-none-any.whl

Download URL guara-0.0.26rc3-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d3f11892deefa93e0264bc80720fce7ad2d457f66fd36ca850428d1fecf1b8a
BLAKE2b-256 checksum
How to use checksums
94594be9495e4c05f219f0e83732a64d07302123860143768d8637881747596f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page