Make functions run however you like — CLI, pipeline, or remote compute
Project description
powerfunc
Add superpowers to your functions. Run them from the CLI, on cloud data, or on cloud compute.
Features
- Load and save function arguments and results to file paths, local or in cloud storage.
- Invoke functions on the command line.
- Remote execution on cloud compute.
- YAML configuration file support.
- Supports pandas, polars, PyArrow, Dask, and the Python
csvmodule out of the box - Supports cloud providers Google Cloud and Modal.
- Extensible for new data types and cloud providers.
Installation
pip install powerfunc
With Google Cloud remote execution:
pip install 'powerfunc[gcp]'
With Modal remote execution:
pip install 'powerfunc[modal]'
Example usage
Decorate a normal function with @powerfunc:
import pandas as pd
from powerfunc import powerfunc
@powerfunc
def sum_col(df: pd.DataFrame) -> float:
return float(df["value"].sum())
df = pd.DataFrame({"value": [1, 2, 3]})
print(sum_col(df))
Then use it on files, local or in the cloud:
print(sum_col("data.csv"))
print(sum_col("https://storage.googleapis.com/powerfunc/data.csv"))
Add one line at the end of your file to make it runnable on the command line:
from powerfunc import powerfunc
...
powerfunc.enable_cli()
python myfile.py gs://powerfunc/data.csv
Support
This project is in early development. Breaking changes may happen at any time.
Documentation
For complete information on using powerfunc, including executing on cloud compute, please see the documentation.
License
Released under the MIT license.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powerfunc-0.3.0.tar.gz.
File metadata
- Download URL: powerfunc-0.3.0.tar.gz
- Upload date:
- Size: 268.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cc5e5677feb40f193d6c9fc83958041d33ea41e2b347c1b80eda8b2793d55b7
|
|
| MD5 |
aa5fb8652009d153771429a076de37a8
|
|
| BLAKE2b-256 |
a30897ca29a0e120e16ba59cf6ce0a87a745314f9ef063093c8369d68fd782e3
|
File details
Details for the file powerfunc-0.3.0-py3-none-any.whl.
File metadata
- Download URL: powerfunc-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e6ec7c8fe35553a7a2d67f600fb17ba99096f275dd3910999188a683abc829e
|
|
| MD5 |
a81e4c511a8ab6022211b4ef3577db8d
|
|
| BLAKE2b-256 |
d11b686f86ecc2e80baa36ffed2afedd84601d9f320127a2fd6847f988e68481
|