|
2 | 2 |
|
3 | 3 | # libvcs |
4 | 4 |
|
5 | | -```{include} ../README.md |
6 | | -:start-after: </div> |
| 5 | +Typed Python utilities for Git, SVN, and Mercurial. Parse URLs, |
| 6 | +execute commands, and synchronize repositories -- all with a |
| 7 | +consistent, type-friendly API. |
| 8 | + |
| 9 | +::::{grid} 1 2 3 3 |
| 10 | +:gutter: 2 2 3 3 |
| 11 | + |
| 12 | +:::{grid-item-card} Quickstart |
| 13 | +:link: quickstart |
| 14 | +:link-type: doc |
| 15 | +Install and parse your first VCS URL in 5 minutes. |
| 16 | +::: |
| 17 | + |
| 18 | +:::{grid-item-card} URL Parsing |
| 19 | +:link: url/index |
| 20 | +:link-type: doc |
| 21 | +Parse, validate, and normalize git/hg/svn URLs. |
| 22 | +::: |
| 23 | + |
| 24 | +:::{grid-item-card} Commands |
| 25 | +:link: cmd/index |
| 26 | +:link-type: doc |
| 27 | +Typed wrappers for git, hg, and svn CLI operations. |
| 28 | +::: |
| 29 | + |
| 30 | +:::{grid-item-card} Sync |
| 31 | +:link: sync/index |
| 32 | +:link-type: doc |
| 33 | +Clone and update local repositories. |
| 34 | +::: |
| 35 | + |
| 36 | +:::{grid-item-card} pytest Plugin |
| 37 | +:link: api/pytest-plugin |
| 38 | +:link-type: doc |
| 39 | +Fixtures for isolated VCS test repos. |
| 40 | +::: |
| 41 | + |
| 42 | +:::{grid-item-card} Project |
| 43 | +:link: project/index |
| 44 | +:link-type: doc |
| 45 | +Contributing, code style, release process. |
| 46 | +::: |
| 47 | + |
| 48 | +:::: |
| 49 | + |
| 50 | +## Install |
| 51 | + |
| 52 | +```console |
| 53 | +$ pip install libvcs |
7 | 54 | ``` |
8 | 55 |
|
9 | | -```{toctree} |
10 | | -:maxdepth: 2 |
11 | | -:hidden: |
| 56 | +```console |
| 57 | +$ uv add libvcs |
| 58 | +``` |
12 | 59 |
|
13 | | -quickstart |
14 | | -topics/index |
15 | | -url/index |
16 | | -cmd/index |
17 | | -sync/index |
18 | | -pytest-plugin |
| 60 | +```{tip} |
| 61 | +libvcs is pre-1.0. Pin to a range: `libvcs>=0.39,<0.40` |
| 62 | +``` |
| 63 | + |
| 64 | +See [Quickstart](quickstart.md) for all methods and first steps. |
| 65 | + |
| 66 | +## At a glance |
| 67 | + |
| 68 | +```python |
| 69 | +from libvcs.url.git import GitURL |
| 70 | + |
| 71 | +url = GitURL(url="git@github.com:vcs-python/libvcs.git") |
| 72 | +url.hostname # 'github.com' |
| 73 | +url.path # 'vcs-python/libvcs' |
| 74 | + |
| 75 | +GitURL.is_valid(url="https://github.com/vcs-python/libvcs.git") |
| 76 | +# True |
| 77 | +``` |
| 78 | + |
| 79 | +libvcs gives you typed dataclasses for every parsed URL, thin CLI |
| 80 | +wrappers for `git` / `hg` / `svn`, and high-level sync that clones or |
| 81 | +updates a local checkout in one call. |
| 82 | + |
| 83 | +| Layer | Module | Purpose | |
| 84 | +|-------|--------|---------| |
| 85 | +| URL parsing | {mod}`libvcs.url` | Detect, validate, normalize VCS URLs | |
| 86 | +| Commands | {mod}`libvcs.cmd` | Execute individual VCS CLI operations | |
| 87 | +| Sync | {mod}`libvcs.sync` | Clone and update local repositories | |
| 88 | + |
| 89 | +## Testing |
| 90 | + |
| 91 | +libvcs ships a [pytest plugin](api/pytest-plugin.md) with |
| 92 | +session-scoped fixtures for Git, SVN, and Mercurial repositories: |
| 93 | + |
| 94 | +```python |
| 95 | +def test_my_tool(create_git_remote_repo): |
| 96 | + repo_path = create_git_remote_repo() |
| 97 | + assert repo_path.exists() |
19 | 98 | ``` |
20 | 99 |
|
21 | 100 | ```{toctree} |
22 | | -:caption: Project |
23 | 101 | :hidden: |
24 | 102 |
|
25 | | -contributing/index |
| 103 | +quickstart |
| 104 | +topics/index |
| 105 | +api/index |
26 | 106 | internals/index |
| 107 | +project/index |
27 | 108 | history |
28 | 109 | migration |
29 | | -GitHub <https://github.com/vcs-python/libvcs> |
30 | | -
|
31 | 110 | ``` |
0 commit comments