Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
libvcs
· libvcs is a lite, typed, pythonic tool box for
detection and parsing of URLs, commanding, and syncing with git
, hg
, and svn
. Powers
vcspull.
Supports Python 3.9 and above, Git (including AWS CodeCommit), Subversion, and Mercurial.
To get started, see the quickstart guide for more information.
$ pip install --user libvcs
Easily validate and parse VCS URLs using the
libvcs.url
module:
>>> from libvcs.url.git import GitURL
>>> GitURL.is_valid(url='https://github.com/vcs-python/libvcs.git')
True
>>> 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:
>>> from libvcs.url.git import GitURL
>>> git_location = GitURL(url='git@github.com:vcs-python/libvcs.git')
>>> git_location.path = 'vcs-python/vcspull'
>>> git_location.to_url()
'git@github.com:vcs-python/vcspull.git'
# Switch them to gitlab:
>>> git_location.hostname = 'gitlab.com'
# Export to a `git clone` compatible URL.
>>> git_location.to_url()
'git@gitlab.com:vcs-python/vcspull.git'
See more in the parser document.
Abstracts CLI commands for git(1)
, hg(1)
, svn(1)
via a lightweight subprocess
wrapper.
import pathlib
from libvcs.cmd.git import Git
git = Git(path=pathlib.Path.cwd() / 'my_git_repo')
git.clone(url='https://github.com/vcs-python/libvcs.git')
Above: libvcs.cmd.git.Git
using
Git.clone()
.
Synchronize your repositories using the
libvcs.sync
module.
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()
.
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.
import pathlib
from libvcs.pytest_plugin import CreateRepoPytestFixtureFn
from libvcs.sync.git import GitSync
def test_repo_git_remote_checkout(
create_git_remote_repo: CreateRepoPytestFixtureFn,
tmp_path: pathlib.Path,
projects_path: pathlib.Path,
) -> None:
git_server = create_git_remote_repo()
git_repo_checkout_dir = projects_path / "my_git_checkout"
git_repo = GitSync(path=str(git_repo_checkout_dir), url=f"file://{git_server!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..
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://www.git-pull.com/support.html.
libvcs.url
: URL Parserlibvcs.cmd
: Commandslibvcs.sync
: Clone and updateFAQs
Lite, typed, python utilities for Git, SVN, Mercurial, etc.
We found that libvcs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.