{"id":3800,"library":"scmrepo","title":"scmrepo","description":"scmrepo is an SCM wrapper and fsspec filesystem for Git, commonly used within the DVC ecosystem. It provides a unified API for interacting with Git repositories using various backends like pygit2, dulwich, and gitpython, without necessarily requiring a full `git checkout`. The library is actively maintained, with frequent patch and minor releases.","status":"active","version":"3.6.2","language":"python","source_language":"en","source_url":"https://github.com/treeverse/scmrepo","tags":["git","scm","version control","fsspec","dulwich","pygit2","gitpython"],"install":[{"cmd":"pip install scmrepo","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Provides the core GitFileSystem functionality for abstracting Git repositories as a filesystem.","package":"fsspec"},{"reason":"Optional backend for Git repository operations, a pure-Python implementation.","package":"dulwich","optional":true},{"reason":"Optional backend for Git repository operations, a C-bindings based implementation.","package":"pygit2","optional":true},{"reason":"Optional backend for Git repository operations.","package":"gitpython","optional":true}],"imports":[{"symbol":"GitFileSystem","correct":"from scmrepo.fs import GitFileSystem"},{"symbol":"Git","correct":"from scmrepo.git import Git"}],"quickstart":{"code":"import os\nimport shutil\nimport tempfile\nfrom scmrepo.git import Git\nfrom scmrepo.fs import GitFileSystem\n\n# Create a temporary directory for the repository\nrepo_dir = tempfile.mkdtemp()\nfile_path = os.path.join(repo_dir, \"test_file.txt\")\n\ntry:\n    # Initialize a Git repository\n    git = Git(repo_dir)\n    git.init()\n\n    # Create and commit a file\n    with open(file_path, \"w\") as f:\n        f.write(\"Hello, scmrepo!\\n\")\n    git.add(file_path)\n    git.commit(\"Initial commit\", allow_empty=True)\n\n    # Use GitFileSystem to read the file from 'HEAD'\n    fs = GitFileSystem(repo_dir, rev=\"HEAD\")\n    with fs.open(\"test_file.txt\", \"r\") as f:\n        content = f.read()\n    print(f\"Content of test_file.txt: {content.strip()}\")\n\n    # Demonstrate walking the file system\n    print(\"\\nFiles in repo (from GitFileSystem):\")\n    for root, dnames, fnames in fs.walk(\"/\"):\n        for dname in dnames:\n            print(fs.path.join(root, dname))\n        for fname in fnames:\n            print(fs.path.join(root, fname))\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    # Clean up the temporary directory\n    shutil.rmtree(repo_dir)\n    print(f\"Cleaned up temporary repository at {repo_dir}\")","lang":"python","description":"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`."},"warnings":[{"fix":"Install the desired backend package: `pip install scmrepo dulwich` or `pip install scmrepo pygit2`.","message":"scmrepo supports multiple Git backends (dulwich, pygit2, gitpython). To use a specific backend, you must install its corresponding Python package (e.g., `pip install dulwich`) alongside `scmrepo`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update `pygit2` backend code to use `list_heads` and access `LsRemoteResult` attributes directly instead of treating it as a dictionary.","message":"For the `pygit2` backend, the `ls_remotes` method was migrated to `list_heads`, and treating `LsRemoteResult` as a dictionary was deprecated.","severity":"breaking","affected_versions":">=3.5.5"},{"fix":"Ensure `dulwich` is at least version `0.24.3` and update code to use `worktree` for affected operations. Additionally, path handling on Windows with `dulwich>=0.25.1` was fixed in `scmrepo 3.6.2`.","message":"For the `dulwich` backend, `repo stage` was deprecated in favor of `worktree` for some operations, and the minimum `dulwich` version was bumped to `0.24.3`.","severity":"breaking","affected_versions":">=3.5.4"},{"fix":"Upgrade to `scmrepo>=3.5.8` for improved GPG signing compatibility with `dulwich`.","message":"The `dulwich` backend has seen fixes related to GPG signing for commits across several versions. If you encounter issues with signed commits using `dulwich`, check `scmrepo` versions `3.5.7` and `3.5.8` for relevant fixes.","severity":"gotcha","affected_versions":"3.5.0 - 3.5.6"}],"env_vars":null,"search_vec":"'activ':46 'api':22 'backend':30 'checkout':42 'common':12 'control':57 'dulwich':33,59 'dvc':16 'ecosystem':17 'filesystem':9 'frequent':49 'fsspec':8,58 'full':40 'git':11,26,41,54 'gitpython':35,61 'interact':24 'librari':44 'like':31 'maintain':47 'minor':52 'necessarili':37 'patch':50 'provid':19 'pygit2':32,60 'releas':53 'repositori':27 'requir':38 'scm':5,55 'scmrepo':1,2 'unifi':21 'use':13,28 'various':29 'version':56 'within':14 'without':36 'wrapper':6","created_at":"2026-04-11T17:45:14.708733+00:00","updated_at":"2026-04-11T17:45:14.708733+00:00","problems":[],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.6.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/treeverse/scmrepo","docs":null,"changelog":null,"pypi":"https://pypi.org/project/scmrepo/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}