Skip to content

Commit 8fbbd5d

Browse files
Merge pull request Pipelex#107 from Pipelex/dev
dev to release/v0.4.4
2 parents ea6e9eb + 5b8d18b commit 8fbbd5d

58 files changed

Lines changed: 805 additions & 337 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/best_practices.mdc

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
# Best Practices Guide
7+
8+
This document outlines the core best practices and patterns used in our 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+
17+
2. **StrEnum**
18+
- Import StrEnum from pipelex.types
19+
```python
20+
from pipelex.types import StrEnum
21+
22+
class ModelType(StrEnum):
23+
GPT4 = "gpt-4"
24+
GPT35 = "gpt-3.5-turbo"
25+
```
26+
27+
## Factory Pattern
28+
29+
1. **Use Factory Pattern for Object Creation**
30+
- Create factories when dealing with multiple implementations
31+
32+
## Documentation
33+
34+
1. **Docstring Format**
35+
- Quick description of the function/class
36+
- List args and their types
37+
- Document return values
38+
- Example:
39+
```python
40+
def process_image(image_path: str, size: Tuple[int, int]) -> bytes:
41+
"""Process and resize an image.
42+
43+
Args:
44+
image_path: Path to the source image
45+
size: Tuple of (width, height) for resizing
46+
47+
Returns:
48+
Processed image as bytes
49+
"""
50+
pass
51+
```
52+
53+
2. **Class Documentation**
54+
- Document class purpose and behavior
55+
- Include examples if complex
56+
```python
57+
class ImageProcessor:
58+
"""Handles image processing operations.
59+
60+
Provides methods for resizing, converting, and optimizing images.
61+
"""
62+
```
63+
64+
## Custom Exceptions
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+
```

.cursor/rules/pipes.mdc

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,9 @@ alwaysApply: false
55
---
66
This rule explains how to build pipes.
77

8-
# File Naming & Structure
9-
10-
## The pipelines/ directory
11-
12-
- Pipelines and structures are defined in the `pipelex/libraries/pipelines` directory
13-
14-
pipelex/libraries
15-
└── pipelines
16-
178
## Pipeline file naming
189

19-
- Pipeline TOML files should be placed in the `pipelex/libraries/pipelines/` directory or a subdirectory of it
2010
- The file name should be descriptive, in snake_case and end with `.toml`
21-
- The file should contain both concepts and pipes definitions
2211

2312
## Pipeline file structure
2413

@@ -167,7 +156,6 @@ Your summary should not be longer than 2 sentences.
167156
PipeLLM = "Convert table screenshot to HTML"
168157
inputs = { table_screenshot = "TableScreenshot" }
169158
output = "HtmlTable"
170-
images = ["table_screenshot"]
171159
system_prompt = """
172160
You are a vision-based table extractor.
173161
"""

.cursor/rules/pytest.mdc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ These rules apply when writing unit tests.
1717
- More precisely, for `pipelex` and `pipelex.cogt` the async tests are placed inside subdirectories named `cogt_asynch` and `pipelex_asynch`
1818
- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest
1919
- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `tests.pipelex.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.
20+
- Always put test inside Test classes.
21+
- The pipelex pipelines should be stored in `tests/test_pipelines` as well as the related structured Output classes that inherit from `StructuredContent`
2022

2123
## Markers
2224

.cursor/rules/standards.mdc

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
# Coding Standards
7+
8+
This document outlines the coding standards and quality control procedures that must be followed when contributing to this project.
9+
10+
## Code Quality Checks
11+
12+
### Linting and Type Checking
13+
14+
Before finalizing a task, you must run the following command to check for linting issues, type errors, and code quality problems:
15+
16+
```bash
17+
make check
18+
```
19+
20+
This command runs multiple code quality tools:
21+
- Pyright: Static type checking
22+
- Ruff: Fast Python linter
23+
- Mypy: Static type checker
24+
25+
Always fix any issues reported by these tools before proceeding.
26+
27+
### Running Tests
28+
29+
We have several make commands for running tests:
30+
31+
1. `make tp`: Runs all tests with these markers:
32+
```
33+
(dry_runnable or not (inference or llm or imgg or ocr)) and not (needs_output or pipelex_api)
34+
```
35+
Use this for quick test runs that don't require LLM or image generation.
36+
37+
2. `make ti`: Runs all tests with these markers:
38+
```
39+
inference and not imgg
40+
```
41+
Use this for testing LLM functionality without image generation.
42+
43+
3. To run specific tests:
44+
```bash
45+
make tp TEST=TestClassName
46+
# or
47+
make tp TEST=test_function_name
48+
```
49+
It matches names, so `TEST=test_function_name` is going to run all test with the function name that STARTS with `test_function_name`.
50+
51+
## Important Project Directories
52+
53+
### Pipelines Directory
54+
- All pipeline definitions go in `pipelex/libraries/pipelines/`
55+
56+
### Tests Directory
57+
- All tests are located in the `tests/` directory
58+
59+
### Documentation Directory
60+
- All documentation is located in the `docs/` directory

.cursor/rules/structures.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ Structure classes defined within `pipelex_libraries/pipelines/` are automaticall
5959
- Use Pydantic validators for data cleaning/validation
6060
- Remove timezone info from datetime fields
6161
- Respect rules of @base_models.
62+

