Pennsieve Python Client
Project description
Pennsieve Python client (pennsieve2)
Python client and command line tool for Pennsieve (pennsieve2).
Prerequisites
In order to use this Python library to upload files to Pennsieve, please follow the instruction on installing and setting up Pennsieve agent, which could be found in the documentation.
Installation
To install, run:
pip install -U pennsieve
To install specific previous dev version, run:
pip install -U pennsieve==0.1.0.dev2 --extra-index-url https://test.pypi.org/simple
Contributions
To update gRPC python files, execute from the src folder:
rm src/pennsieve/protos/agent_pb2*
cd src
python3.9 -m grpc_tools.protoc --python_out=. -I. --grpc_python_out=. pennsieve/protos/agent.proto
Notice, this command does not produce a valid agent_pb2.py file when executed for Python3.10 or formatted by black - it does not use reflection and is reported as error for Flake8.
To create a package and upload it to PyPI, first update the package version in the pennsieve2/init.py, then execute:
python -m build
# For testing:
twine upload -r testpypi dist/*
# For production:
twine upload dist/*
Mapped Datasets
The client.map wrapper exposes the agent's mapped-dataset RPCs (map,
pull, push, diff) as a small Python API. The four RPCs return as soon
as the agent has accepted the work — pull and push then run in the
background inside the agent — so client.map also ships two blocking
helpers: wait_for_pull and wait_for_push.
client.map.map(dataset_id="N:dataset:...", target_folder="/data/foo")
client.map.pull("/data/foo/subfolder")
client.map.wait_for_pull("/data/foo", expected_relative_paths=[...])
client.map.push("/data/foo")
client.map.wait_for_push(expected_files=N, subscriber_id=os.getpid())
Timeouts
Both wait helpers use an idle timeout rather than a total-duration
timeout — the deadline resets each time progress is observed, so a
multi-hour single-file transfer is fine as long as the agent keeps making
progress. You only hit a TimeoutError when the agent goes silent.
wait_for_pull — default idle_timeout=1800 (30 min)
- Progress signal: a new file entry appears in
.pennsieve/state.json, which the agent writes on each file's completion. - Why 30 min: the window has to cover the worst-case single-file download end-to-end, since there is no per-chunk progress for pulls.
wait_for_push — default idle_timeout=300 (5 min)
- Progress signal: any
UPLOAD_STATUSevent (INIT/IN_PROGRESS/COMPLETE). The agent emitsIN_PROGRESSon every S3 chunk read, so events stream continuously during healthy uploads. - Why 5 min: events are frequent during healthy uploads, so 5 minutes of silence indicates a real stall (network hang, agent wedge) rather than slow progress.
Override either default by passing idle_timeout=<seconds> when you know
your transfer characteristics — e.g. pulls over a very slow link with large
individual files, or tighter CI smoke-tests where you want to fail faster.
client.map.wait_for_pull(target_folder, idle_timeout=3600) # 1 hour
client.map.wait_for_push(expected_files=N, subscriber_id=..., idle_timeout=60) # 1 minute
Documentation
Client and command line documentation can be found on Pennsieve’s documentation website.
Development
This project uses Poetry to manage dependencies in pyproject.toml. To set up a development environment run
poetry install
from the root directory to install the projects dependencies. Some IDEs (IntelliJ Idea for example) can create a Poetry Python environment as well.
Installing from TestPypi
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pennsieve
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 pennsieve-7.0.4.tar.gz.
File metadata
- Download URL: pennsieve-7.0.4.tar.gz
- Upload date:
- Size: 33.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05dbb475e2524af0fef46dc57d958ff91214739408eee3a7469b83d097f8f952
|
|
| MD5 |
f5cc895cc23c294189872ff261b5cd5e
|
|
| BLAKE2b-256 |
70109f029882c2ed58df2af2b18c3a84e0c8e7d1cbe35be8bc59cce3d16c0871
|
Provenance
The following attestation bundles were made for pennsieve-7.0.4.tar.gz:
Publisher:
publish-pypi.yml on Pennsieve/pennsieve-agent-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pennsieve-7.0.4.tar.gz -
Subject digest:
05dbb475e2524af0fef46dc57d958ff91214739408eee3a7469b83d097f8f952 - Sigstore transparency entry: 1720615289
- Sigstore integration time:
-
Permalink:
Pennsieve/pennsieve-agent-python@5ea83c04c39a0f88e140f4de64730f3b6612d786 -
Branch / Tag:
refs/tags/v7.0.4 - Owner: https://github.com/Pennsieve
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5ea83c04c39a0f88e140f4de64730f3b6612d786 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pennsieve-7.0.4-py3-none-any.whl.
File metadata
- Download URL: pennsieve-7.0.4-py3-none-any.whl
- Upload date:
- Size: 36.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfe33b870d319d72dce7516dc5f2fbe8e0d064ea38935c37c56b4de8cf102339
|
|
| MD5 |
4709f9a97b1b67847da5b80433bab106
|
|
| BLAKE2b-256 |
c51d9bbdfecb6239e575da41107dfb89ad08564386c25800bb535d704fb21730
|
Provenance
The following attestation bundles were made for pennsieve-7.0.4-py3-none-any.whl:
Publisher:
publish-pypi.yml on Pennsieve/pennsieve-agent-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pennsieve-7.0.4-py3-none-any.whl -
Subject digest:
dfe33b870d319d72dce7516dc5f2fbe8e0d064ea38935c37c56b4de8cf102339 - Sigstore transparency entry: 1720615424
- Sigstore integration time:
-
Permalink:
Pennsieve/pennsieve-agent-python@5ea83c04c39a0f88e140f4de64730f3b6612d786 -
Branch / Tag:
refs/tags/v7.0.4 - Owner: https://github.com/Pennsieve
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@5ea83c04c39a0f88e140f4de64730f3b6612d786 -
Trigger Event:
push
-
Statement type: