Skip to content

Commit bfd8764

Browse files
authored
[v0.1] Add pre-merge lint check and lint all existing code
Feat/lint workflow
2 parents aface4c + a078003 commit bfd8764

82 files changed

Lines changed: 2133 additions & 2526 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.10"
21+
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install ruff
26+
27+
- name: Check for linting errors
28+
run: |
29+
ruff check .
30+
31+
- name: Check formatting
32+
run: |
33+
ruff format --check .

bin/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# todo: client wrapper
1+
# todo: client wrapper

bin/server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import sys
22
from pathlib import Path
3+
34
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
45
sys.path.insert(0, str(Path(__file__).parent.parent))
56

7+
from examples.simple_stock import StockWorkflow
8+
69
from concierge.core.registry import register_workflow
710
from concierge.server import start_server
8-
9-
from examples.simple_stock import StockWorkflow
1011
from examples.zillow.workflow import ZillowWorkflow
1112

1213
# Example code, not invoked through concierge serve.
1314
if __name__ == "__main__":
1415
register_workflow(StockWorkflow)
1516
register_workflow(ZillowWorkflow)
16-
17-
start_server()
1817

18+
start_server()

examples/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
"""Concierge Examples Package"""
2-

examples/ecommerce/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from .workflow import EcommerceWorkflow
22

33
__all__ = ["EcommerceWorkflow"]
4-

examples/ecommerce/workflow.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from concierge.core import workflow, stage, task, State
1+
from concierge.core import State, stage, task, workflow
22

33

44
@stage(name="discovery")
55
class DiscoveryStage:
66
@task(description="Search for products by keyword")
77
def search_products(self, state: State, query: str) -> dict:
88
return {"results": []}
9-
9+
1010
@task(description="Filter by price range")
1111
def filter_by_price(self, state: State, min_price: float, max_price: float) -> dict:
1212
return {"filtered_count": 0}
@@ -17,7 +17,7 @@ class ProductStage:
1717
@task(description="View product details")
1818
def view_details(self, state: State, product_id: str) -> dict:
1919
return {"product": {}}
20-
20+
2121
@task(description="Read customer reviews")
2222
def read_reviews(self, state: State, product_id: str) -> dict:
2323
return {"reviews": []}
@@ -28,11 +28,11 @@ class CartStage:
2828
@task(description="Add item to cart")
2929
def add_to_cart(self, state: State, product_id: str, quantity: int) -> dict:
3030
return {"cart_size": 1}
31-
31+
3232
@task(description="Update quantity")
3333
def update_quantity(self, state: State, product_id: str, quantity: int) -> dict:
3434
return {"updated": True}
35-
35+
3636
@task(description="Remove item from cart")
3737
def remove_item(self, state: State, product_id: str) -> dict:
3838
return {"removed": True}
@@ -43,7 +43,7 @@ class CheckoutStage:
4343
@task(description="Apply coupon code")
4444
def apply_coupon(self, state: State, code: str) -> dict:
4545
return {"discount": 0}
46-
46+
4747
@task(description="Complete purchase")
4848
def complete_purchase(self, state: State) -> dict:
4949
return {"order_id": "ORD123"}
@@ -55,11 +55,5 @@ class EcommerceWorkflow:
5555
product = ProductStage
5656
cart = CartStage
5757
checkout = CheckoutStage
58-
59-
transitions = {
60-
discovery: [product, cart],
61-
product: [cart, discovery],
62-
cart: [checkout, discovery],
63-
checkout: []
64-
}
6558

59+
transitions = {discovery: [product, cart], product: [cart, discovery], cart: [checkout, discovery], checkout: []}

examples/food_delivery/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from .workflow import FoodDeliveryWorkflow
22

33
__all__ = ["FoodDeliveryWorkflow"]
4-

examples/food_delivery/workflow.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from concierge.core import workflow, stage, task, State
1+
from concierge.core import State, stage, task, workflow
22

33

