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.3.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.3.0.tar.gz | 30.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nthp_api-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.0 kB
Release files / nthp_api-0.3.0.tar.gz
| Download URL | nthp_api-0.3.0.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48c028f28ab55677968b4f73fe511cecb9562276ee7686908c6bf45f217faa8b
|
|
BLAKE2b-256 checksum How to use checksums |
6120d58c484147c8afc4bb1a406004130fcea6dbf0df4aaa5a6421d0fc60c9da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"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.3.0-py3-none-any.whl
| Download URL | nthp_api-0.3.0-py3-none-any.whl |
|---|---|
| Size | 42.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79699ac892ccbf2177e45cb5aff10308e5edb00fef6a18fa34e11dabec0256f0
|
|
BLAKE2b-256 checksum How to use checksums |
fd3cd890dc4e201167d924deccdf4e4194a9cbe25054805ea5fcffdae14c4d6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"CachyOS Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|