Skip to main content

GitHub release backed git filter for Peagen

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_gitfilter_gh_release


Swarmauri Git Filter GitHub Release

Store artifacts in GitHub Releases.

Overview

swarmauri_gitfilter_gh_release provides the GithubReleaseFilter, a StorageAdapter and GitFilter hybrid that manages Peagen artifacts as assets attached to a GitHub Release. It:

  • Connects to the configured organization, repository, and release tag using PyGithub.
  • Creates the release on-demand if it does not already exist.
  • Normalizes object keys with an optional prefix, exposing the release contents as a virtual directory via root_uri.
  • Uploads and replaces release assets atomically, allowing you to store binary artifacts without worrying about duplicates.
  • Supports directory workflows with upload_dir, iter_prefix, and download_prefix helpers for batch operations.

Authentication & configuration

The filter authenticates using a GitHub token sourced from your .peagen.toml or the GITHUB_TOKEN environment variable. The token needs permissions to read and write releases in the target repository.

Example .peagen.toml snippet:

[storage.filters.gh_release]
token = "$GITHUB_TOKEN"

You can also set the environment variable directly:

export GITHUB_TOKEN="ghp_..."

Installation

pip

pip install swarmauri_gitfilter_gh_release

uv

curl -Ls https://astral.sh/uv/install.sh | sh
uv pip install swarmauri_gitfilter_gh_release

Poetry

poetry add swarmauri_gitfilter_gh_release

Usage

from swarmauri_gitfilter_gh_release import GithubReleaseFilter

filt = GithubReleaseFilter.from_uri("ghrel://org/repo/tag/artifacts")

print(filt.root_uri)

The example above resolves the release (creating it if necessary) and prints the normalized root URI (ghrel://org/repo/tag/artifacts/).

Managing artifacts

GithubReleaseFilter mirrors GitHub release assets onto local paths. Each method accepts keys relative to the virtual root defined by the release tag and optional prefix:

  • upload(key, data) uploads a file-like object and replaces existing assets that share the same key.
  • download(key) streams a release asset back as a BytesIO object for inspection or local persistence.
  • upload_dir(path, prefix="") walks a directory tree and pushes each file into the release using the provided prefix.
  • iter_prefix(prefix) yields keys that start with the supplied prefix, allowing selective sync logic.
  • download_prefix(prefix, dest_dir) restores a tree of assets into a target directory on disk.

Combine these helpers to move trained models, prompts, or configuration bundles between local development and persistent release storage while keeping file layouts consistent.

Want to help?

If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.

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

swarmauri_gitfilter_gh_release-0.3.0.dev42.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file swarmauri_gitfilter_gh_release-0.3.0.dev42.tar.gz.

File metadata

  • Download URL: swarmauri_gitfilter_gh_release-0.3.0.dev42.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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}

File hashes

Hashes for swarmauri_gitfilter_gh_release-0.3.0.dev42.tar.gz
Algorithm Hash digest
SHA256 27e1537f5c5236eaf12266d5ee0dd11e653bfe2d305d0c2b9db1305438149a7e
MD5 8436a913e5a2d1d064a8fd8d455ec19a
BLAKE2b-256 a5f9a58aab327e725658df3a2d9e96fd3663cb1a8c724d81c51c8a05801297c9

See more details on using hashes here.

File details

Details for the file swarmauri_gitfilter_gh_release-0.3.0.dev42-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_gitfilter_gh_release-0.3.0.dev42-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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}

File hashes

Hashes for swarmauri_gitfilter_gh_release-0.3.0.dev42-py3-none-any.whl
Algorithm Hash digest
SHA256 ff925bf5dc9d70dea204f6c9604e4984f4922462837a7a368f8c2b5935d2cf66
MD5 6b71f03c831fc4eec43c82dbcc4ed345
BLAKE2b-256 1885a0ce2ea196d3173d7ed314f70ef4257d0747b1d20531ee6b695df57fbc4e

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