Installation
Stable release
To install Heritage.py, run this command in your terminal:
$ pip install heritage
This is the preferred method to install Heritage.py, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
From sources
The sources for Heritage.py can be downloaded from the Github repo.
You can either clone the public repository:
$ git clone git://github.com/hrishikeshrt/heritage
Or download the tarball:
$ curl -OJL https://github.com/hrishikeshrt/heritage/tarball/master
Once you have a copy of the source, you can install it with:
$ python setup.py install
Editable installs and development tooling
While working on the wrapper itself it can be convenient to install it in editable mode and pull in the additional development utilities:
$ pip install -e .
$ pip install -r requirements_dev.txt
This setup keeps your virtual environment in sync with the source tree and exposes linting and documentation dependencies.
Using a local Heritage Platform checkout
The Python wrapper can invoke the CGI-style binaries from the upstream
Heritage_Platform repository. This makes lookups faster and removes the
network dependency.
Follow the official installation guide to build the tools.
Ensure executables such as
./ML/readerare present and runnable.Point Heritage.py at the checkout:
import os
from heritage import HeritagePlatform
platform = HeritagePlatform(
base_dir=os.path.expanduser("~/git/Heritage_Platform"),
method="shell",
)
Optional: switch back to the web mirror by calling
platform.set_method("web").
Heritage.py validates <base_dir>/ML and falls back to HTTP mode if the
directory is missing, logging a warning in the process.