Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ARCfs

ARCfs is a experimental implementation of a PyFilesystem2 filesystem abstraction for GitLab.
Through this, ARCfs provides a filesystem-like view of DataPLANT DataHUB ARCs in Python.

Installation

ARCfs is available as pip package.

pip install gitlab-arc-fs

Alternatively:

  1. Download / clone Repository
  2. Change directory into ARCfs
  3. Run pip install .

NOTE: For read acces, an API token with the scope "read_api" is sufficient. For write access the scope "api" is requiered. You can find more information here.

Getting started

Creating an ARCfs object

To create an ARCfs object directly, you can use the following Code.

from gitlab_arc_fs.arc_fs import ARCfs

# To use the DataHUB GitLab Server: "https://git.nfdi4plants.org/"
server_url = "<URL_to_GitLab_Server>"
access_token = "<GitLab_API_access_token>"

arc_fs = ARCfs(access_token, server_url)

FS URLs

Useful for creating filesystems from a configuration file or the command line. Creates an instance of ARCfs with a URL comparable to one you would use in a browser.

from fs import open_fs

arc_fs = open_fs("arcfs://<GitLab_API_access_token>@<URL_to_GitLab_Server>")

The open_fs() function can also be used as context manager:

from fs import open_fs

with open_fs("arcfs://<GitLab_API_access_token>@<URL_to_GitLab_Server>") as arc_fs:
    # Do something with arc_fs here.

Usage

Bellow some examples how an ARCfs instance can be used.

List directory content:

# list all ARCs / repos a user has access to (with the given API token).
arcs = arc_fs.listdir("/")

# list files/dirs inside a repository
files = arc_fs.listdir("<namespace>-<reponame>/<path_inside_repository>")

NOTE: In the <namespace> part, replace "." with "_", e.g. "firstname.lastname" -> "firstname_lastname".

Open/Download a file

# using fs.open
with open("<local_path>", "wb") as local_file:
    with arc_fs.open("<remote_path>", mode="rb") as remote_file:
        for byte in iter(lambda: remote_file.read(4096), b""):
            local_file.write(byte)

# using fs.download
with open("<local_path>", "wb") as local_file:
    arc_fs.download("<remote_path>", local_file)

Creating directories and uploading files

with open("<local_path>", "rb") as local_file:
    if not arc_fs.isdir("<remote_path>"):
        openfs.makedirs("<remote_path>")
    # It would also be possible to open a remote file in write modus,
    # but the upload function is preferable.
    arc_fs.upload("<remote_path>", local_file)

NOTE: Since GitLab has no real concept of directories, a newly created directory does not become permanent until a file is placed in that directory.

More information about the PyFilesystem API can be founde here.

Further important information

ARCfs does not support setting file information nor the deletion of directories or files (setinfo(), remove(), removedir()).

Upon performing any write operation with ARCfs, the file in question is uploaded as LFS file, a new branch is created and pointer file is commited in the newly created branch. Finally, a merge request into the main branch is created.

Metadata

Release files for gitlab-arc-fs 0.0.26.dev1

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

Source distribution (sdist)

Source distribution for gitlab-arc-fs 0.0.26.dev1
File Size Uploaded Provenance
gitlab_arc_fs-0.0.26.dev1.tar.gz 35.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gitlab-arc-fs 0.0.26.dev1
File Interpreter ABI Platform
gitlab_arc_fs-0.0.26.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 68.6 kB

Release files / gitlab_arc_fs-0.0.26.dev1.tar.gz

Download URL gitlab_arc_fs-0.0.26.dev1.tar.gz
Size 35.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e10c59a9858d50efc71711a6115fe869d8c1aa9cdfb2463f7b25b1d789afb631
BLAKE2b-256 checksum
How to use checksums
857ab28743f1d5da2e4203d18ec22047ccf61d780af3f77ddea9822a3199ce81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / gitlab_arc_fs-0.0.26.dev1-py3-none-any.whl

Download URL gitlab_arc_fs-0.0.26.dev1-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78bf29e686361eedf92eddf22e8560ef24b77f8ae72a7f4e0ffd209a39ded1b9
BLAKE2b-256 checksum
How to use checksums
ce4c02511ad0e0e3117d905cb1f312ddb960c85782ae167aa3e46634a76e65b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Security for gitlab-arc-fs 0.0.26.dev1

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.

Release history Release notifications | RSS feed

This release
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