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