python-hglib
Mercurial Python library
What it is and what it does
python-hglib is a Python library that wraps Mercurial's command server to provide a programmatic interface to hg operations. Instead of shelling out to the hg command-line tool, it communicates directly with Mercurial's server mode, which the library describes as offering a fast and convenient way to interact with repositories from Python code.
The package is designed for developers who need to automate or script Mercurial workflows—for example, querying repository state, running commits, or managing branches programmatically. However, the package has been abandoned since its last release on 2020-11-17 and classifiers only list Python up to 3.4, making it a legacy tool unsuitable for new projects unless you are maintaining existing Mercurial-based infrastructure.
Use it for:
- Automating Mercurial repository operations in build or deployment scripts that cannot use the command-line hg tool directly.
- Writing tools that need to query Mercurial repository metadata or history programmatically.
- Integrating Mercurial version control into Python applications that manage or monitor multiple repositories.
- Legacy system maintenance where existing Python code depends on hglib for Mercurial interaction.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
python-hglib provides a Python interface to Mercurial version control by communicating with Mercurial's command server, enabling programmatic access to hg operations.
No, unless you are maintaining legacy code already using this package. The project is abandoned (last release 2020-11-17), classifiers only list Python up to 3.4, and high install friction suggests unresolved system dependencies. For new Mercurial automation, consider alternatives or direct command-line invocation.
Install
python-hglib on PyPI
pip
pip install python-hglibuv
uv add python-hglibpoetry
poetry add python-hglibInstalling python-hglib
Before you install
Installation friction is high and maintenance is abandoned—the package has not been updated since 2020-11-17. No recent commits or repository activity are available. Caution is warranted for new projects.
License in practice
Licensed under MIT (permissive), so you may use, modify, and distribute the package freely with minimal restrictions.
Quickstart
pip install python-hglib
from hglib.client import hg
repo = hg.open('/path/to/repo')
log = repo.log()
repo.close()
Requires Mercurial to be installed and the hg command server to be available on the system; high install friction suggests potential compiled dependencies or system-level configuration.
Verify before relying
- Whether the package works reliably with modern Python versions beyond 3.4, given its age and lack of maintenance.
- Current compatibility with recent Mercurial releases and whether the command server protocol has changed.
- Whether high install friction is due to compiled dependencies or other system-level requirements.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 2,096 days since the last release |
| First released | |
| Downloads | 76,923/month — #14,578 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: python-hglib-2.6.2.tar.gz
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
mercurialMercurial is a distributed version control…
copyleft · top 15,000 on PyPI
argparseProvides command-line argument parsing for…
permissive · top 1,000 on PyPI
scrapinghubA Python client library for communicating with…
permissive · top 15,000 on PyPI
bump2versionA command-line tool that automates version…
permissive · top 5,000 on PyPI
bumpversionA command-line tool that automates version…
permissive · top 5,000 on PyPI
versioningitAutomatically determines your Python package's…
permissive · top 5,000 on PyPI
hidProvides Python bindings to the hidapi library…
permissive · top 15,000 on PyPI
hjsonParses and generates Hjson (a human-friendly…
permissive · top 5,000 on PyPI
setuptools-scmAutomatically extracts and manages Python…
permissive · top 1,000 on PyPI
gnureadlineProvides GNU Readline library support for…
copyleft · top 15,000 on PyPI