https://github.com/wikimedia/toolhunt
A web application for editing Toolhub records in a fun and easy way
https://github.com/wikimedia/toolhunt
Last synced: 2 months ago
JSON representation
A web application for editing Toolhub records in a fun and easy way
- Host: GitHub
- URL: https://github.com/wikimedia/toolhunt
- Owner: wikimedia
- License: gpl-3.0
- Created: 2022-12-06T16:49:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-28T14:51:19.000Z (over 1 year ago)
- Last Synced: 2025-04-04T15:11:42.762Z (2 months ago)
- Language: Python
- Homepage:
- Size: 171 KB
- Stars: 5
- Watchers: 14
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
# toolhunt
# Description
Toolhunt is a web application for editing Toolhub records in a fun and easy way.
It allows users to view and add missing fields for tools in Toolhub.This repository contains the project backend.
The frontend can be found in the [toolhunt-ui repository](https://github.com/wikimedia/toolhunt-ui).This is an [Outreachy](https://www.outreachy.org/) Internship project.
## Issue Tracker
This project uses [Phabricator](https://phabricator.wikimedia.org/project/board/6283/) to track issues.
## Documentation
API documentation is automatically generated by Swagger and can be accessed (while the app is running) at `localhost:8082/api/documentation`
## Setup/Installation Requirements
Note that, as of the latest build, access to the API documentation and backend functionality happens through the frontend component of this app: [toolhunt-ui repository](https://github.com/wikimedia/toolhunt-ui)
In other words, to do much of anything with this half of the project, you **must** have both front- and backend components running in Docker containers.
- Clone this repo to your machine with the command `git clone https://github.com/wikimedia/toolhunt.git`
- Clone the frontend ui repo with `git clone https://github.com/wikimedia/toolhunt.git`
In order to authenticate successfully, you must register your local version of the app with the [Toolhub Demo Server](https://toolhub-demo.wmcloud.org/).
- To register, go to [Developer Settings](https://toolhub-demo.wmcloud.org/developer-settings?tab=oauth-register) and complete the form.
- Set `http://localhost:8082/api/authorize` as the Authorization Callback URL.
- Create an `.env` file in the root directory of your toolhunt repo and add `TOOLHUB_CLIENT_ID` and `TOOLHUB_CLIENT_SECRET` (set their values to be whatever you received from the demo server registration)
When building the Docker containers, the backend **must** go first.
From the toolhunt directory:
- `docker-compose up --build --detach`
From the toolhunt-ui directory:
- `docker-compose up --build --detach`
Then:
- Open a browser window to localhost:8082
## Working with the database
### Initializing the Database
- From the command line, `docker-compose exec flask-web flask db upgrade`
### Accessing the Database
- From the command line, `docker exec -it mariadb mariadb --user user -p mydatabase` (password: mypassword)
### Adding field data to the Database
Whether you're working with the mock data or "real" data, the contents of the `field` table will remain the same.
- From the command line, `docker-compose exec flask-web python manage.py insert_fields`
This needs to be done first, before adding tool data.
### Adding test data to the Database
The mock data set contains three tools and a set of completed tasks. When run, the function `load_mock_data` will put the tools through the insertion process and auto-generate tasks, as it would with "real" data.
It will also enter completed tasks into the `completed_task` table in the database.
- From the command line, `docker-compose exec flask-web python manage.py load_mock_data`
The results will appear on the command line. This command may be run multiple times; observe the command line messages to see what changes when a tool and/or task is already present in the DB.
The set of completed tasks will allow us to test that the high scores, user contributions, and latest contributions are returning correctly.
### Adding a full data set from Toolhub to the Database
- From the command line, `docker-compose exec flask-web python manage.py update_db`
While in development mode, the fetch request associated with this pipeline draws data from the Toolhub Test Server. This command can be run prior to or following `load_mock_data`.
## Running local CI and tests
Toolhunt uses [tox](https://tox.wiki/en/latest/) to handle local CI (linting, syntax, style, code formatting and import sorting). To use it, follow the [installation instructions](https://tox.wiki/en/latest/installation.html) and, from the toolhunt directory, enter `tox` on the command line.
## Technologies to be Used
- Python
- Flask
- Redis
- Docker
- MariaDB