|
1 | 1 | # Installation |
2 | 2 |
|
3 | | -Instructions d'installation de PipeOptz. |
| 3 | +You can install PipeOptz in two ways: from PyPI or from source. |
| 4 | + |
| 5 | +## Installation from PyPI |
| 6 | + |
| 7 | +It is recommended to install PipeOptz in a virtual environment to avoid conflicts with other packages. |
| 8 | + |
| 9 | +1. Create and activate a virtual environment: |
| 10 | + |
| 11 | + ```bash |
| 12 | + python -m venv venv |
| 13 | + source venv/bin/activate # On Windows, use `venv\Scripts\activate` |
| 14 | + ``` |
| 15 | + |
| 16 | +2. To install the latest stable version of PipeOptz from PyPI, run the following command: |
| 17 | + |
| 18 | + ```bash |
| 19 | + pip install pipeoptz |
| 20 | + ``` |
| 21 | + |
| 22 | +## Quick Test |
| 23 | + |
| 24 | +To verify that PipeOptz is installed correctly, you can run the following Python script: |
| 25 | + |
| 26 | +```python |
| 27 | +from pipeoptz import Pipeline, Node |
| 28 | +
|
| 29 | +# Define simple functions for the pipeline |
| 30 | +def add(x, y): |
| 31 | + return x + y |
| 32 | +
|
| 33 | +def multiply(a, b): |
| 34 | + return a * b |
| 35 | +
|
| 36 | +# Create a pipeline |
| 37 | +pipeline = Pipeline("Test Pipeline") |
| 38 | +
|
| 39 | +# Create nodes |
| 40 | +node_a = Node("A", add, fixed_params={"x": 5, "y": 3}) # A = 5 + 3 = 8 |
| 41 | +node_b = Node("B", multiply, fixed_params={"b": 10}) # B = A * 10 = 80 |
| 42 | +node_c = Node("C", add, fixed_params={"y": 2}) # C = B + 2 = 82 |
| 43 | +
|
| 44 | +# Add nodes to the pipeline with dependencies |
| 45 | +pipeline.add_node(node_a) |
| 46 | +pipeline.add_node(node_b, predecessors={"a": "A"}) |
| 47 | +pipeline.add_node(node_c, predecessors={"x": "B"}) |
| 48 | +
|
| 49 | +# Run the pipeline |
| 50 | +last_node, results, _ = pipeline.run() |
| 51 | +
|
| 52 | +# Print the result of the last node |
| 53 | +print(f"Result of the pipeline: {results[last_node]}") |
| 54 | +``` |
| 55 | + |
| 56 | +Save the script as `test.py` and run it from your terminal: |
| 57 | + |
| 58 | +```bash |
| 59 | +python test.py |
| 60 | +``` |
| 61 | + |
| 62 | +You should see the following output: |
| 63 | + |
| 64 | +``` |
| 65 | +Result of the pipeline: 82 |
| 66 | +``` |
| 67 | +
|
| 68 | +## Installation from source |
| 69 | +
|
| 70 | +If you want to contribute to the development of PipeOptz or if you need the development version, you can install it from source. |
| 71 | +
|
| 72 | +1. Clone the Git repository: |
| 73 | +
|
| 74 | + ```bash |
| 75 | + git clone https://github.com/centralelyon/pipeoptz.git |
| 76 | + ``` |
| 77 | +
|
| 78 | +2. Navigate to the project directory: |
| 79 | +
|
| 80 | + ```bash |
| 81 | + cd pipeoptz |
| 82 | + ``` |
| 83 | +
|
| 84 | +3. Install the package in editable mode with development dependencies: |
| 85 | +
|
| 86 | + ```bash |
| 87 | + pip install -e .[dev] |
| 88 | + ``` |
| 89 | +
|
| 90 | +This will install PipeOptz in your Python environment and allow you to modify the source code and see the changes immediately. |
0 commit comments