libvcs

⚙️ Lite, typed, pythonic utilities for git, svn, mercurial, etc.

https://github.com/vcs-python/libvcs

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.8%) to scientific vocabulary

Keywords

api git hg library mercurial parsing python python-3 pythonic subversion svn url-parser vcs

Keywords from Contributors

yolov5 cryptocurrencies mesh pypi energy-system simulations dynamics parallel energy-system-model data-profilers
Last synced: 4 months ago · JSON representation ·

Repository

⚙️ Lite, typed, pythonic utilities for git, svn, mercurial, etc.

Basic Info
  • Host: GitHub
  • Owner: vcs-python
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage: https://libvcs.git-pull.com
  • Size: 4.26 MB
Statistics
  • Stars: 54
  • Watchers: 4
  • Forks: 11
  • Open Issues: 54
  • Releases: 0
Topics
api git hg library mercurial parsing python python-3 pythonic subversion svn url-parser vcs
Created over 9 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Citation

README.md

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.

Overview

Key Features

  • URL Detection and Parsing: Validate and parse Git, Mercurial, and Subversion URLs.
  • Command Abstraction: Interact with VCS systems through a Python API.
  • Repository Synchronization: Clone and update repositories locally via Python API.
  • py.test fixtures: Create temporary local repositories and working copies for testing for unit tests.

Supports Python 3.9 and above, Git (including AWS CodeCommit), Subversion, and Mercurial.

To get started, see the quickstart guide for more information.

console $ pip install --user libvcs

URL Detection and Parsing

Easily validate and parse VCS URLs using the libvcs.url module:

Validate URLs

```python

from libvcs.url.git import GitURL

GitURL.is_valid(url='https://github.com/vcs-python/libvcs.git') True ```

Parse and adjust Git URLs:

```python

from libvcs.url.git import GitURL

git_location = GitURL(url='git@github.com:vcs-python/libvcs.git')

git_location GitURL(url=git@github.com:vcs-python/libvcs.git, user=git, hostname=github.com, path=vcs-python/libvcs, suffix=.git, rule=core-git-scp) ```

Switch repo libvcs -> vcspull:

```python

from libvcs.url.git import GitURL

git_location = GitURL(url='git@github.com:vcs-python/libvcs.git')

git_location.path = 'vcs-python/vcspull'

gitlocation.tourl() 'git@github.com:vcs-python/vcspull.git'

Switch them to gitlab:

git_location.hostname = 'gitlab.com'

Export to a git clone compatible URL.

gitlocation.tourl() 'git@gitlab.com:vcs-python/vcspull.git' ```

See more in the parser document.

Command Abstraction

Abstracts CLI commands for git(1), hg(1), svn(1) via a lightweight subprocess wrapper.

Run Git Commands

```python import pathlib from libvcs.cmd.git import Git

git = Git(path=pathlib.Path.cwd() / 'mygitrepo') git.clone(url='https://github.com/vcs-python/libvcs.git') ```

Above: libvcs.cmd.git.Git using Git.clone().

Repository Synchronization

Synchronize your repositories using the libvcs.sync module.

Clone and Update Repositories

```python import pathlib from libvcs.sync.git import GitSync

repo = GitSync( url="https://github.com/vcs-python/libvcs", path=pathlib.Path().cwd() / "my_repo", remotes={ 'gitlab': 'https://gitlab.com/vcs-python/libvcs' } )

Update / clone repo:

repo.update_repo()

Get revision:

repo.get_revision() u'5c227e6ab4aab44bf097da2e088b0ff947370ab8' ```

Above: libvcs.sync.git.GitSync repository object using GitSync.update_repo() and GitSync.get_revision().

Pytest plugin: Temporary VCS repositories for testing

libvcs pytest plugin provides py.test fixtures to swiftly create local VCS repositories and working repositories to test with. Repositories are automatically cleaned on test teardown.

Use temporary, local VCS in py.test