44
@stage(name="restaurants")
55
class RestaurantsStage:
66
@task(description="Search restaurants by cuisine")
77
def search_restaurants(self, state: State, cuisine: str, location: str) -> dict:
88
return {"restaurants": []}
9-
9+
1010
@task(description="Filter by rating or delivery time")
1111
def filter_restaurants(self, state: State, min_rating: float) -> dict:
1212
return {"filtered": []}
@@ -17,11 +17,11 @@ class MenuStage:
1717
@task(description="View restaurant menu")
1818
def view_menu(self, state: State, restaurant_id: str) -> dict:
1919
return {"menu_items": []}
20-
20+
2121
@task(description="Add item to order")
2222
def add_item(self, state: State, item_id: str, quantity: int) -> dict:
2323
return {"order_size": 1}
24-
24+
2525
@task(description="Customize item")
2626
def customize_item(self, state: State, item_id: str, modifications: list) -> dict:
2727
return {"customized": True}
@@ -32,7 +32,7 @@ class CartStage:
3232
@task(description="Review order and total")
3333
def review_order(self, state: State) -> dict:
3434
return {"total": 0, "items": []}
35-
35+
3636
@task(description="Apply promo code")
3737
def apply_promo(self, state: State, code: str) -> dict:
3838
return {"discount": 0}
@@ -43,7 +43,7 @@ class CheckoutStage:
4343
@task(description="Set delivery instructions")
4444
def set_instructions(self, state: State, instructions: str) -> dict:
4545
return {"saved": True}
46-
46+
4747
@task(description="Place order")
4848
def place_order(self, state: State) -> dict:
4949
return {"order_id": "DD123", "eta": 30}
@@ -55,11 +55,5 @@ class FoodDeliveryWorkflow:
5555
menu = MenuStage
5656
cart = CartStage
5757
checkout = CheckoutStage
58-
59-
transitions = {
60-
restaurants: [menu],
61-
menu: [cart, restaurants],
62-
cart: [checkout, menu],
63-
checkout: []
64-
}
6558

59+
transitions = {restaurants: [menu], menu: [cart, restaurants], cart: [checkout, menu], checkout: []}

examples/payment/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from .workflow import PaymentWorkflow
22

33
__all__ = ["PaymentWorkflow"]
4-

examples/payment/workflow.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from concierge.core import workflow, stage, task, State
1+
from concierge.core import State, stage, task, workflow
22

33

44
@stage(name="transaction")
55
class TransactionStage:
66
@task(description="Create payment request")
77
def create_payment(self, state: State, amount: float, recipient: str) -> dict:
88
return {"payment_id": "PAY123"}
9-
9+
1010
@task(description="Request money")
1111
def request_money(self, state: State, amount: float, recipient: str, note: str) -> dict:
1212
return {"request_id": "REQ123"}
@@ -17,11 +17,11 @@ class ReviewStage:
1717
@task(description="Review payment details")
1818
def review_payment(self, state: State) -> dict:
1919
return {"details": {}}
20-
20+
2121
@task(description="Add payment note")
2222
def add_note(self, state: State, note: str) -> dict:
2323
return {"saved": True}
24-
24+
2525
@task(description="Select funding source")
2626
def select_source(self, state: State, source: str) -> dict:
2727
return {"source": source}
@@ -32,7 +32,7 @@ class VerificationStage:
3232
@task(description="Verify with 2FA code")
3333
def verify_2fa(self, state: State, code: str) -> dict:
3434
return {"verified": True}
35-
35+
3636
@task(description="Verify with biometric")
3737
def verify_biometric(self, state: State) -> dict:
3838
return {"verified": True}
@@ -43,7 +43,7 @@ class ConfirmationStage:
4343
@task(description="Confirm and send payment")
4444
def confirm_payment(self, state: State) -> dict:
4545
return {"transaction_id": "TXN123", "status": "completed"}
46-
46+
4747
@task(description="Cancel payment")
4848
def cancel_payment(self, state: State) -> dict:
4949
return {"cancelled": True}
@@ -55,11 +55,10 @@ class PaymentWorkflow:
5555
review = ReviewStage
5656
verification = VerificationStage
5757
confirmation = ConfirmationStage
58-
58+
5959
transitions = {
6060
transaction: [review],
6161
review: [verification, transaction],
6262
verification: [confirmation],
63-
confirmation: []
63+
confirmation: [],
6464
}
65-

0 commit comments

Comments
 (0)