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.8
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.8.tar.gz | 28.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nthp_api-0.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 64.8 kB
Release files / nthp_api-0.1.8.tar.gz
| Download URL | nthp_api-0.1.8.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a27e7f901220e7601c28ad2cee2fd3e0c694ac41d51046ad26a32cefce8bd80
|
|
BLAKE2b-256 checksum How to use checksums |
62eabbd3e75b2a50867c4d8ba537cef177ca146046d5bc5cabe8e7ece0030d96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-46-generic
|
Release files / nthp_api-0.1.8-py3-none-any.whl
| Download URL | nthp_api-0.1.8-py3-none-any.whl |
|---|---|
| Size | 36.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73d61e658d88a5d80843d7531575e5244ac0160903be0063dfb765f86fb7ce8f
|
|
BLAKE2b-256 checksum How to use checksums |
a12887a603891cce8d573f9e226b076c330018c69d7dea6866ecf05b932c235f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.19.0-46-generic
|