Skip to content

Commit d86662e

Browse files
committed
Release 1.19.3
1 parent 9433ecd commit d86662e

5 files changed

Lines changed: 146 additions & 52 deletions

File tree

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Matthew Duggan <mduggan@qti.qualcomm.com> <mgithub@guarana.org>
2222
Matthew Gamble <git@matthewgamble.net>
2323
Matthias Bartelmeß <mba@fourplusone.de>
2424
Mikhail Yushkovskiy <mailto@zensecurity.su>
25+
Mukunda Rao Katta <mukunda.vjcs6@gmail.com>
2526
Nabijacz Leweli <nabijaczleweli@nabijaczleweli.xyz>
2627
Nicolas Rybowski <nicolas.rybowski@uclouvain.be>
2728
Óscar San José <osanjose@tuenti.com>

AGENTS.md

Lines changed: 141 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
## Project Overview
44

5-
**pygit2** is a Python library providing bindings to [libgit2](https://libgit2.org/), the shared C library that implements Git plumbing operations. It exposes both a low-level API (direct libgit2 wrappers) and a high-level Pythonic API for repository manipulation.
5+
**pygit2** is a Python library that provides bindings to
6+
[libgit2](https://libgit2.org/), the shared C library that implements Git
7+
plumbing operations. It exposes both a low-level API (direct libgit2 wrappers)
8+
and a high-level, Pythonic API for repository manipulation.
69

7-
- **Version**: 1.19.2
8-
- **License**: GPLv2 with linking exception
10+
- **Version**: 1.19.3 (canonical version is defined in `pygit2/_build.py`)
11+
- **License**: GPLv2 with linking exception (see `COPYING`)
912
- **Maintainer**: J. David Ibáñez
1013
- **Python Support**: 3.11 – 3.14 and PyPy3 7.3+
1114
- **libgit2 Version**: 1.9.4
@@ -14,50 +17,78 @@
1417

1518
## Architecture
1619

17-
The project uses a **hybrid C/Python** architecture with two compiled extension modules:
20+
The project uses a **hybrid C/Python** architecture with two compiled extension
21+
modules:
1822

19-
- **`src/`** — C11 source files that compile into the `_pygit2` C extension module. Each file generally maps to a libgit2 concept:
23+
- **`src/`** — C11 source and header files that compile into the `_pygit2` C
24+
extension module. Each file generally maps to a libgit2 concept:
2025
- Core objects: `blob.c`, `commit.c`, `object.c`, `tag.c`, `tree.c`
21-
- Repository and refs: `repository.c`, `branch.c`, `reference.c`, `refdb.c`, `refdb_backend.c`, `revspec.c`
26+
- Repository, refs and branches: `repository.c`, `branch.c`, `reference.c`,
27+
`refdb.c`, `refdb_backend.c`, `revspec.c`, `worktree.c`
2228
- Diff and patch: `diff.c`, `patch.c`
23-
- ODB and backend: `odb.c`, `odb_backend.c`
24-
- Filters and mailmap: `filter.c`, `mailmap.c`
25-
- Notes and signatures: `note.c`, `signature.c`
26-
- Main module init: `pygit2.c`
29+
- ODB and backends: `odb.c`, `odb_backend.c`
30+
- Index, walking and helpers: `treebuilder.c`, `walker.c`, `oid.c`,
31+
`note.c`, `signature.c`, `mailmap.c`, `stash.c`
32+
- Filters: `filter.c`
33+
- Module infrastructure: `pygit2.c`, `error.c`, `utils.c`, `wildmatch.c`
34+
- Headers: `*.h` files mirroring the C sources (e.g. `repository.h`,
35+
`diff.h`, `types.h`, `error.h`)
2736

2837
- **`pygit2/`** — The main Python package.
29-
- **`_pygit2*.so`** — Compiled C extension (built from `src/`).
30-
- **`_libgit2.abi3.so`** — CFFI-generated ABI module built from `pygit2/_run.py`.
31-
- **`decl/`** — C header stub files used by CFFI to define the libgit2 API surface (e.g., `types.h`, `repository.h`, `callbacks.h`, `diff.h`, `remote.h`).
32-
- **`_build.py`** — Build-time helpers and the canonical `__version__` string. Also used at runtime to locate libgit2. Must remain importable without the rest of the package being built because `setup.py` imports it.
33-
- **`_run.py`** — CFFI build script that aggregates `decl/*.h` and compiles `pygit2._libgit2`.
38+
- **`_pygit2*.so`** — Compiled C extension built from `src/`.
39+
- **`_libgit2.abi3.so`** — CFFI-generated ABI module built from
40+
`pygit2/_run.py`.
41+
- **`decl/`** — C header stub files used by CFFI to define the libgit2 API
42+
surface (e.g. `types.h`, `repository.h`, `callbacks.h`, `diff.h`,
43+
`remote.h`). `pygit2/_run.py` concatenates these stubs in a specific order
44+
before passing them to CFFI.
45+
- **`_build.py`** — Build-time helpers and the canonical `__version__`
46+
string. Also used at runtime to locate libgit2. It must remain importable
47+
without the rest of the package being built because `setup.py` imports it.
48+
- **`_run.py`** — CFFI build script that aggregates `decl/*.h` and compiles
49+
`pygit2._libgit2`.
3450
- **`ffi.py`** — Runtime import of the CFFI `ffi` and `lib` (`C`) objects.
35-
- **`_pygit2.pyi`** — Type stubs for the C extension. Keep it in sync when adding or changing low-level APIs.
51+
- **`_pygit2.pyi`** — Type stubs for the C extension. Keep it in sync when
52+
adding or changing low-level APIs.
3653
- **`py.typed`** — PEP 561 marker indicating the package is typed.
37-
- **High-level modules** — Pure-Python wrappers that sit on top of the C extension:
38-
`repository.py`, `callbacks.py`, `config.py`, `index.py`, `remotes.py`, `settings.py`, `submodules.py`, `transaction.py`, `filter.py`, `blob.py`, `blame.py`, `credentials.py`, `errors.py`, `options.py`, `packbuilder.py`, `references.py`, `refspec.py`, `utils.py`, `enums.py`, `legacyenums.py`.
54+
- **High-level modules** — Pure-Python wrappers that sit on top of the C
55+
extension:
56+
`repository.py`, `callbacks.py`, `config.py`, `index.py`, `remotes.py`,
57+
`settings.py`, `submodules.py`, `transaction.py`, `filter.py`, `blob.py`,
58+
`blame.py`, `branches.py`, `credentials.py`, `errors.py`, `options.py`,
59+
`packbuilder.py`, `references.py`, `refspec.py`, `utils.py`, `enums.py`,
60+
`legacyenums.py`.
3961

4062
- **`test/`** — pytest suite with fixture-based repository handling.
4163
- **`docs/`** — Sphinx documentation (RTD theme).
4264

4365
## Key Configuration Files
4466

45-
- **`setup.py`** — setuptools entry point. Builds both the C extension (`src/*.c`) and the CFFI extension (`pygit2/_run.py:ffi`).
46-
- **`pyproject.toml`** — Build system requirements, `cibuildwheel` configuration, `ruff` settings, and `codespell` settings.
67+
- **`setup.py`** — setuptools entry point. Builds both the C extension
68+
(`src/*.c`) and the CFFI extension (`pygit2/_run.py:ffi`).
69+
- **`pyproject.toml`** — Build-system requirements, `cibuildwheel`
70+
configuration, `ruff` settings, and `codespell` settings.
4771
- **`setup.cfg`** — Legacy pycodestyle configuration.
48-
- **`pytest.ini`** — pytest configuration (`--capture=no -ra --verbose`, `testpaths = test/`).
72+
- **`pytest.ini`** — pytest configuration (`--capture=no -ra --verbose`,
73+
`testpaths = test/`).
4974
- **`mypy.ini`** — mypy configuration with strict settings.
50-
- **`mypy-stubtest.ini`** — mypy configuration for `stubtest` against `_pygit2.pyi`.
51-
- **`requirements.txt`** — Runtime/build requirements (`cffi>=2.0`, `setuptools` for Python >= 3.12).
75+
- **`mypy-stubtest.ini`** — mypy configuration for `stubtest` against
76+
`_pygit2.pyi`.
77+
- **`requirements.txt`** — Runtime/build requirements (`cffi>=2.0`,
78+
`setuptools` for Python >= 3.12).
5279
- **`requirements-test.txt`** — Test requirements (`pytest`, `pytest-cov`).
5380
- **`requirements-typing.txt`** — Typing requirements (`mypy`, `types-cffi`).
54-
- **`Makefile`** — Convenience targets: `make` builds deps + extension inplace; `make html` builds docs.
81+
- **`Makefile`** — Convenience targets: `make` builds dependencies + extension
82+
inplace; `make html` builds docs.
83+
- **`.vimrc`** — Local editor configuration for C development with ALE
84+
(`-std=c11 -Wall`, Python include path, `/usr/local/include`).
5585

5686
## Build and Test Commands
5787

5888
### Quick Development Build (inplace)
5989

60-
Requires libgit2 development headers and library to be installed on the system or pointed to via the `LIBGIT2` environment variable.
90+
Requires libgit2 development headers and library to be installed on the system
91+
or pointed to via the `LIBGIT2` environment variable.
6192

6293
```bash
6394
python setup.py build_ext --inplace
@@ -66,7 +97,9 @@ pytest
6697

6798
### Full Build with Dependencies
6899

69-
The `build.sh` script can download, compile, and bundle libgit2 (and optionally libssh2 and OpenSSL) into a local prefix. On Windows, `build.ps1` handles libgit2 compilation via CMake.
100+
The `build.sh` script can download, compile, and bundle libgit2 (and optionally
101+
libssh2, OpenSSL, and zlib) into a local prefix. On Windows, `build.ps1`
102+
handles libgit2 compilation via CMake.
70103

71104
```bash
72105
# Build inplace with bundled libgit2/libssh2/OpenSSL
@@ -75,14 +108,14 @@ make
75108
# Or manually:
76109
LIBSSH2_VERSION=1.11.1 LIBGIT2_VERSION=1.9.4 sh build.sh
77110

78-
# Build inplace + run tests
111+
# Build inplace and run the tests
79112
sh build.sh test
80113

81-
# Build a wheel, install it, and run tests
114+
# Build a wheel, install it, and run the tests
82115
sh build.sh wheel
83116

84117
# Run tests with coverage
85-
sh build.sh test # (build.sh already adds --cov=pygit2)
118+
sh build.sh test # build.sh adds --cov=pygit2
86119

87120
# Run mypy type checking
88121
sh build.sh mypy
@@ -91,13 +124,32 @@ sh build.sh mypy
91124
sh build.sh stubtest
92125
```
93126

127+
`build.sh` creates a virtual environment under `ci/<python_tag>/` by default,
128+
where `<python_tag>` is computed by `build_tag.py`. Use the `PYTHON`
129+
environment variable to select a different interpreter (default: `python3`).
130+
94131
### Environment Variables
95132

96-
- `LIBGIT2` — Base path where libgit2 is installed (default: `/usr/local` or `%ProgramFiles%\libgit2` on Windows).
133+
Variables consumed by `setup.py` / `pygit2/_build.py`:
134+
135+
- `LIBGIT2` — Base path where libgit2 is installed (default: `/usr/local` or
136+
`%ProgramFiles%\libgit2` on Windows).
97137
- `LIBGIT2_LIB` — Override the library directory specifically.
98-
- `LIBGIT2_VERSION` — If set, `build.sh` downloads and builds this libgit2 version.
99-
- `LIBSSH2_VERSION` — If set, `build.sh` downloads and builds libssh2 with SSH support.
100-
- `OPENSSL_VERSION` — If set, `build.sh` downloads and builds OpenSSL (mainly used for macOS universal builds on CI).
138+
139+
Variables consumed by `build.sh`:
140+
141+
- `LIBGIT2_VERSION` — If set, download and build this libgit2 version.
142+
- `LIBSSH2_VERSION` — If set, download and build libssh2 with SSH support.
143+
- `OPENSSL_VERSION` — If set, download and build OpenSSL (mainly used for
144+
macOS universal builds on CI).
145+
- `ZLIB_VERSION` — If set, download and build zlib.
146+
- `BUILD_TYPE` — CMake build type (default: `Debug`).
147+
- `PYTHON` — Python interpreter to use (default: `python3`).
148+
- `PREFIX` — Installation prefix (default: `$(pwd)/ci/$PYTHON_TAG`).
149+
- `CIBUILDWHEEL` — Set to `1` when invoked by cibuildwheel; changes package
150+
manager and directory layout.
151+
- `AUDITWHEEL_PLAT` — Linux platform for auditwheel repair.
152+
- `LIBSSH2_OPENSSL` — Where to find OpenSSL when building libssh2.
101153

102154
### Documentation Build
103155

@@ -117,12 +169,16 @@ make -C docs html # requires sphinx-rtd-theme
117169
- Selected rules: `E4`, `E7`, `E9`, `F`, `I`, `UP035`, `UP007`
118170
- **Type checker**: mypy (strict settings enabled; see `mypy.ini`)
119171
- All Python source files must include the standard GPLv2 copyright header.
172+
- `pygit2/__init__.py` is large because it re-exports a large surface of
173+
constants and classes; follow existing patterns when adding new public
174+
symbols.
120175

121176
### C
122177

123178
- Standard: C11
124179
- All C source files must include the standard GPLv2 copyright header.
125-
- The `.vimrc` at repo root configures ALE with `-std=c11 -Wall` and includes the Python headers and `/usr/local/include`.
180+
- The `.vimrc` at repo root configures ALE with `-std=c11 -Wall` and includes
181+
the Python headers and `/usr/local/include`.
126182

127183
### Docstrings
128184

@@ -158,31 +214,66 @@ def f(a, b):
158214
addopts = --capture=no -ra --verbose
159215
testpaths = test/
160216
```
161-
- **Fixtures**: Defined in `test/conftest.py`. They yield `pygit2.Repository` instances extracted from zipped sample repos in `test/data/` (e.g., `testrepo.zip`, `barerepo.zip`).
162-
- **Test utilities**: `test/utils.py` provides helpers such as `TemporaryRepository`, network/proxy/SSH skip markers, and `diff_safeiter`.
163-
- **Isolation**: The session-scoped `global_git_config` fixture clears `GLOBAL`, `XDG`, and `SYSTEM` config search paths to ensure reproducibility.
217+
- **Fixtures**: Defined in `test/conftest.py`. They yield `pygit2.Repository`
218+
instances extracted from zipped sample repos in `test/data/` (e.g.
219+
`testrepo.zip`, `barerepo.zip`). Named fixtures include `testrepo`,
220+
`testrepo_path`, `barerepo`, `barerepo_path`, `emptyrepo`, `dirtyrepo`,
221+
`mergerepo`, `encodingrepo`, `testrepopacked`, `gpgsigned`, `blameflagsrepo`,
222+
and `pygit2_empty_key`.
223+
- **Test utilities**: `test/utils.py` provides helpers such as
224+
`TemporaryRepository`, `gen_blob_sha1`, `rmtree`, `diff_safeiter`, and
225+
markers like `requires_network`, `requires_proxy`, `requires_ssh`,
226+
`requires_refcount`, `fails_in_macos`, and `requires_future_libgit2`.
227+
- **Isolation**: The session-scoped `global_git_config` fixture clears
228+
`GLOBAL`, `XDG`, and `SYSTEM` config search paths to ensure reproducibility.
164229
- **Coverage**: `pytest-cov` is used; run via `sh build.sh test`.
165230

166231
## CI / Deployment
167232

168233
GitHub Actions workflows live in `.github/workflows/`:
169234

170-
- **`tests.yml`** — Runs on s390x via QEMU (allowed to fail; see issue #812).
171-
- **`lint.yml`** — Runs `ruff format --diff`, `ruff check`, and `sh build.sh mypy`.
172-
- **`wheels.yml`** — Uses `cibuildwheel` to build wheels for Linux (amd64, arm64, ppc64le, musl), macOS (intel, arm64, PyPy), and Windows (x64, x86, arm64). Publishes to PyPI and creates GitHub Releases on version tags (`v*`).
173-
- **`codespell.yml`** — Spell checking.
235+
- **`tests.yml`** — Runs on s390x via QEMU (`uraimo/run-on-arch-action`).
236+
Allowed to fail; see issue #812.
237+
- **`lint.yml`** — Runs `ruff format --diff`, `ruff check`, and
238+
`sh build.sh mypy`.
239+
- **`wheels.yml`** — Uses `cibuildwheel` to build wheels for Linux (amd64,
240+
arm64, ppc64le, musl), macOS (intel, arm64, PyPy), and Windows (x64, x86,
241+
arm64). It also builds an sdist, runs a `twine check`, publishes to PyPI,
242+
and creates a GitHub Release on version tags (`v*`).
243+
- **`codespell.yml`** — Spell checking with the codespell action.
244+
245+
The `cibuildwheel` configuration in `pyproject.toml` pins:
246+
247+
- `LIBGIT2_VERSION="1.9.4"`
248+
- `LIBSSH2_VERSION="1.11.1"`
249+
- `OPENSSL_VERSION="3.5.4"`
250+
251+
and skips `*musllinux_ppc64le` plus testing on `*-*linux_ppc64le` and
252+
`pp*-macosx_arm64`.
174253

175254
## Security Considerations
176255

177-
- The project links against OpenSSL and libssh2. CI pins specific versions of these libraries when building wheels.
178-
- Wheel repair commands (`auditwheel`, `delocate-wheel`) bundle shared libraries so wheels are self-contained.
179-
- Credentials callbacks (`RemoteCallbacks`, `get_credentials`) are the primary interface for supplying secrets; never hardcode credentials in tests.
180-
- Valgrind support: see `docs/development.rst` and `misc/valgrind-python.supp` for memory-leak debugging instructions.
256+
- The project links against OpenSSL and libssh2. CI pins specific versions of
257+
these libraries when building wheels.
258+
- Wheel repair commands (`auditwheel`, `delocate-wheel`) bundle shared
259+
libraries so wheels are self-contained.
260+
- Credentials callbacks (`RemoteCallbacks`, `get_credentials`) are the primary
261+
interface for supplying secrets; never hardcode credentials in tests.
262+
- Valgrind support: see `docs/development.rst` and
263+
`misc/valgrind-python.supp` for memory-leak debugging instructions.
181264

182265
## Useful Notes for Agents
183266

184-
- **Do not assume libgit2 is installed globally.** Check for `LIBGIT2` or use `build.sh`.
185-
- **`pygit2/_build.py`** is imported by `setup.py`; it must remain importable without the rest of the package being built.
186-
- **CFFI and setuptools extensions are both built from `setup.py`.** `ext_modules` builds the C extension from `src/*.c`; `cffi_modules` triggers the CFFI build via `pygit2/_run.py:ffi`.
187-
- **`.pyi` stub file**: `pygit2/_pygit2.pyi` provides type stubs for the C extension. Keep it in sync when adding or changing low-level APIs.
188-
- **`pygit2/__init__.py`** is large because it re-exports a vast surface of constants and classes. Follow existing patterns when adding new public symbols.
267+
- **Do not assume libgit2 is installed globally.** Check for `LIBGIT2` or use
268+
`build.sh` / `make`.
269+
- **`pygit2/_build.py`** is imported by `setup.py`; it must remain importable
270+
without the rest of the package being built.
271+
- **CFFI and setuptools extensions are both built from `setup.py`.**
272+
`ext_modules` builds the C extension from `src/*.c`; `cffi_modules` triggers
273+
the CFFI build via `pygit2/_run.py:ffi`.
274+
- **`.pyi` stub file**: `pygit2/_pygit2.pyi` provides type stubs for the C
275+
extension. Keep it in sync when adding or changing low-level APIs.
276+
- **Header stub order matters**: `pygit2/_run.py` concatenates `decl/*.h` in a
277+
fixed list; add new stubs in the correct position if dependencies require it.
278+
- Run the full test suite and type checks before considering a change complete:
279+
`sh build.sh test` and `sh build.sh mypy`.

AUTHORS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Authors:
7474
Christian Häggström
7575
Edmundo Carmona Antoranz
7676
Erik Johnson
77+
Ethan Meng
7778
Filip Rindler
7879
Fraser Tweedale
7980
Grégoire ROCHER
@@ -206,6 +207,7 @@ Authors:
206207
Matěj Cepl
207208
Maxwell G
208209
Michał Górny
210+
Mukunda Rao Katta
209211
Na'aman Hirschfeld
210212
Nicolas Rybowski
211213
Nicolás Sanguinetti

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 1.19.3 (UNRELEASED)
1+
# 1.19.3 (2026-06-13)
22

33
- Memory fixes
44
[#1368](https://github.com/libgit2/pygit2/issues/1368)

pygit2/_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#
3535
# The version number of pygit2
3636
#
37-
__version__ = '1.19.2'
37+
__version__ = '1.19.3'
3838

3939

4040
#

0 commit comments

Comments
 (0)