libvcs¶
Typed Python utilities for Git, SVN, and Mercurial. Parse URLs, execute commands, and synchronize repositories – all with a consistent, type-friendly API.
Install and parse your first VCS URL in 5 minutes.
Parse, validate, and normalize git/hg/svn URLs.
Typed wrappers for git, hg, and svn CLI operations.
Clone and update local repositories.
Fixtures for isolated VCS test repos.
Contributing, code style, release process.
Install¶
$ pip install libvcs
$ uv add libvcs
Tip
libvcs is pre-1.0. Pin to a range: libvcs>=0.39,<0.40
See Quickstart for all methods and first steps.
At a glance¶
from libvcs.url.git import GitURL
url = GitURL(url="[email protected]:vcs-python/libvcs.git")
url.hostname # 'github.com'
url.path # 'vcs-python/libvcs'
GitURL.is_valid(url="https://github.com/vcs-python/libvcs.git")
# True
libvcs gives you typed dataclasses for every parsed URL, thin CLI
wrappers for git / hg / svn, and high-level sync that clones or
updates a local checkout in one call.
Layer |
Module |
Purpose |
|---|---|---|
URL parsing |
|
Detect, validate, normalize VCS URLs |
Commands |
|
Execute individual VCS CLI operations |
Sync |
|
Clone and update local repositories |
Testing¶
libvcs ships a pytest plugin with session-scoped fixtures for Git, SVN, and Mercurial repositories:
def test_my_tool(create_git_remote_repo):
repo_path = create_git_remote_repo()
assert repo_path.exists()