Skip to main content

Python Pachyderm Client

Project description

Pachyderm's Python SDK

Official Python client/SDK for Pachyderm. The successor to https://github.com/pachyderm/python-pachyderm.

This library provides the autogenerated gRPC/protobuf code for Pachyderm, generated using a fork of the betterproto package, along with higher-level functionality.

Installation

pip install pachyderm_sdk

A Small Taste

Here's an example that creates a repo and adds a file:

from pachyderm_sdk import Client
from pachyderm_sdk.api import pfs

# Connects to a pachyderm cluster using your local config
#   at ~/.pachyderm/config.json
client = Client.from_config()

# Creates a pachyderm repo called `test`
repo = pfs.Repo(name="test")
client.pfs.create_repo(repo=repo)

# Create a new commit in `test@master` and upload a file.
branch = pfs.Branch.from_uri("test@master")
with client.pfs.commit(branch=branch) as commit:
    file = commit.put_file_from_bytes(path="/data/file.dat", data=b"DATA")

# Retrieve the uploaded file.
with client.pfs.pfs_file(file) as f:
    print(f.readall())

How to load a CAST file into a pandas dataframe

from pachyderm_sdk import Client
from pachyderm_sdk.api import pfs
import pandas as pd

client = Client.from_config()
file = pfs.File.from_uri("test@master:/path/to/data.csv")
with client.pfs.pfs_file(file) as f:
    df = pd.read_csv(f)

Changes from Python-Pachyderm

This package is a successor to the python-pachyderm package. Listed below are some of the notable changes:

  1. Organization of the API
    • Methods and Message objects are now organized according to the service they are associated with, i.e. auth, pfs (pachyderm file-system), pps (pachyderm pipelining-system).
    • Message objects can be found within their respective submodule of the pachyder_sdk.api module, i.e. pachyderm_sdk.api.pfs.
    • Methods can be found within their respective attribute of the Client class, i.e. client.pps.create_pipeline.
      • Some methods have been renamed to remove redundancy due to this organization, i.e. python_pachyderm.Client.get_enterprise_state -> pachyderm_sdk.Client.enterprise.get_state
  2. The autogenerated code is generated using a fork of the betterproto compiler.
    • Messages are now python dataclasses.
    • Methods require keyword arguments.
    • Pachyderm resources are specified using types.
      • python-pachyderm (old): client.create_repo("test")
      • pachyderm_sdk (new): client.pfs.create_repo(repo=pfs.Repo(name="test"))

Contributing

Please see the contributing guide for more info (including testing instructions)

Developer Guide

Generate python APIs from protobuf:

./generate-protos.sh

Generate HTML documentation (writes to docs/pachyderm_sdk):

make docs

Running Tests:

pytest -vvv tests

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pachyderm_sdk-2.10.0rc1.tar.gz (64.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pachyderm_sdk-2.10.0rc1-py3-none-any.whl (79.1 kB view details)

Uploaded Python 3

File details

Details for the file pachyderm_sdk-2.10.0rc1.tar.gz.

File metadata

  • Download URL: pachyderm_sdk-2.10.0rc1.tar.gz
  • Upload date:
  • Size: 64.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.14 Linux/5.15.0-1053-aws

File hashes

Hashes for pachyderm_sdk-2.10.0rc1.tar.gz
Algorithm Hash digest
SHA256 d819524383ba08f977e29a6f65b2c2f56264c53ce790434c4e4944d89ab9a560
MD5 3ac42f84bea1753ade4fabc7f670193e
BLAKE2b-256 1eb60117063e36b40f0c3f499cbb99583b944487449a2374cf1e545ca705e907

See more details on using hashes here.

File details

Details for the file pachyderm_sdk-2.10.0rc1-py3-none-any.whl.

File metadata

  • Download URL: pachyderm_sdk-2.10.0rc1-py3-none-any.whl
  • Upload date:
  • Size: 79.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.14 Linux/5.15.0-1053-aws

File hashes

Hashes for pachyderm_sdk-2.10.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 353e37309ceb2c61ed332611b104719aca106fd5fb2989d753a77b026a8f34cb
MD5 472287081b2b95b0f540883f17827338
BLAKE2b-256 2a3591a03caaa106502c51d517415b5c437a0cc1e1ca947a855373dbf706a546

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