Skip to main content

Gfal2-Python

gfal2-python is a C++ library offering a thin layer of Python wrappers via PyBoost. We recommend installing it via RPMs, but it is also available on PyPI/gfal2-python <https://pypi.org/project/gfal2-python/>__.

Using the Gfal2 Python Bindings

The Gfal2 Python bindings are intended to be easy to use.

Pre-requisites ^^^^^^^^^^^^^^

Before jumping into usage, ensure you have a proxy certificate available in the default location (/tmp/x509up_u$(id -u)).

Optionally, you may want to install relevant Gfal2 protocol plugins. Our example will use HTTP protocol, so we must ensure we have the Gfal2 HTTP plugin installed:

.. code:: bash

$ dnf install -y gfal2-plugin-http

Examples ^^^^^^^^

Example of stating a file location:

.. code:: python

import gfal2

ctx = gfal2.creat_context() ctx.stat("https://eospublic.cern.ch/eos/opstest/dteam/file.test")

Example of copying a file from local to remote:

.. code:: python

import gfal2

ctx = gfal2.creat_context() ctx.filecopy("file:///tmp/file.test", "https://eospublic.cern.ch/eos/opstest/dteam/file.test") ctx.stat("https://eospublic.cern.ch/eos/opstest/dteam/file.test")

Example of copying the file from remote to local (with custom transfer parameters):

.. code:: python

import gfal2

ctx = gfal2.creat_context() params = ctx.transfer_parameters() params.set_checksum = ("both", "adler32", None) params.overwrite = True

ctx.filecopy("https://eospublic.cern.ch/eos/opstest/dteam/file.test", "file:///tmp/file.test") ctx.checksum("file:///tmp/file.test", "adler32")

Further code examples can be found in the example/python/ <https://github.com/cern-fts/gfal2-python/tree/v1.12.2/example/python>__ source directory.

Installing via Pip

Installing the package via pip install gfal2-python will reproduce the compilation process, hence why you need to make sure you have all the right dependencies. This guide details the steps needed to get all the dependencies, starting from a blank machine.

This guide assumes you have the EPEL repositories installed (epel-release package). In this example, the build platform is Alma9 and we will use v1.12.2, but the same process applies for other versions or build platforms.

.. code:: bash

Clone the gfal2-python repository with the desired version (example for v1.12.2)

$ git clone --branch v1.12.2 https://github.com/cern-fts/gfal2-python.git $ cd gfal2-python/

Install standard set of build packages

$ ./ci/fedora-packages.sh

Build the source RPM and install dependencies

$ cd packaging/ $ make srpm $ dnf builddep -y gfal2-python-*.src.rpm

Ready to install now from PyPI

$ pip install gfal2-python

Enjoy using the Gfal2 Python bindings!

Metadata

Release files for gfal2-python 1.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gfal2-python 1.13.0
File Size Uploaded Provenance Actions
gfal2-python-1.13.0.tar.gz 42.7 kB Without provenance Details for gfal2-python-1.13.0.tar.gz

Release files / gfal2-python-1.13.0.tar.gz

Download URL gfal2-python-1.13.0.tar.gz
Size 42.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5be42cc894fa20af3d6f6dbb30dfd4d29ab49bd5f15b3e3e754aa25c5ed17997
BLAKE2b-256 checksum
How to use checksums
6b88335f56f3286bff5fde448d92eede5b6fe192f4b25a6fe829bededb4136c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.18

Security for gfal2-python 1.13.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page