History Project API Generator
This project generates a JSON API from the history-project content repository. It does that in two steps:
- load: Generate a sqlite database from the source files.
- dump: Use that database to generate a JSON API.
Endpoints
- The API is currently hosted at https://nthp-api.wjdp.uk/v1.
- The specification is available at https://nthp-api.wjdp.uk/v1/master/openapi.json.
- To render the spec into human-readable docs use a tool such as:
Usage
From source
- Ensure you have uv installed.
- Run
uv sync. - Clone the history project repository into the
content/directory. You can do a shallow clone for this:GIT_LFS_SKIP_SMUDGE=1 git clone --depth 1 --branch master git@github.com:newtheatre/history-project content. - Run
./nthp loadto generate the sqlite database from the content files. - Run
./nthp dumpto generate the API from the database into thedist/directory.
From PyPi
- With pip installed run
pip install --user nthp-api. If you have your local bin folder on your path you should now be able to runnthp. - Within the history-project repo run
nthp loadto generate the sqlite database from the content files. - Run
nthp dumpto generate the API from the database into thedist/directory.
Alternatively you can run nthp build to run both steps in one go.
Contributing
Git hooks
Git hooks are used to lint and format the source code using ruff
- Ensure you have prek installed.
- Run
prek installto install the hooks. - Run
prek run --all-filesto check everything.
Tests
Run uv run pytest.
Release
See the bin/release.sh script for the release process. This assumes that your local machine has the correct credentials to publish to PyPi.
Metadata
Release files for nthp_api 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nthp_api-0.2.0.tar.gz | 29.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nthp_api-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.0 kB
Release files / nthp_api-0.2.0.tar.gz
| Download URL | nthp_api-0.2.0.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da92d7cc02861d7762331e6b57e0d122e70afe167fbc42d1010f4896becf0e5b
|
|
BLAKE2b-256 checksum How to use checksums |
6fde1cd45a317cb66de14121d8e434f4446762957acf46c40599a0bfd82ae0d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / nthp_api-0.2.0-py3-none-any.whl
| Download URL | nthp_api-0.2.0-py3-none-any.whl |
|---|---|
| Size | 41.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f920e6db72f44b20fa5abb7e6d3c53fb0f68b0c45d098594dce975f00a54829b
|
|
BLAKE2b-256 checksum How to use checksums |
706ce5203214411db4df62d27fa9f9587acc1f288ab4ee9c12c2e67c73d1febf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|