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 Poetry installed.
- Run
poetry install. - 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
pre-commit hooks
pre-commit hooks are used to lint the source code using Black and ruff
- Ensure you have pre-commit installed.
- Run
pre-commit installto install pre-commit hooks.
Tests
Run pytest or use the included PyCharm run configuration.
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.1.9
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.1.9.tar.gz | 27.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nthp_api-0.1.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 65.5 kB
Release files / nthp_api-0.1.9.tar.gz
| Download URL | nthp_api-0.1.9.tar.gz |
|---|---|
| Size | 27.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64b117c5e7c698927e2df61e62f2850216a23b1a8781031fae4b97870479b94c
|
|
BLAKE2b-256 checksum How to use checksums |
aa46eaed7960346b16a3c65c30b00a489c32ec85d025dee06e8c2ca79634782d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.6 Linux/7.1.8-1-cachyos
|
Release files / nthp_api-0.1.9-py3-none-any.whl
| Download URL | nthp_api-0.1.9-py3-none-any.whl |
|---|---|
| Size | 37.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f5c85ccf7f16926ef32360c7d3af4efb9e799bfa9e6d23f7f13f8e946df42c53
|
|
BLAKE2b-256 checksum How to use checksums |
ab61cc9555458cef65604193c6c03b774dee1be8dc9c83c933767357e02240ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.6 Linux/7.1.8-1-cachyos
|