```python import pathlib

from libvcs.pytest_plugin import CreateRepoPytestFixtureFn from libvcs.sync.git import GitSync

def testrepogitremotecheckout( creategitremoterepo: CreateRepoPytestFixtureFn, tmppath: pathlib.Path, projectspath: pathlib.Path, ) -> None: gitserver = creategitremoterepo() gitrepocheckoutdir = projectspath / "mygitcheckout" gitrepo = GitSync(path=str(gitrepocheckoutdir), url=f"file://{gitserver!s}")

git_repo.obtain()
git_repo.update_repo()

assert git_repo.get_revision() == "initial"

assert git_repo_checkout_dir.exists()
assert pathlib.Path(git_repo_checkout_dir / ".git").exists()

```

Under the hood: fixtures bootstrap a temporary $HOME environment in a TmpPathFactory for automatic cleanup and pytest-xdist compatibility..

Donations

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 https://tony.sh/support.html.

More information

Docs Build Status

Owner

  • Name: python utilities for version control
  • Login: vcs-python
  • Kind: organization
  • Email: team@git-pull.com

permissively licensed. for the public good.

Citation (CITATION.cff)

cff-version: 1.2.0
message: >-
  If you use this software, please cite it as below.
  NOTE: Change "x.y" by the version you use. If you are unsure about which version
  you are using run: `pip show libvcs`."
authors:
- family-names: "Narlock"
  given-names: "Tony"
  orcid: "https://orcid.org/0000-0002-2568-415X"
title: "libvcs"
type: software
version: x.y
url: "https://libvcs.git-pull.com"

GitHub Events

Total
  • Issues event: 2
  • Watch event: 3
  • Delete event: 2
  • Issue comment event: 28
  • Push event: 1
  • Pull request review event: 14
  • Pull request review comment event: 28
  • Pull request event: 5
  • Create event: 2
Last Year
  • Issues event: 2
  • Watch event: 3
  • Delete event: 2
  • Issue comment event: 28
  • Push event: 1
  • Pull request review event: 14
  • Pull request review comment event: 28
  • Pull request event: 5
  • Create event: 2

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 2,087
  • Total Committers: 8
  • Avg Commits per committer: 260.875
  • Development Distribution Score (DDS): 0.07
Past Year
  • Commits: 236
  • Committers: 2
  • Avg Commits per committer: 118.0
  • Development Distribution Score (DDS): 0.004
Top Committers
Name Email Commits
Tony Narlock t****y@g****m 1,940
pyup-bot g****t@p****o 121
dependabot-preview[bot] 2****] 13
Jean-Christophe Fillion-Robin j****r@k****m 6
Jens W. Klein jk@k****t 3
pre-commit-ci[bot] 6****] 2
dependabot[bot] 4****] 1
Jhon Pedroza j****n@p****e 1
Committer Domains (Top 20 + Academic)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,178 last-month
  • Total docker downloads: 215
  • Total dependent packages: 2
  • Total dependent repositories: 5
  • Total versions: 159
  • Total maintainers: 2
  • Total advisories: 1
pypi.org: libvcs

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

  • Versions: 159
  • Dependent Packages: 2
  • Dependent Repositories: 5
  • Downloads: 1,178 Last month
  • Docker Downloads: 215
Rankings
Dependent packages count: 3.1%
Docker downloads count: 3.3%
Downloads: 6.5%
Average: 6.6%
Dependent repos count: 6.6%
Stargazers count: 9.7%
Forks count: 10.5%
Maintainers (2)
Last synced: 4 months ago

Dependencies

.github/workflows/docs.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • dorny/paths-filter v2.7.0 composite
  • jakejarvis/cloudflare-purge-action v0.3.0 composite
  • jakejarvis/s3-sync-action v0.5.1 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
