Skip to main content

Placeholder package scaffold for BusinessOgre

Project description

BusinessOgre

Business Ogre is a business abstraction layer that neatens workflows in your code, forces self-documentation, and simplifies interaction with stakeholders.

Example usage of Workflow and WorkflowBlock classes:

The key to using business ogre is defining the code blocks. These are classes that inherit from the WorkflowBlock class, and add some cool functionality.

from business_ogre.workflow import WorkflowBlock

# Define some example WorkflowBlocks
class MakeTextUppercase(WorkflowBlock):
    input_type = (str,)  # Required for validation
    output_type = (str,) # Required for validation

    # This is the actual action that is happening in your block.
    def action(self, input_data: str) -> str:
        return input_data.upper()

# Creating one more:
class AddExclamation(WorkflowBlock):
    input_type = (str,)
    output_type = (str,)

    def action(self, input_data: str) -> str:
        return input_data + '!'

Next you need to instantiate the blocks:

# Instantiating each block:
make_uppercase_step = MakeTextUppercase('Uppercase')
add_exclamation_step = AddExclamation('Add Exclamation')

Now that the blocks are instantiated, you can create pipelines using the >> operator.

# Using the >> operator joins the blocks into a workflow
excited_workflow = MakeTextUppercase('Uppercase') >> AddExclamation('Add Exclamation')

You can treat excited_workflow like you would a function.

# excited_workflow is callable, inputs will consecutively pass through the blocks:
excited_workflow('A piece of test text')
>>> 'A PIECE OF TEST TEXT!'

str(excited_workflow)
>>> "Workflow(steps='Uppercase >> Add Exclamation')"

Here is how you check that all the blocks match up:

# Check that the output type of each step matches the input type of the next step.
# Raises an error if there is a mismatch, otherwise returns True.
excited_workflow.validate()
>>> True

Because the flows are callable, they can easily be passed to frontend code that requires a single, neat callable.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

business_ogre-0.0.3.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

business_ogre-0.0.3-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file business_ogre-0.0.3.tar.gz.

File metadata

  • Download URL: business_ogre-0.0.3.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for business_ogre-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1c39ad54c86d038cce574c8fbaa6e85ea5fb2059568591c29374a6a280f49883
MD5 2a5ff51c9e3f6e43bc0b5d75f4e291ad
BLAKE2b-256 8d9b990da44abec55fb49b850167b12aabf2b1cfdfe941c7f380d2ef371c19dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for business_ogre-0.0.3.tar.gz:

Publisher: publish-pypi.yml on pjachim/BusinessOgre

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file business_ogre-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: business_ogre-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for business_ogre-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 317287119789feed8ab411bbecb06489877d1b9c67dff82bc6afabe4f59fbc5e
MD5 ea5f8331445ad15ccf0c5940bb848291
BLAKE2b-256 656907a7720c8a28e7ccd7d592a32f4e82b053a28a22a664f3006c248b7ef820

See more details on using hashes here.

Provenance

The following attestation bundles were made for business_ogre-0.0.3-py3-none-any.whl:

Publisher: publish-pypi.yml on pjachim/BusinessOgre

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page