Installing h in a development environment¶
The code for the https://hypothes.is/ web service and API lives in a Git repo named h. This page will walk you through getting this code running in a local development environment.
See also
- https://github.com/hypothesis/client/ for installing the Hypothesis client
- https://github.com/hypothesis/browser-extension for the browser extension
- To get “direct” or “in context” links working you need to install Bouncer and Via:
See also
Development environment troubleshooting if you run into any problems during installation
You will need¶
Before installing your development environment you’ll need to install each of these prerequisites:
- Git
- Node and npm. On Linux you should follow nodejs.org’s instructions for installing node because the version of node in the standard Ubuntu package repositories is too old. On macOS you should use Homebrew to install node.
- Docker. Follow the instructions on the Docker website to install “Docker Engine - Community”.
- pyenv. Follow the instructions in the pyenv README to install it. The Homebrew method works best on macOS.
Clone the Git repo¶
git clone https://github.com/hypothesis/h.git
This will download the code into an h
directory in your current working
directory. You need to be in the h
directory from the remainder of the
installation process:
cd h
Run the services with Docker Compose¶
Start the services that h requires using Docker Compose:
make services
Create the development data and settings¶
Create the database contents and environment variable settings needed to get h working nicely with your local development instances of the rest of the Hypothesis apps:
make devdata
See also
make devdata
requires you to have a git SSH key set up that has access
to the private https://github.com/hypothesis/devdata repo. Otherwise it’ll
crash. If you can’t use make devdata
(for example because you aren’t a
Hypothesis team member and don’t have access to this repo, or because you’re
setting up a production instance) then see Manually setting up the Hypothesis client integration.
Start the development server¶
make dev
The first time you run make dev
it might take a while to start because
it’ll need to install the application dependencies and build the client assets.
This will start the server on port 5000 (http://localhost:5000), reload the application whenever changes are made to the source code, and restart it should it crash for some reason.
That’s it! You’ve finished setting up your h development environment.
Run make help
to see all the commands that’re available for running the
tests, linting, code formatting, Python and SQL shells, etc.