.cursor/rules/tdd.mdc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
# Test-Driven Development Guide
7+
8+
This document outlines our test-driven development (TDD) process and the tools available for testing.
9+
10+
## TDD Cycle
11+
12+
1. **Write a Test First**
13+
[pytest.mdc](mdc:.cursor/rules/pytest.mdc)
14+
15+
2. **Write the Code**
16+
- Implement the minimum amount of code needed to pass the test
17+
- Follow the project's coding standards
18+
- Keep it simple - don't write more than needed
19+
20+
3. **Run Linting and Type Checking**
21+
[standards.mdc](mdc:.cursor/rules/standards.mdc)
22+
23+
4. **Refactor if needed**
24+
If the code needs refactoring, with the best practices [best_practices.mdc](mdc:.cursor/rules/best_practices.mdc)
25+
26+
5. **Validate tests**
27+
28+
Remember: The key to TDD is writing the test first and letting it drive your implementation. Always run the full test suite and quality checks before considering a feature complete.

.github/workflows/guard-branches.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
if [[ "$HEAD" == "dev" ]]; then
3737
exit 0
3838
fi
39-
if [[ ! "$HEAD" =~ ^(fix|feature|refactor|chore|doc|ci-cd|changelog|codex)\/[A-Za-z0-9._\/\<\>\=\-]+$ ]]; then
39+
if [[ ! "$HEAD" =~ ^(fix|feature|refactor|chore|docs|ci-cd|changelog|codex)\/[A-Za-z0-9._\/\<\>\=\-]+$ ]]; then
4040
echo "::error::Branch must start with fix/, feature/, refactor/, chore/, docs/, or ci-cd/."
4141
exit 1
4242
fi

CHANGELOG.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [v0.4.4] - 2025-06-20
4+
5+
### Fixed
6+
- Changed the allowed base branch names in the GHA `guard-branches.yml`: `doc` -> `docs`
7+
- Fixed `kajson` dependency (see [kajson v0.1.6 changelog](https://github.com/Pipelex/kajson/blob/main/CHANGELOG.md))
8+
9+
### Cursor rules
10+
- Added Cursor rules for coding best practices and standards (including linting methods). Added TDD (Test Driven Development) rule on demand.
11+
- Various changes
12+
13+
### Documentation
14+
- Added documentation for referencing images in PipeLLM.
15+
- Fixed typos
16+
17+
### Refactor
18+
- Removed the `images` field from PipeLLM - images can now be referenced directly in the `inputs`
19+
- Moved the list-pipes CLI function to the `PipeLibrary` class.
20+
321
## [v0.4.3] - 2025-06-19
422

523
### Fixed
@@ -35,9 +53,9 @@
3553
- Added GHA workflows for documentation deployment and validation
3654
- **Added to docs:**
3755
- [**Manifesto**](https://docs.pipelex.com/manifesto/) explaining the Pipelex viewpoint
38-
- [**The Pipelex Paradigm**](https://docs.pipelex.com/pages/pipelex-paradigm-for-repeatable-ai-workflows/) explaining the fundamentals of Pipelexs solution
56+
- [**The Pipelex Paradigm**](https://docs.pipelex.com/pages/pipelex-paradigm-for-repeatable-ai-workflows/) explaining the fundamentals of Pipelex's solution
3957
- [**Cookbook examples](https://docs.pipelex.com/pages/cookbook-examples/)** presented and explained, commented code, some event with [mermaid](https://docs.pipelex.com/pages/cookbook-examples/invoice-extractor/) [flow](https://docs.pipelex.com/pages/cookbook-examples/extract-gantt/) [charts](https://docs.pipelex.com/pages/cookbook-examples/write-tweet/)
40-
- And plenty of details about **using Pipelex** and **developing for Pipelex,** from **structured generation** to PipeOperators (**LLM**, **Image generation**, **OCR**…) to PipeControllers (**Sequence**, **Parallel**, **Batch**, **Condition**…), workflow **optimization**, workflow static **validation** and dry run… theres still work to do, but we move fast!
58+
- And plenty of details about **using Pipelex** and **developing for Pipelex,** from **structured generation** to PipeOperators (**LLM**, **Image generation**, **OCR**…) to PipeControllers (**Sequence**, **Parallel**, **Batch**, **Condition**…), workflow **optimization**, workflow static **validation** and dry run… there's still work to do, but we move fast!
4159
- **Also a major update of Cursor rules**
4260

4361
### Tooling Improvements

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ We are open to contributions in all areas of our core Pipelex library:
1212
- **Feature**: New API, CLI flag, module, test coverage
1313
- **Refactor**: Rethink architecture
1414
- **Chore**: Dependency updates, config tweaks, file renames
15-
- **Doc**: Main docs, SWE Agent rules, tutorials, examples, READMEs
15+
- **Docs**: Main docs, SWE Agent rules, tutorials, examples, READMEs
1616
- **CI/CD**: GitHub Actions, packaging, release tooling
1717

1818
## Contribution process
@@ -22,7 +22,7 @@ We are open to contributions in all areas of our core Pipelex library:
2222
- Install dependencies: `make install` (creates .venv and installs dependencies)
2323
- Copy `.env.example` to `.env` and fill in required API keys (at least OpenAI)
2424
- Run checks to make sure all is good: `make check` & `make test`
25-
- Create a branch with the format user_name/category/short_slug where category is one of: `feature`, `fix`, `refactor`, `doc`, `cicd` or `chore`
25+
- Create a branch with the format user_name/category/short_slug where category is one of: `feature`, `fix`, `refactor`, `docs`, `cicd` or `chore`
2626
- Make and commit changes
2727
- Push your local branch to your fork
2828
- Open a PR that [links to an existing Issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) which does not include the `needs triage` label

0 commit comments

Comments
 (0)