Simple prize draw generator for displaying at a conference etc. Runs as a local web app.
This project uses uv
.
Get data and place it in the root of the pyprize repo. See the section below for detailed information about getting data. E.g.
cp candidates.csv.example candidates.csv
Start the server
uv run flask --app pyprize run --debug
Open your browser to http://localhost:8000/
-
Click ⚙️ to go to the admin page and then click
FRESH IMPORT
to reset set the initial state of the database with the data from the filesystem -
Click 🏠 to go back to the main screen
-
Draw a user by pressing
spacebar
orenter
key. -
Confirm the prize will be awarded by the drawn candidate by pressing the ➡️ or press ⬅️ to reject the prize draw. 'rejected' candidates will be marked has having been drawn but not awarded the prize.
-
Reset the prize draw by clicking ⚙️ then
FRESH IMPORT
. This will drop the existing database and re import from our data source into a fresh database.
docker build -t pyprize .
docker run -p 5000:5000 pyprize
docker run \
-v "$(pwd)/candidates.csv.example:/app/candidates.csv" \
-p 5000:5000 \
pyprize
The app will work from either a JSON export of orders from Pretix or a csv file which is just a list of names.
- Will first look for
*_pretixdata.json
at the root of pyprize. - Will look for
candidates.csv
or whatever is set forCSV_NAME
at the root of pyprize.
In either case, the data must be placed in the root of the directory.
Download the name list from Pretix in JSON format and place in the root of the directory
Orders > Export > Order data > Order data (JSON)
E.g. https://pretix.eu/control/event/kiwipycon/2024/orders/export/?identifier=json
The data is structured as follows
{
"event": {
"orders": [
{
"code": "AB1CD",
"positions": [
{
"id": 12345678,
"attendee_name": "John Smith"
}
]
}
]
}
}
Despite expecting a CSV, we only care about a single column containing the names of the people eligible to win a prize.
The CSV should not contain a header row. E.g. pyprize/candidates.csv
with a contents of.
John Smith
Jane Doe
Joe Bloggs
Julius Caesar
The app is themeable via the THEMES
global variable and assets under static/themes/<theme name>
Pull requests welcome ❤️
See https://github.com/pythonnz/pyprize/issues for open issues or to raise bugs / feature requests.
This repository uses Ruff for linting and formatting.
Install development dependencies with
pip install -r requirements-dev.txt
Check and format with ruff
uv run ruff check .
uv run ruff format .