Package: buildflow
⚒️ Build your entire system in minutes using pure Python. ⚒️📑 Resources📖Docs|   ⚡Quickstart|   👋Slack|   🌟Contribute|   🚀Deployment🤔 What is BuildFlow?BuildFlowis a Python framework that allows you to build your entire backend system using one framework. With our simple decorator pattern you can turn any function into a component of your backend system. Allowing you toserve data over HTTP, dump data to a datastore, or process async data from message queues. All of these can use our built in IO connectors allowing you to create, manage, and connect to your cloud resources using pure Python.Key FeaturesCommon Serving & Processing Patterns | 📖DocsTurn any function into a component of your backend system.# Serve traffic over HTTP or Websocketsservice=app.service("my-service")@service.endpoint("/",method="GET")defget():return"Hello World"# Collect, transform, and write data to storage@app.collector("/collect",method="POST",sink=SnowflakeTable(...))defcollect(request:Dict[str,Any]):returnelement# Process data from message queues such as Pub/Sub & SQS@app.consumer(source=SQSQueue(...),sink=BigQuery(...))defprocess(element:Dict[str,Any]):returnelementInfrastructure from Code | 📖DocsCreate and connect to cloud resources using python (powered byPulumi)# Use Python objects to define your infrastructuresqs_queue=SQSQueue("queue-name")gcs_bucket=GCSBucket("bucket-name")# Your application manages its own infrastructure stateapp.manage(s3_bucket,gcs_bucket)# Use the same resource objects in your application logic@app.consumer(source=sqs_queue,sink=gcs_bucket)defprocess(event:YourSchema)->OutputSchema:# Processing logic goes herereturnOutputSchema(...)Dependency Injection | 📖DocsInject any dependency with full control over its setup and lifecycle# Define custom dependencies@dependency(Scope.GLOBAL)classMyStringDependency:def__init__(self):self.my_string="HELLO!"# Or use the prebuilt dependenciesPostgresDep=SessionDepBuilder(postgres)# BuildFlow handles the rest@service.endpoint("/hello",method="GET")defhello(db:PostgresDep,custom_dep:MyStringDependency):withdb.sessionassession:user=session.query(User).first()# Returns "HELLO! User.name"returnf"{custom_dep.my_string}{user.name}"Async Runtime | 📖DocsScale out parallel tasks across your cluster withRayor any other async framework.@ray.remotedeflong_task(elem):time.sleep(10)returnelem@app.consumer(PubSubSubscription(...),BigQueryTable(...))defmy_consumer(elem):# Tasks are automatically parallelized across your clusterreturnawaitlong_task.remote(elem)⚙️ InstallationpipinstallbuildflowExtra DependenciesPulumi InstallationBuildFlow uses Pulumi to manage resources used by your application. To install Pulumi visit:https://www.pulumi.com/docs/install/Installing Pulumi unlocks:allows BuildFlow to manage resource creation and destructionfull access to Pulumi API / CLIfine-grained control over Pulumi Stacks & Resources🩺 Code Health ChecksWe useblackandruffwithpre-commithooks to perform health checks.
To setup these locally:Clone the repoInstall thedevdependencies likepython -m pip install -e .[dev]Check if pre-commit is installed correctly by runningpre-commit --versionSetup pre-commit to run before every commit on staged changes by runningpre-commit installPre-commit can also be ran manually aspre-commit run --all-files📜 LicenseBuildFlow is open-source and licensed under theApache License 2.0. We welcome contributions, see ourCONTRIBUTING.mdfile for details.