Skip to main content

XRootDPyFS

https://github.com/inveniosoftware/xrootdpyfs/actions?query=workflow%3ACI.svg?branch=master https://coveralls.io/repos/inveniosoftware/xrootdpyfs/badge.svg?branch=master https://pypip.in/v/xrootdpyfs/badge.svg

XRootDPyFS is a PyFilesystem-like interface to XRootD.

XRootD protocol aims at giving high performance, scalable fault tolerant access to data repositories of many kinds. The XRootDPyFS adds a high-level interface on top of the existing Python interface (pyxrootd) and makes it easy to e.g. copy a directory in parallel or recursively remove a directory.

Further documentation is available on https://xrootdpyfs.readthedocs.io/.

Getting started

If you just want to try out the library, the easiest is to use Docker.

Build the image:

$ docker build --platform linux/amd64 -t xrootd .

Run the container and launch xrootd:

$ docker run --platform linux/amd64 -h xrootdpyfs -it xrootd bash

You will see the logs in the stdout. Next, in another shell, connect the container and fire up an ipython shell:

$ docker ps  # find the container id
$ docker exec -it <container-id> bash
[xrootdpyfs@xrootdpyfs code]$ ipython

Quick examples

Here is a quick example of a file listing with the xrootd PyFilesystem integration:

>>> from xrootdpyfs import XRootDPyFS
>>> fs = XRootDPyFS("root://localhost//tmp/")
>>> fs.listdir("xrootdpyfs")
['test.txt']

Reading files:

>>> f = fs.open("xrootdpyfs/test.txt")
>>> f.read()
b'Hello XRootD!\n'
>>> f.close()

Reading files using the readtext() method:

>>> fs.readtext("xrootdpyfs/test.txt")
b'Hello XRootD!\n'

Writing files:

>>> f = fs.open("xrootdpyfs/hello.txt", "w+")
>>> f.write("World")
>>> f.close()

Writing files using the writetext() method:

>>> fs.writetext("xrootdpyfs/test.txt", "World")

Development

The easiest way to develop is to build the Docker image and mount the source code as a volume to test any code modification with a running XRootD server:

$ docker build --platform linux/amd64 -t xrootd --progress=plain .
$ docker run --platform linux/amd64 -h xrootdpyfs -it -v <absolute path to this project>:/code xrootd bash
[xrootdpyfs@xrootdpyfs code]$ xrootd

In another shell:

$ docker ps  # find the container id
$ docker exec -it <container-id> bash
[xrootdpyfs@xrootdpyfs code]$ python -m pytest -vvv tests

If you want to test a specific version of xrootd, run:

$ docker build --platform linux/amd64 --build-arg xrootd_version=4.12.7 -t xrootd --progress=plain .

Documentation

Documentation is available at <http://xrootdpyfs.readthedocs.io/> or can be build using Sphinx:

pip install Sphinx
python setup.py build_sphinx

Testing

Running the tests are most easily done using docker:

$ docker build --platform linux/amd64 -t xrootd . && docker run --platform linux/amd64 -h xrootdpyfs -it xrootd

Metadata

Release files for xrootdpyfs 3.1.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 xrootdpyfs 3.1.0
File Size Uploaded
xrootdpyfs-3.1.0.tar.gz 26.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xrootdpyfs 3.1.0
File Interpreter ABI Platform
xrootdpyfs-3.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 57.0 kB

Release files / xrootdpyfs-3.1.0.tar.gz

Download URL xrootdpyfs-3.1.0.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c2b40aad6875b7eb866db4eb053ff6f7f799193224bae606fee6b8af24a864af
BLAKE2b-256 checksum
How to use checksums
07349cf06f4fdf4f0970150879f23d0262627fc00ead9dfbd68b13a8248005f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / xrootdpyfs-3.1.0-py3-none-any.whl

Download URL xrootdpyfs-3.1.0-py3-none-any.whl
Size 30.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d3c2893d1efb5b816aa20875b00d316609a4b248201b0bddf225ba1fc5847b5c
BLAKE2b-256 checksum
How to use checksums
0c46036466b7180f7675c5e2ffa26dae8a61004225dbd798650216edd6a754e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
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