poetry.lock pypi
  • alabaster 0.7.12 develop
  • astroid 2.12.2 develop
  • atomicwrites 1.4.1 develop
  • attrs 22.1.0 develop
  • babel 2.10.3 develop
  • beautifulsoup4 4.11.1 develop
  • black 22.6.0 develop
  • certifi 2022.6.15 develop
  • charset-normalizer 2.1.0 develop
  • click 8.1.3 develop
  • codecov 2.1.12 develop
  • colorama 0.4.5 develop
  • coverage 6.4.3 develop
  • docutils 0.18.1 develop
  • faker 14.0.0 develop
  • flake8 5.0.4 develop
  • furo 2022.6.21 develop
  • idna 3.3 develop
  • imagesize 1.4.1 develop
  • importlib-metadata 4.12.0 develop
  • iniconfig 1.1.1 develop
  • isort 5.10.1 develop
  • jinja2 3.1.2 develop
  • lazy-object-proxy 1.7.1 develop
  • livereload 2.6.3 develop
  • markdown-it-py 2.1.0 develop
  • markupsafe 2.1.1 develop
  • mccabe 0.7.0 develop
  • mdit-py-plugins 0.3.0 develop
  • mdurl 0.1.2 develop
  • mypy 0.971 develop
  • mypy-extensions 0.4.3 develop
  • myst-parser 0.18.0 develop
  • packaging 21.3 develop
  • pathspec 0.9.0 develop
  • platformdirs 2.5.2 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pycodestyle 2.9.1 develop
  • pyflakes 2.5.0 develop
  • pygments 2.13.0 develop
  • pyparsing 3.0.9 develop
  • pytest 7.1.2 develop
  • pytest-cov 3.0.0 develop
  • pytest-mock 3.8.2 develop
  • pytest-rerunfailures 10.2 develop
  • pytest-watcher 0.2.3 develop
  • python-dateutil 2.8.2 develop
  • pytz 2022.2.1 develop
  • pyyaml 6.0 develop
  • requests 2.28.1 develop
  • six 1.16.0 develop
  • snowballstemmer 2.2.0 develop
  • soupsieve 2.3.2.post1 develop
  • sphinx 5.1.1 develop
  • sphinx-autoapi 1.9.0 develop
  • sphinx-autobuild 2021.3.14 develop
  • sphinx-autodoc-typehints 1.19.2 develop
  • sphinx-basic-ng 0.0.1a12 develop
  • sphinx-copybutton 0.5.0 develop
  • sphinx-inline-tabs 2022.1.2b11 develop
  • sphinx-issues 3.0.1 develop
  • sphinxcontrib-applehelp 1.0.2 develop
  • sphinxcontrib-devhelp 1.0.2 develop
  • sphinxcontrib-htmlhelp 2.0.0 develop
  • sphinxcontrib-jsmath 1.0.1 develop
  • sphinxcontrib-qthelp 1.0.3 develop
  • sphinxcontrib-serializinghtml 1.1.5 develop
  • sphinxext-opengraph 0.6.3 develop
  • sphinxext-rediraffe 0.2.7 develop
  • tomli 2.0.1 develop
  • tornado 6.2 develop
  • unidecode 1.3.4 develop
  • urllib3 1.26.11 develop
  • watchdog 2.1.9 develop
  • wrapt 1.14.1 develop
  • zipp 3.8.1 develop
  • typing-extensions 4.3.0
pyproject.toml pypi
  • Faker * develop
  • black * develop
  • codecov * develop
  • coverage * develop
  • flake8 * develop
  • furo * develop
  • isort * develop
  • mypy * develop
  • myst_parser * develop
  • pytest * develop
  • pytest-cov * develop
  • pytest-mock * develop
  • pytest-rerunfailures * develop
  • pytest-watcher ^0.2.3 develop
  • sphinx * develop
  • sphinx-autoapi * develop
  • sphinx-autobuild * develop
  • sphinx-autodoc-typehints * develop
  • sphinx-copybutton * develop
  • sphinx-inline-tabs * develop
  • sphinx-issues * develop
  • sphinxext-opengraph * develop
  • sphinxext-rediraffe * develop
  • python ^3.9
  • typing-extensions ^4.1.1