Install & Compatibility
Where this runs
tested against v3.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.320s · 74.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 7.2s · import 0.288s · 79MB
78MB installed
● package 78MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
GitFileSystem
✓ from scmrepo.fs import GitFileSystem
Git
✓ from scmrepo.git import Git
This quickstart demonstrates how to initialize a Git repository using `scmrepo.git.Git`, commit a file, and then access that file system through `scmrepo.fs.GitFileSystem`.
import os
import shutil
import tempfile
from scmrepo.git import Git
from scmrepo.fs import GitFileSystem
# Create a temporary directory for the repository
repo_dir = tempfile.mkdtemp()
file_path = os.path.join(repo_dir, "test_file.txt")
try:
# Initialize a Git repository
git = Git(repo_dir)
git.init()
# Create and commit a file
with open(file_path, "w") as f:
f.write("Hello, scmrepo!\n")
git.add(file_path)
git.commit("Initial commit", allow_empty=True)
# Use GitFileSystem to read the file from 'HEAD'
fs = GitFileSystem(repo_dir, rev="HEAD")
with fs.open("test_file.txt", "r") as f:
content = f.read()
print(f"Content of test_file.txt: {content.strip()}")
# Demonstrate walking the file system
print("\nFiles in repo (from GitFileSystem):")
for root, dnames, fnames in fs.walk("/"):
for dname in dnames:
print(fs.path.join(root, dname))
for fname in fnames:
print(fs.path.join(root, fname))
except Exception as e:
print(f"An error occurred: {e}")
finally:
# Clean up the temporary directory
shutil.rmtree(repo_dir)
print(f"Cleaned up temporary repository at {repo_dir}")
Upgrade
Version history
3.6.2latest on PyPI · released Mar 31, 2026
Audit
Dependencies
fsspecrequiredProvides the core GitFileSystem functionality for abstracting Git repositories as a filesystem.
dulwichoptionalOptional backend for Git repository operations, a pure-Python implementation.
pygit2optionalOptional backend for Git repository operations, a C-bindings based implementation.
gitpythonoptionalOptional backend for Git repository operations.