Skip to main content

Pin your functions!

Project description

Piniverse

PyPI version Build Status codecov License: MIT contributions welcome

Piniverse is a simple library to programmatically orchestrate function calls for Python.



Table of contents

Features Support

  • Execution of pinned functions inside a python package in topological ordering
  • Visualization of the directed acyclic graph

Prerequisites

  • Python 3.7

Getting Started

Installation

$ pip install piniverse

Basic Usage

Piniverse inspects pinned functions inside a package.

.
├── workspace/   <-- workspace directory
├── script.py    <-- script file

To orchestrate your desired functions, pin them! Every pinned function has a task identifier, and if applicable, a succeeding toward identifier.

# workspace/

from piniverse import Pinned


@Pinned(
  task='1',
  toward='2', 
  arguments={
    args: ['Hello World']
    kwargs: {'content': 'Programming exercise...'}
  }
)
def simple_print(title: str, content: str = '') -> None:
  message = """
    Title: {}
    Content: 
      {}
  """.format(title, content)
  
  print(message)


@Pinned(
  task='2',
  arguments={
    args: ['A pretty Hello World']
    kwargs: {'content': 'A pretty programming exercise!'
  }
)
def pretty_print(title: str, content: str = '') -> None:
  message = """
    Pretty Title: {}
    Pretty Content: 
      {}
  """.format(title, content)

  print(message)

To execute your pinned functions, plan and apply!

# script.py

import piniverse
import workspace


piniverse.plan(workspace)
piniverse.apply()

// Title: Hello World
// Content: 
//   Programming exercise...
// Title: A pretty Hello World
// Content:
//   A pretty programming exercise

User Interface

Piniverse also provides a straightforward visualization of your task definitions.

# script.py

pinverse.plan(workspace, plan_view=True)


Limitations

Presently, Piniverse solely supports standalone functions.

Contributions

Contributions are more than welcome! Check out the contribution documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piniverse-0.0.4.tar.gz (13.1 kB view details)

Uploaded Source

File details

Details for the file piniverse-0.0.4.tar.gz.

File metadata

  • Download URL: piniverse-0.0.4.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for piniverse-0.0.4.tar.gz
Algorithm Hash digest
SHA256 16c66df3e380b6377eaf56f1fadce3d8dcea3e5d9ae4d359db419d93b0028af8
MD5 fce76e044b627e6321eedb30c0fc9331
BLAKE2b-256 1bed77332785a94d8de11486af8f9e05949e021236fd714fc93faf4609a91165

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page