gitpure 1.0.8__cp315-cp315-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gitpure/__init__.py +5 -0
- gitpure/__init__.pyi +109 -0
- gitpure/gitpure.cp315-win_amd64.pyd +0 -0
- gitpure/py.typed +0 -0
- gitpure-1.0.8.dist-info/METADATA +160 -0
- gitpure-1.0.8.dist-info/RECORD +9 -0
- gitpure-1.0.8.dist-info/WHEEL +4 -0
- gitpure-1.0.8.dist-info/licenses/LICENSE +21 -0
- gitpure-1.0.8.dist-info/sboms/gitpure.cyclonedx.json +8906 -0
gitpure/__init__.py
ADDED
gitpure/__init__.pyi
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Type stubs for gitpure - A pure git Python module implemented in Rust.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Type
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Commit:
|
|
10
|
+
"""Lightweight representation of a git commit."""
|
|
11
|
+
|
|
12
|
+
@property
|
|
13
|
+
def hexsha(self) -> str:
|
|
14
|
+
"""Hexadecimal object id of the commit."""
|
|
15
|
+
...
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Head:
|
|
19
|
+
"""A named reference to a commit, mirroring GitPython's Head."""
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def name(self) -> str:
|
|
23
|
+
"""The short name of the head (branch)."""
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
@property
|
|
27
|
+
def commit(self) -> Commit | None:
|
|
28
|
+
"""The commit the head points to, if available."""
|
|
29
|
+
...
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Tag:
|
|
33
|
+
"""A tag reference with optional peeled commit."""
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def name(self) -> str:
|
|
37
|
+
"""The short name of the tag."""
|
|
38
|
+
...
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def commit(self) -> Commit | None:
|
|
42
|
+
"""The commit the tag ultimately refers to, if available."""
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
class Repo:
|
|
46
|
+
"""A git repository wrapper using gix (gitoxide)."""
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def git_dir(self) -> Path:
|
|
50
|
+
"""
|
|
51
|
+
Path to the .git directory of the repository.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
The absolute path to the .git directory as a pathlib.Path object
|
|
55
|
+
"""
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def branches(self) -> list[Head]:
|
|
60
|
+
"""Return all local branches as Head objects."""
|
|
61
|
+
...
|
|
62
|
+
|
|
63
|
+
@property
|
|
64
|
+
def working_tree_dir(self) -> Path | None:
|
|
65
|
+
"""Return the working tree directory of the repository, if it exists."""
|
|
66
|
+
...
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def is_bare(self) -> bool:
|
|
70
|
+
"""Whether the repository is bare (has no working tree)."""
|
|
71
|
+
...
|
|
72
|
+
|
|
73
|
+
@property
|
|
74
|
+
def active_branch(self) -> Head | None:
|
|
75
|
+
"""Current active branch as a Head object, if available."""
|
|
76
|
+
...
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def head(self) -> Head | None:
|
|
80
|
+
"""HEAD reference as a Head object, if available."""
|
|
81
|
+
...
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def heads(self) -> list[Head]:
|
|
85
|
+
"""Return all local heads (branches) in the repository."""
|
|
86
|
+
...
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def tags(self) -> list[Tag]:
|
|
90
|
+
"""Return all tags in the repository."""
|
|
91
|
+
...
|
|
92
|
+
|
|
93
|
+
@classmethod
|
|
94
|
+
def clone_from(cls: Type["Repo"], url: str, to_path: str, bare: bool = False) -> "Repo":
|
|
95
|
+
"""
|
|
96
|
+
Clone a repository from a URL to a local path.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
url: The URL of the repository to clone
|
|
100
|
+
to_path: The local path where the repository should be cloned
|
|
101
|
+
bare: Whether to create a bare repository (default: False)
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
A new Repo instance representing the cloned repository
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
RuntimeError: If the clone operation fails
|
|
108
|
+
"""
|
|
109
|
+
...
|
|
Binary file
|
gitpure/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gitpure
|
|
3
|
+
Version: 1.0.8
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Intended Audience :: Developers
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
17
|
+
Classifier: Programming Language :: Rust
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Topic :: Software Development :: Version Control
|
|
20
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Dist: pytest ; extra == 'test'
|
|
23
|
+
Requires-Dist: gitpython>=3.1 ; extra == 'test'
|
|
24
|
+
Provides-Extra: test
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Summary: A Python git library implemented in Rust using gitoxide
|
|
27
|
+
Keywords: git,python,rust,gitoxide,version-control
|
|
28
|
+
Home-Page: https://github.com/cmeister2/gitpure
|
|
29
|
+
Author-email: Max Dymond <cmeister2@gmail.com>
|
|
30
|
+
Maintainer-email: Max Dymond <cmeister2@gmail.com>
|
|
31
|
+
License: MIT
|
|
32
|
+
Requires-Python: >=3.8
|
|
33
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
34
|
+
Project-URL: Bug Reports, https://github.com/cmeister2/gitpure/issues
|
|
35
|
+
Project-URL: Documentation, https://github.com/cmeister2/gitpure
|
|
36
|
+
Project-URL: Homepage, https://github.com/cmeister2/gitpure
|
|
37
|
+
Project-URL: Repository, https://github.com/cmeister2/gitpure
|
|
38
|
+
Project-URL: Source Code, https://github.com/cmeister2/gitpure
|
|
39
|
+
|
|
40
|
+
# gitpure
|
|
41
|
+
|
|
42
|
+
[](https://github.com/cmeister2/gitpure/actions/workflows/CI.yml)
|
|
43
|
+
[](https://badge.fury.io/py/gitpure)
|
|
44
|
+
[](https://pypi.org/project/gitpure/)
|
|
45
|
+
|
|
46
|
+
A pure git Python library implemented in Rust using [gitoxide](https://github.com/Byron/gitoxide). This library provides fast and memory-efficient git operations through Python bindings.
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **Fast**: Built with Rust and gitoxide for optimal performance
|
|
51
|
+
- **Memory efficient**: Leverages Rust's memory management
|
|
52
|
+
- **Cross-platform**: Works on Linux, macOS, and Windows
|
|
53
|
+
- **Pure Python interface**: Easy to use Python API
|
|
54
|
+
- **Safe**: Thread-safe operations with Rust's ownership model
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Install from PyPI:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install gitpure
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
import gitpure
|
|
68
|
+
|
|
69
|
+
# Clone a repository (with worktree)
|
|
70
|
+
repo = gitpure.Repo.clone_from("https://github.com/user/repo.git", "/path/to/local/repo")
|
|
71
|
+
|
|
72
|
+
# Clone a bare repository
|
|
73
|
+
bare_repo = gitpure.Repo.clone_from("https://github.com/user/repo.git", "/path/to/bare/repo", bare=True)
|
|
74
|
+
|
|
75
|
+
# Get the git directory path
|
|
76
|
+
git_dir = repo.git_dir
|
|
77
|
+
print(f"Git directory: {git_dir}")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
### Prerequisites
|
|
83
|
+
|
|
84
|
+
- Python 3.8+
|
|
85
|
+
- Rust 1.70+
|
|
86
|
+
- maturin
|
|
87
|
+
|
|
88
|
+
### Building from Source
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Clone the repository
|
|
92
|
+
git clone https://github.com/cmeister2/gitpure.git
|
|
93
|
+
cd gitpure
|
|
94
|
+
|
|
95
|
+
# Create a virtual environment
|
|
96
|
+
python -m venv venv
|
|
97
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
98
|
+
|
|
99
|
+
# Install maturin
|
|
100
|
+
pip install maturin
|
|
101
|
+
|
|
102
|
+
# Build and install in development mode
|
|
103
|
+
maturin develop
|
|
104
|
+
|
|
105
|
+
# Or build wheel
|
|
106
|
+
maturin build --release
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Running Tests
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Install test dependencies
|
|
113
|
+
pip install pytest
|
|
114
|
+
|
|
115
|
+
# Run tests
|
|
116
|
+
pytest tests/
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Release process
|
|
120
|
+
|
|
121
|
+
Releases are fully automated with [semantic-release](https://semantic-release.gitbook.io/). The pipeline will:
|
|
122
|
+
|
|
123
|
+
1. Inspect the commit history on `main` using Conventional Commits to determine the next semantic version.
|
|
124
|
+
2. Prepare the Rust crate, using the next version (or a dev version if available).
|
|
125
|
+
3. Build wheels and source distributions with `maturin` and attach them to the GitHub release.
|
|
126
|
+
4. Publish the distribution artifacts to PyPI.
|
|
127
|
+
|
|
128
|
+
To keep releases working you must:
|
|
129
|
+
|
|
130
|
+
- Continue to write commits that follow the Conventional Commits specification (`feat:`, `fix:`, etc.).
|
|
131
|
+
|
|
132
|
+
You can trigger a release by merging changes into `main`.
|
|
133
|
+
|
|
134
|
+
## Architecture
|
|
135
|
+
|
|
136
|
+
gitpure is built on top of:
|
|
137
|
+
|
|
138
|
+
- **[gitoxide](https://github.com/Byron/gitoxide)**: A pure Rust implementation of git
|
|
139
|
+
- **[PyO3](https://github.com/PyO3/pyo3)**: Python bindings for Rust
|
|
140
|
+
- **[maturin](https://github.com/PyO3/maturin)**: Build tool for Python extensions written in Rust
|
|
141
|
+
|
|
142
|
+
## Contributing
|
|
143
|
+
|
|
144
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
145
|
+
|
|
146
|
+
### Development Setup
|
|
147
|
+
|
|
148
|
+
1. Fork the repository
|
|
149
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
150
|
+
3. Make your changes
|
|
151
|
+
4. Add tests for your changes
|
|
152
|
+
5. Ensure all tests pass (`pytest`)
|
|
153
|
+
6. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
154
|
+
7. Push to the branch (`git push origin feature/amazing-feature`)
|
|
155
|
+
8. Open a Pull Request
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
160
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
gitpure/__init__.py,sha256=pBX_EzrNHWBjqJHS3q15EG7uggKwK8bhi32dp_4klIM,111
|
|
2
|
+
gitpure/__init__.pyi,sha256=cBiocFctPS_yhSJvWZWgHe4b6j8SpEmnmz1glQyUt-0,2801
|
|
3
|
+
gitpure/gitpure.cp315-win_amd64.pyd,sha256=qdv736bZASd0fK0AJ8xcWcUfyZaN2PI3OjllSQaDO2c,10696704
|
|
4
|
+
gitpure/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
gitpure-1.0.8.dist-info/METADATA,sha256=i_QFZZjQH3ofBbDt-ck0mB0ebsvHwssPaIeAz2OEkSo,5424
|
|
6
|
+
gitpure-1.0.8.dist-info/WHEEL,sha256=1_h6kx0k2_JFDbRzyfVOsGEcPlSNf1uBTnmW3MNufiU,97
|
|
7
|
+
gitpure-1.0.8.dist-info/licenses/LICENSE,sha256=SIJEt25LmxzShXdFNpvEiVhLAyVzfsdiRMhNU3U8DNo,1086
|
|
8
|
+
gitpure-1.0.8.dist-info/sboms/gitpure.cyclonedx.json,sha256=p4uG6vJ_NER0QCNn96ZemuzidrBjPdpFweIycGs2V2o,300973
|
|
9
|
+
gitpure-1.0.8.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Max Dymond
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|