Giftless Client
A Git LFS client library implemented in Python, compatible with Git LFS servers in general and specifically Giftless Git LFS server.
giftless-client is tested on Python 2.7 and 3.6+.
Installation
You can install this library directly from pypi:
(venv) $ pip install giftless-client
API
This module exposes one main class: LfsClient. Typically, you only need to use this class to perform most Git LFS operations. The client provides both a wrapper around the low-level LFS API commands e.g. batch as well as higher level methods to upload and download files.
Instantiating a Client
from giftless_client import LfsClient
client = LfsClient(
lfs_server_url='https://git-lfs.example.com', # Git LFS server URL
auth_token='somer4nd0mT0ken==', # Bearer token if required by the server (optional)
transfer_adapters=['basic'] # Enabled transfer adapters (optional)
)
The transfer_adapters parameter is optional, and represents a list of supported transfer adapters by priority
to negotiate with the server; Typically, there is no reason to provide this parameter.
Downloading a File from LFS storage
Download a file and save it to file like object.
download(file_obj, object_sha256, object_size, organization, repo, **extras)
file_objis expected to be an file-like object open for writing in binary modeobject_sha256: sha256 of the object you wish to downloadobject_size: size of the object you wish to downloadorganization,repo: used to generate the prefix for the batch request in formorganization/repoextrasare added to the batch request attributes dict prefixed withx-. This is largely Giftless specific.
Note that the download itself is performed by the selected Transfer Adapter.
Uploading a File to LFS storage
Upload a file to LFS storage
upload(file_obj, organization, repo, **extras)
file_obj: a readable, seekable file-like object- Other arguments as per download
Note that the upload itself is performed by the selected Transfer Adapter.
Sending an LFS batch API request
Send a batch request to the LFS server:
batch(prefix, operation, objects, ref=None, transfers=None)
prefix: add to LFS server url e.g. ifprefix=abcand client was created with server url ofhttps://git-lfs.example.comthen batch request is made by POST tohttps://git-lfs.example.com/abc/objects/batch- All other arguments: see batch command for definitions
Example:
client.batch(
prefix='myorg/myrepo',
operation='download',
objects={
"oid": "12345678",
"size": 123
}
)
Usage in Command Line
While the main use for giftless-client is as a client library for other projects, this module does include some
command line functionality.
Run the following command to get more information:
(venv) $ giftless-client --help
License
Giftless Client is free software distributed under the terms of the MIT license. See LICENSE for details.
Giftless Client is (c) 2020 Datopian / Viderum Inc.
Metadata
Release files for giftless-client 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| giftless-client-0.1.1.tar.gz | 6.6 kB | Without provenance | Details for giftless-client-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| giftless_client-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for giftless_client-0.1.1-py2.py3-none-any.whl |
Total release size: 15.8 kB
Release files / giftless-client-0.1.1.tar.gz
| Download URL | giftless-client-0.1.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b810764c9a5b112a533db4f05e7cef1a3b760a52117cb2ee99a18667d9968ca
|
|
BLAKE2b-256 checksum How to use checksums |
d619cb99fa8550753a0f67db910050f4774af049ece9eef659c241f282f40260
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/2.7.18
|
Release files / giftless_client-0.1.1-py2.py3-none-any.whl
| Download URL | giftless_client-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6baf6fa8f22a2c3d07730195820d08e36650a1aa70be23b7e59a5f620185662a
|
|
BLAKE2b-256 checksum How to use checksums |
f4d10610a54b89557774524b1792e77b3debdd26a1ce557f7a57e1a7153653e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.6.1 requests/2.25.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/2.7.18
|
Security for giftless-client 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.