Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0 #1

Merged
merged 16 commits into from
Feb 9, 2024
Merged

V0 #1

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: documentation

on:
push:
branches:
- main # Triggers the workflow on push events to the main branch

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install dependencies
run: |
pip install -e ".[documentation]"
- name: Sphinx build
run: |
sphinx-build docs _build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/initial-prototypes' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
21 changes: 14 additions & 7 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ name: Build Burr

on:
push:
branches: [ "main" ]
branches:
- main # Triggers the workflow on push events to the main branch
pull_request:
branches: [ "main" ]
# Triggers the workflow on pull request events for any branch
types: [opened, synchronize, reopened]

jobs:
build:

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -26,7 +33,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -e .
- name: Run test
python -m pip install -e ".[tests]"
- name: Run tests
run: |
python test.py
python -m pytest tests
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
#
_build
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# pre-commit hooks require a user to have installed `pre-commit`:
# $ brew install pre-commit
# Then install the hooks within the repo:
# $ cd /PATH/TO/REPO
# $ pre-commit install

repos:
- repo: https://github.com/ambv/black
rev: 23.11.0
hooks:
- id: black
args: [--line-length=100]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
# ensures files are either empty or end with a blank line
- id: end-of-file-fixer
# sorts requirements
- id: requirements-txt-fixer
# valid python file
- id: check-ast
# isort python package import sorting
- repo: https://github.com/pycqa/isort
rev: '5.12.0'
hooks:
- id: isort
args: ["--profile", "black", "--line-length=100", "--known-local-folder", "tests", "-p", "hamilton"]
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
23 changes: 23 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[style]
based_on_style = google

# max characters per line
COLUMN_LIMIT = 100

# Put closing brackets on a separate line, dedented, if the bracketed expression can't fit in a single line
DEDENT_CLOSING_BRACKETS = true

# Place each dictionary entry onto its own line.
EACH_DICT_ENTRY_ON_SEPARATE_LINE = true

# Join short lines into one line. E.g., single line if statements.
JOIN_MULTIPLE_LINES = true

# Insert a blank line before a def or class immediately nested within another def or class
BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = true

# Split before arguments if the argument list is terminated by a comma.
SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED = true

# If an argument / parameter list is going to be split, then split before the first argument
SPLIT_BEFORE_FIRST_ARGUMENT = true
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) 2023-2023 DAGWorks Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted
(subject to the limitations in the disclaimer below) provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of Stitch Fix, DAGWorks, nor the names of its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY
THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,42 @@
# burr
Make Hamilton go Burr...
# Burr

## What is Burr?

Burr is a state machine for data/AI projects. You can (and should!) use it for anything where managing state can be hard. Hint: managing state
is always hard!

You can find the documentation [here](https://studious-spork-n8kznlw.pages.github.io/).
## What can you do with Burr?

Burr can be used for a variety of applications. Burr can build a state machine to orchestrate, express, and track:

1. [A gpt-like chatbot](examples/gpt)
2. [A machine learning pipeline](examples/ml_training)
3. [A trading simulation](examples/simulation)

And a lot more!

Using hooks and other integrations you can (a) integrate with any of your favorite vendors (LLM observability, storage, etc...), and
(b) build custom actions that delegate to your favorite libraries.

Bur will *not* tell you how to build your models, how to query APIs, or how to manage your data. It will help you tie all these together
in a way that scales with your needs and makes following the logic of your system easy.


## Why the name Burr?

Burr is named after Aaron Burr, founding father, third VP of the United States, and murderer/arch-nemesis of Alexander Hamilton.
We imagine a world in which Burr and Hamilton lived in harmony and saw through their differences. We originally
built Burr as a _harness_ to handle state between executions of Hamilton DAGs,
but realized that it has a wide array of applications and decided to release it.

# Getting Started

To get started, install from `pypi`, using your favorite package manager:

```
pip install burr
```

Next, see the documentation for [getting started](https://studious-spork-n8kznlw.pages.github.io/getting_started/simple-example.html), and follow the example.
Then read through some of the concepts and write your own application!
Empty file added burr/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions burr/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from burr.core.action import Action, Condition, Result, action, default, expr, when
from burr.core.application import Application, ApplicationBuilder
from burr.core.state import State

__all__ = [
"action",
"Action",
"Application",
"ApplicationBuilder",
"Condition",
"default",
"expr",
"Result",
"State",
"when",
]
Loading
Loading