Skip to content

Commit 8e7784e

Browse files
Releas/v0.9.1
Releas/v0.9.1
2 parents 3df6526 + 1d0e2d8 commit 8e7784e

70 files changed

Lines changed: 394 additions & 944 deletions

Some content is hidden

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

.cursor/rules/base_models.mdc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.cursor/rules/best_practices.mdc

Lines changed: 0 additions & 77 deletions
This file was deleted.

.cursor/rules/coding_standards.mdc

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
# Coding Standards & Best Practices
7+
8+
This document outlines the core coding standards, best practices, and quality control procedures for the codebase.
9+
10+
## Type Hints
11+
12+
1. **Always Use Type Hints**
13+
- Every function parameter must be typed
14+
- Every function return must be typed
15+
- Use type hints for all variables where type is not obvious
16+
- Use types with Uppercase first letter (Dict[], List[], etc.)
17+
18+
2. **StrEnum**
19+
- Import from `pipelex.types`:
20+
```python
21+
from pipelex.types import StrEnum
22+
```
23+
24+
## BaseModel Standards
25+
26+
- Respect Pydantic v2 standards
27+
- Keep models focused and single-purpose
28+
- Use descriptive field names
29+
- Use type hints for all fields
30+
- Document complex validations
31+
- Use Optional[] for nullable fields
32+
- Use Field(default_factory=...) for mutable defaults
33+
34+
## Factory Pattern
35+
36+
- Use Factory Pattern for object creation when dealing with multiple implementations
37+
38+
## Documentation
39+
40+
1. **Docstring Format**
41+
```python
42+
def process_image(image_path: str, size: Tuple[int, int]) -> bytes:
43+
"""Process and resize an image.
44+
45+
Args:
46+
image_path: Path to the source image
47+
size: Tuple of (width, height) for resizing
48+
49+
Returns:
50+
Processed image as bytes
51+
"""
52+
pass
53+
```
54+
55+
2. **Class Documentation**
56+
```python
57+
class ImageProcessor:
58+
"""Handles image processing operations.
59+
60+
Provides methods for resizing, converting, and optimizing images.
61+
"""
62+
```
63+
64+
## Error Handling
65+
66+
1. **Graceful Error Handling**
67+
- Use try/except blocks with specific exceptions
68+
- Convert third-party exceptions to custom ones
69+
```python
70+
try:
71+
from fal_client import AsyncClient as FalAsyncClient
72+
except ImportError as exc:
73+
raise MissingDependencyError(
74+
"fal-client", "fal",
75+
"The fal-client SDK is required to use FAL models."
76+
) from exc
77+
```
78+
79+
## Code Quality Checks
80+
81+
### Linting and Type Checking
82+
83+
Before finalizing a task, run:
84+
```bash
85+
make fix-unused-imports
86+
make check
87+
```
88+
89+
This runs multiple code quality tools:
90+
- Pyright: Static type checking
91+
- Ruff: Fast Python linter
92+
- Mypy: Static type checker
93+
94+
Always fix any issues reported by these tools before proceeding.
95+
96+
### Running Tests
97+
98+
1. **Quick Test Run** (no LLM/image generation):
99+
```bash
100+
make tp
101+
```
102+
Runs tests with markers: `(dry_runnable or not (inference or llm or imgg or ocr)) and not (needs_output or pipelex_api)`
103+
104+
2. **Specific Tests**:
105+
```bash
106+
make tp TEST=TestClassName
107+
# or
108+
make tp TEST=test_function_name
109+
```
110+
Note: Matches names starting with the provided string.
111+
112+
**Important**: Never run `make ti`, `make test-inference`, `make to`, `make test-ocr`, `make tg`, or `make test-imgg` - these use costly inference.
113+
114+
## Pipelines
115+
116+
- All pipeline definitions go in `pipelex/libraries/pipelines/`
117+
- Always validate pipelines after creation/edit with `make validate`.
118+
Iterate if there are errors.
119+
120+
## Project Structure
121+
122+
- **Pipelines**: `pipelex/libraries/pipelines/`
123+
- **Tests**: `tests/` directory
124+
- **Documentation**: `docs/` directory

.cursor/rules/llms.mdc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
2-
description:
3-
globs:
2+
globs: *.plx,*.toml
43
alwaysApply: false
54
---
65
# Rules to choose LLM models used in PipeLLMs.
@@ -39,7 +38,7 @@ Here is an example of using an llm_handle to specify which LLM to use in a PipeL
3938
```plx
4039
[pipe.hello_world]
4140
type = "PipeLLM"
42-
description = "Write text about Hello World."
41+
definition = "Write text about Hello World."
4342
output = "Text"
4443
llm = { llm_handle = "gpt-4o-mini", temperature = 0.9, max_tokens = "auto" }
4544
prompt_template = """
@@ -64,7 +63,7 @@ The interest is that these presets can be used to set the LLM choice in a PipeLL
6463
```plx
6564
[pipe.extract_invoice]
6665
type = "PipeLLM"
67-
description = "Extract invoice information from an invoice text transcript"
66+
definition = "Extract invoice information from an invoice text transcript"
6867
inputs = { invoice_text = "InvoiceText" }
6968
output = "Invoice"
7069
llm = "llm_to_extract_invoice"
@@ -81,4 +80,4 @@ The setting here `llm = "llm_to_extract_invoice"` works because "llm_to_extract_
8180
You must not use an LLM preset in a PipeLLM that does not exist in the deck. If needed, you can add llm presets.
8281

8382

84-
You can override the predefined llm presets in [overrides.toml](mdc:pipelex/libraries/llm_deck/overrides.toml).
83+
You can override the predefined llm presets in [overrides.toml](../../pipelex/libraries/llm_deck/overrides.toml).

.cursor/rules/pipe-batch.mdc

Lines changed: 0 additions & 32 deletions
This file was deleted.

.cursor/rules/pipe-condition.mdc

Lines changed: 0 additions & 52 deletions
This file was deleted.

.cursor/rules/pipe-func.mdc

Whitespace-only changes.

.cursor/rules/pipe-imgg.mdc

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)