A Jetforce application for serving information about UK tidal events over the Gemini Protocol
Project description
GemTide
A Jetforce application for serving information about UK tidal events over the Gemini Protocol.
Take a look | Report a bug | Contact the author
Built with
- Jetforce - framework for writing Gemini applications
- UKHO Tides - client wrapper for the Admiralty UK Tidal API
- Jinja2 - templating engine
Prerequisites
- Python 3.7 or newer
- API key for the UK Tidal API from Admiralty Maritime Data Solutions Developer Portal. The Discovery subscription is free and provides current plus 6 days' worth of events. Follow the Start up guide for help.
Quick Start
Create a virtual environment (Recommended)
$ mkdir /opt/gemtide
$ python3 -m venv /opt/gemtide/venv
$ python3 -m pip install --upgrade pip
$ source /opt/gemtide/venv/bin/activate
Install gemtide package from PyPi
$ pip install gemtide
Create file config.yaml and add:
api_key: Your UK Tidal API key
``
Run the application with a default Jetforce server
```bash
$ python3 -m gemtide
In your preferred gemini client go to gemini://localhost
The application has the following routes:
/- index page with customisable menu/searchprompts for query input/location/name.gmishows tidal events for the named location in gemini text format/location/name.txtshows tidal events for the named location in plain text format
Full Installation Guide
Required packages
For Ubuntu 20.04 LTS:
python3python3-pippython3-venvpython3-devlibffi-devlibssl-dev
For Alpine Edge:
python3python3-devlibffi-devlibc-devgcc
Installation
Create virtual environment as per "Quick Start" above, and install from PyPi.
Or to install from source see "Developing" below.
Usage as a standalone server
Create file config.yaml and add:
api_key: Your UK Tidal API key (required)
station_prefix: Customise the path/prefix of the location routes (default: "location/")
menu: List displayed on index page (default: None)
- link:
label:
server: Options for the Jetforce server configuration
host: (default: "127.0.0.1")
port: (default: 1965)
hostname: (default: "localhost")
tls-certfile: (default: None)
tls-keyfile: (default: None)
tls-cafile: (default: None)
tls-capath: (default: None)
Start the server
$ python3 -m gemtide [path/to/config.yaml]
Or if the virtual environment is not activated
$ /opt/venv/gemtide/bin/gemtide [path/to/config.yaml]
Usage as a custom Jetforce application
See Jetforce README section on Virtual Hosting
Single application
from jetforce import GeminiServer
from gemtide import GemTideApplication
app = GemTideApplication(api_key, station_prefix="location/", menu=[{link: label}])
server = GeminiServer(app)
server.run()
Composite application
from jetforce import GeminiServer, StaticDirectoryApplication
from jetforce.app.composite import CompositeApplication
from gemtide import GemTideApplication
app_gemtide = GemTideApplication(api_key, station_prefix="location/", menu=[{link: label}])
app_default = StaticDirectoryApplication(root_directory="/var/gemini/")
app = CompositeApplication(
{
"gemtide.example.com": app_gemtide,
# Use a default static file server for all other domains
None: app_default,
}
)
Developing
Clone the repository (read-only)
$ git clone https://git.sr.ht/~supergrizzlybear/gemtide
or read/write
$ git clone git@git.sr.ht:~supergrizzlybear/gemtide
Install gemtide from source
$ cd gemtide
$ python3 -m pip install .
Install development dependencies
$ python3 -m pip install freezegun
Test
$ python3 test_gemtide.py
License
This project is licensed under the Floodgap Free Software License.
The Floodgap Free Software License (FFSL) has one overriding mandate: that software using it, or derivative works based on software that uses it, must be free. By free we mean simply "free as in beer" -- you may put your work into open or closed source packages as you see fit, whether or not you choose to release your changes or updates publicly, but you must not ask any fee for it.
Contact
- Email: supergrizzlybear@protonmail.com
- Mastodon: @supergrizzlybear@fosstodon.org
- Gemini: super.grizzlybear.site
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gemtide-0.1.1.tar.gz.
File metadata
- Download URL: gemtide-0.1.1.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95bcd8f13e4e5e71d15b4cc86dd2683373d01bd77c6d71ebbc4c5389cb74a8a4
|
|
| MD5 |
dc10a8643ee98caa373ae06159438e72
|
|
| BLAKE2b-256 |
b44567c5019ac068f7d3fd9461e6c2b983a7b6e7e02c557e59bd758199fc52ac
|
File details
Details for the file gemtide-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gemtide-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6917839b81a62e059916d141178e495c7c45320afad71daf9deb7e30780101b
|
|
| MD5 |
7befd59a7855340a0efdb21ead913fa4
|
|
| BLAKE2b-256 |
fd5edbed475048abb2709fb706002f53efa0d64f79c2902d75f3168a6ac1ee9b
|