aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DEPLOY.md2
-rw-r--r--README.md8
-rw-r--r--backend/hist_data/README.md6
-rw-r--r--backend/requirements.txt12
-rw-r--r--backend/tests/test_chrona.py (renamed from backend/tests/test_histplorer.py)14
-rw-r--r--src/components/HelpModal.vue7
6 files changed, 26 insertions, 23 deletions
diff --git a/DEPLOY.md b/DEPLOY.md
index 98c4077..c8ba1fd 100644
--- a/DEPLOY.md
+++ b/DEPLOY.md
@@ -7,7 +7,7 @@
It's for running `backend/chrona.py` to serve tree-of-life data, and is used instead of CGI to avoid
starting a new process for each request.
1. Change some constants (automated by `prebuild.sh`)
- - In `src/vite.config.js`: Set `base` to the URL path where Chrona will be accessible (eg: `'/chrona'`)
+ - In `vite.config.js`: Set `base` to the URL path where Chrona will be accessible (eg: `'/chrona'`)
- In `src/lib.ts`:
- Set `SERVER_DATA_URL` to the URL where `backend/chrona.py` will be served
(eg: `'https://terryt.dev/chrona/data'`)
diff --git a/README.md b/README.md
index d2ec2c6..6fe0260 100644
--- a/README.md
+++ b/README.md
@@ -54,10 +54,8 @@ More details are in `backend/hist_data/README.md`.
1. If you don't have Python 3 installed, see <https://www.python.org/downloads>.
The package manager Pip is included.
1. The database used by the server is generated using scripts in `backend/hist_data/`.
- See it's README for instructions. You'll likely need to install a few
- packages using Pip.
-1. To run the data server via `backend/server.py`, you'll need to install jsonpickle.
- This can be done using `python -m pip install jsonpickle`.
+ See it's README for instructions. Package dependencies are listed in `backend/requirements.txt`.
+ They can be installed using `pip install -r requirements.txt`.
If you want to keep the installed package separate from your system's packages,
it's common practice to use [venv](https://docs.python.org/3/tutorial/venv.html).
@@ -74,4 +72,4 @@ instructions for deployment on an Apache server on an Ubuntu system.
## Licence
-Chrona is licensed under the [MIT Licence](https://github.com/terry06890/chrona/blob/main/LICENCE.txt).
+Chrona is licensed under the MIT Licence.
diff --git a/backend/hist_data/README.md b/backend/hist_data/README.md
index 09a71fc..73b7a36 100644
--- a/backend/hist_data/README.md
+++ b/backend/hist_data/README.md
@@ -44,12 +44,6 @@ This directory holds files used to generate the history database data.db.
# Generating the Database
-## Environment
-Some of the scripts use third-party packages:
-- `indexed_bzip2`: For parallelised bzip2 processing
-- `mwxml`, `mwparserfromhell`: For parsing Wikipedia dumps
-- `requests`: For downloading data
-
## Generate Event Data
1. Obtain a Wikidata JSON dump in wikidata/, as specified in it's README.
1. Run `gen_events_data.py`, which creates `data.db`, and adds the `events` table.
diff --git a/backend/requirements.txt b/backend/requirements.txt
new file mode 100644
index 0000000..c9130ff
--- /dev/null
+++ b/backend/requirements.txt
@@ -0,0 +1,12 @@
+# For encoding data to send from server
+jsonpickle==3.0.1
+
+# For parsing Wikipedia dumps
+mwxml==0.3.3
+mwparserfromhell==0.6.4
+
+# For parallelised bzip2 processing
+indexed-bzip2==1.4.0
+
+# For downloading data
+requests==2.28.2
diff --git a/backend/tests/test_histplorer.py b/backend/tests/test_chrona.py
index cd52c67..525c6f8 100644
--- a/backend/tests/test_histplorer.py
+++ b/backend/tests/test_chrona.py
@@ -3,7 +3,7 @@ import tempfile
import os
from tests.common import createTestDbTable
-from histplorer import handleReq, HistDate, Event, ImgInfo, EventInfo, SuggResponse
+from chrona import handleReq, HistDate, HistEvent, ImgInfo, EventInfo, SuggResponse
def initTestDb(dbFile: str) -> None:
createTestDbTable(
@@ -113,17 +113,17 @@ class TestHandleReq(unittest.TestCase):
def test_events_req(self):
response = handleReq(self.dbFile, {'QUERY_STRING': 'type=events&range=-1999.2002-11-1&scale=1&incl=3&limit=2'})
self.assertEqual(response.events, [
- Event(5, 'event five', HistDate(None, 2000, 1, 1), None, HistDate(None, 2001, 1, 1), None,
+ HistEvent(5, 'event five', HistDate(None, 2000, 1, 1), None, HistDate(None, 2001, 1, 1), None,
'event', 50, 51),
- Event(3, 'event three', HistDate(True, 1990, 10, 10), HistDate(True, 2000, 10, 10), None, None,
+ HistEvent(3, 'event three', HistDate(True, 1990, 10, 10), HistDate(True, 2000, 10, 10), None, None,
'discovery', 30, 0),
])
self.assertEqual(response.unitCounts, {1900: 2, 1990: 1, 2000: 1, 2001: 1})
response = handleReq(self.dbFile, {'QUERY_STRING': 'type=events&range=.1999-11-27&scale=1&ctgs=event'})
self.assertEqual(response.events, [
- Event(4, 'event four', HistDate(False, -2000, 10, 10), None, HistDate(False, 1, 10, 10), None,
+ HistEvent(4, 'event four', HistDate(False, -2000, 10, 10), None, HistDate(False, 1, 10, 10), None,
'event', 20, 1000),
- Event(1, 'event one', HistDate(None, 1900, 1, 1), None, None, None, 'event', 10, 11),
+ HistEvent(1, 'event one', HistDate(None, 1900, 1, 1), None, None, None, 'event', 10, 11),
])
self.assertEqual(response.unitCounts, {-2000: 1, 1900: 2, 1990: 1})
@@ -131,13 +131,13 @@ class TestHandleReq(unittest.TestCase):
response = handleReq(self.dbFile, {'QUERY_STRING': 'type=info&event=event%20three'})
self.assertEqual(response,
EventInfo(
- Event(3, 'event three', HistDate(True, 1990, 10, 10), HistDate(True, 2000, 10, 10), None, None,
+ HistEvent(3, 'event three', HistDate(True, 1990, 10, 10), HistDate(True, 2000, 10, 10), None, None,
'discovery', 30, 0),
'desc three', 300, ImgInfo('example.com/3', 'cc-by-sa 3.0', 'artist three', 'credits three')))
response = handleReq(self.dbFile, {'QUERY_STRING': 'type=info&event=event%20four'})
self.assertEqual(response,
EventInfo(
- Event(4, 'event four', HistDate(False, -2000, 10, 10), None, HistDate(False, 1, 10, 10), None,
+ HistEvent(4, 'event four', HistDate(False, -2000, 10, 10), None, HistDate(False, 1, 10, 10), None,
'event', 20, 1000),
'desc four', 400, ImgInfo('example.com/2', 'cc-by', 'artist two', 'credits two')))
diff --git a/src/components/HelpModal.vue b/src/components/HelpModal.vue
index 5dc9ff3..46259a8 100644
--- a/src/components/HelpModal.vue
+++ b/src/components/HelpModal.vue
@@ -147,10 +147,9 @@
<template #content>
<div :class="contentClasses">
<p>
- The source code is available on
- <a href="https://github.com/terry06890/chrona" :style="aStyles">GitHub</a>, under the
- <a href="https://github.com/terry06890/tilo/blob/main/LICENCE.txt"
- :style="aStyles">MIT Licence</a>
+ Chrona's source code is available from a self-hosted
+ <a href="https://terryt.dev/cgit/chrona/about" :style="aStyles">Git repository</a>,
+ under the MIT Licence.
</p>
<br/>
<h1 :class="contentH1Classes">Data Sources</h1>