Skip to main content

Lite, typed, python utilities for Git, SVN, Mercurial, etc.

Project description

libvcs · Python Package License Code Coverage

libvcs is a lite, typed, pythonic tool box for detection and parsing of URLs, commanding, and syncing with git, hg, and svn. Powers vcspull.


Features for Git, Subversion, and Mercurial:

  • Detect and parse VCS URLs
  • Command VCS via python API
  • Sync repos locally

To get started, see the quickstart for more.

$ pip install --user libvcs

URL Parsing (experimental)

You can validate and parse Git, Mercurial, and Subversion URLs through libvcs.parse:


>>> from libvcs.parse.git import GitUrl

>>> GitURL.is_valid(url='')

Parse and adjust a Git URL:

from libvcs.parse.git import GitUrl

>>> git_location = GitURL(url='')

>>> git_location

Switch repo libvcs -> vcspull:

>>> git_location.path = 'vcs-python/vcspull'

>>> git_location.to_url()

# Switch them to gitlab:
>>> git_location.hostname = ''

# Export to a `git clone` compatible URL.
>>> git_location.to_url()

See more in the parser document.

Commands (experimental)

Simple subprocess wrappers around git(1), hg(1), svn(1). Here is Git w/ Git.clone:

import pathlib
from libvcs.cmd.git import Git

git = Git(dir=pathlib.Path.cwd() / 'my_git_repo')


Create a GitProject object of the project to inspect / checkout / update:

import pathlib
from libvcs.projects.git import GitProject

repo = GitProject(
   dir=pathlib.Path().cwd() / "my_repo",
       'gitlab': ''

Update / clone repo:

>>> r.update_repo()

Get revision:

>>> r.get_revision()


Your donations fund development of new features, testing and support. Your money will go directly to maintenance and development of the project. If you are an individual, feel free to give whatever feels right for the value you get out of the project.

See donation options at

More information

Docs Build Status

Project details

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libvcs-0.14.0.tar.gz (57.7 kB view hashes)

Uploaded source

Built Distribution

libvcs-0.14.0-py3-none-any.whl (56.5 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page