Command-line Interface¶
BYCEPS comes with a command-line tool for some tasks.
Command |
Description |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Create Database Tables¶
byceps create-database-tables
creates the tables that are required
to run BYCEPS in a relational database instance.
$ uv run byceps create-database-tables
Expected output:
Creating database tables ... done.
Note
The database initialization command covers this command.
Initialize Database¶
byceps initialize-database
prepares a relational database instance
for running BYCEPS.
It is a convenience command that includes the following steps (making it unnecessary to call the covered commands separately):
Create the database tables. (What Create Database Tables does.)
Import authorization roles. (What Import Authorization Roles does.)
Register the supported languages.
$ uv run byceps initialize-database
Expected output:
Creating database tables ... done.
Importing roles ... done. Imported 35 roles, skipped 0 roles.
Adding language "en" ... done.
Adding language "de" ... done.
Create Superuser¶
byceps create-superuser
creates a BYCEPS superuser.
This will:
create a user account,
initialize the account,
assign all existing authorization roles to the account, and
confirm the associated email address as valid (even though it might not be).
This command is necessary to create the initial user account, which then can be used to log in to the admin backend and to access all administrative functionality.
The command can be run to create additional user accounts as well, but they all will have superuser-like privileges in BYCEPS.
$ uv run byceps create-superuser
Expected output:
Screen name: Flynn
Email address: flynn@flynns-arcade.net
Password:
Creating user "Flynn" ... done.
Enabling user "Flynn" ... done.
Assigning 35 roles to user "Flynn" ... done.
Note
This command will only assign the roles that exist in the database. If no roles have been imported, none will be assigned.
Import Users¶
byceps import-users
imports basic user accounts from a file in JSON
Lines format into BYCEPS.
This functionality exists to support migration from another system to BYCEPS.
Currently supported fields:
screen_name
(required)email_address
legacy_id
first_name
,last_name
date_of_birth
country
,zip_code
,city
,street
phone_number
internal_comment
Example file (including a deliberately bad record):
example-users.jsonl
¶{"screen_name": "imported01", "email_address": "imported01@example.test", "first_name": "Alice", "last_name": "Allison"}
{"bad": "data"}
{"screen_name": "imported02", "email_address": "imported02@example.test", "first_name": "Bob", "last_name": "Bobson"}
{"screen_name": "imported03"}
To import it:
$ uv run byceps import-users example-users.jsonl
Expected output:
[line 1] Imported user imported01.
[line 2] Could not import user: 1 validation error for UserToImport
screen_name
field required (type=value_error.missing)
[line 3] Imported user imported02.
[line 4] Imported user imported03.
Generate Secret Key¶
byceps generate-secret-key
generates a secret key in a
cryptographically secure way.
A secret key is, among other things, required for login sessions.
$ uv run byceps generate-secret-key
Expected output:
3ac1c416bfacb82918d56720d1c3104fd96e8b8d4fbee42343ae7512a9ced293
Attention
Do not use the above key (or any other key you copied from anywhere). Generate your own secret key!
Attention
Do not use the same key for development and production environments. Generate separate secret keys!
Import Seats¶
byceps import-seats
imports seats from a file in JSON Lines
format into BYCEPS.
Currently supported fields:
area_title
(required)coord_x
(required)coord_y
(required)rotation
category_title
(required)label
type_
Example file:
example-seats.jsonl
¶{"area_title": "Floor 3", "coord_x": 10, "coord_y": 10, "rotation": 0, "category_title": "Premium", "label": "Seat A-1"}
{"area_title": "Floor 3", "coord_x": 25, "coord_y": 10, "rotation": 0, "category_title": "Premium", "label": "Seat A-2"}
To import it:
$ uv run byceps import-seats my-party-2023 example-seats.jsonl
Expected output:
[line 1] Imported seat (area="Floor 3", x=10, y=10, category="Premium").
[line 2] Imported seat (area="Floor 3", x=25, y=10, category="Premium").
Run Interactive Shell¶
The BYCEPS shell is an interactive Python command line prompt that provides access to BYCEPS’ functionality as well as the persisted data.
This can be helpful to inspect and manipulate the application’s data by
using primarily the various services (from byceps.services
) without
directly accessing the database (hopefully limiting the amount of
accidental damage).
$ uv run byceps shell
Expected output:
Welcome to the interactive BYCEPS shell on Python 3.11.2!
>>>