Skip to main content

pipen-cli-require

Checking the requirements for processes of a pipen pipeline

Install

pip install -U pipen-cli-require

Usage

Defining requirements of a process

# example_pipeline.py
from pipen import Pipen, Proc

class P1(Proc):
    """Process 1

    Requires:
        pipen: Run `pip install -U pipen` to install
          - check: |
            {{proc.lang}} -c "import pipen"
        liquidpy: Run `pip install -U liquidpy` to install
          - check: |
            {{proc.lang}} -c "import liquid"
        nonexist: Run `pip install -U nonexist` to install
          - check: |
            {{proc.lang}} -c "import nonexist"
        conditional:
          - if: {{envs.require_conditional}}
          - check:
            {{proc.lang}} -c "import optional"

    """
    input = "a"
    output = "outfile:file:out.txt"
    envs = {"require_conditional": False}
    lang = "python"

# Setup the pipeline
# Must be outside __main__
# Or define a function to return the pipeline
class Pipeline(Pipen):
    starts = P1


if __name__ == '__main__':
    # Pipeline must run with __main__
    Pipeline().run()

Parsing process requirements using API

from pipen_cli_require import parse_proc_requirements


def parse_proc_requirements(
    proc: Type[Proc]
) -> Tuple[OrderedDiot, OrderedDiot]:
    """Parse the requirements of a process

    Args:
        proc: The process class

    Returns:
        A tuple of two OrderedDiot's.
        The first one is the annotated sections by pipen_annotate
        The second one is the requirements. The key is the name of the
            requirement, the value is a dict with message, check and if_ keys.
    """

Checking the requirements via the CLI

> pipen require --verbose --ncores 2 -p example_pipeline.py:pipeline

Checking requirements for pipeline: PIPEN-0
│
└── P1: Process 1
    ├── ✅ pipen
    ├── ✅ liquidpy
    ├── ❎ nonexist: Run `pip install -U nonexist` to install
    │   └── Traceback (most recent call last):
    │         File "<string>", line 1, in <module>
    │       ModuleNotFoundError: No module named 'nonexist'
    │
    └── ⏩ conditional (skipped by if-statement)

Checking requirements with runtime arguments

For example, when I use a different python to run the pipeline:

Add this to the head of example_pipeline.py:

import pipen_args

See also tests/pipen_args_pipeline.py

Then specify the path of the python to use:

pipen require example_pipeline.py:pipeline --P1.lang /path/to/another/python

Metadata

Release files for pipen-cli-require 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pipen-cli-require 1.1.0
File Size Uploaded
pipen_cli_require-1.1.0.tar.gz 100.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pipen-cli-require 1.1.0
File Interpreter ABI Platform
pipen_cli_require-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 106.4 kB

Release files / pipen_cli_require-1.1.0.tar.gz

Download URL pipen_cli_require-1.1.0.tar.gz
Size 100.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a97bd3b8acd6a7cdd59b7db8967baf62b9712270fc88414c1ba61a4f81777ef2
BLAKE2b-256 checksum
How to use checksums
41c453652683c80e58ea4410c34f6b65fc6e5deaf4840d781bcded802e7afca7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pipen_cli_require-1.1.0-py3-none-any.whl

Download URL pipen_cli_require-1.1.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1085b767e272b9ffdd1c5bf539ca51f261b78de26ab6718f5bf3405a64a01f57
BLAKE2b-256 checksum
How to use checksums
7d46fb0683a64c1d15c3c9db0bc14e36eb9298de2d6f1b7b20ef2042c85d76a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.13.2

2 release files

0.12.0

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page