Install ByteWyrm
python -m pip install bytewyrm
BYTEWYRM
Simple online data for small Python projects
Your tutor gives you a ByteWyrm key. You use it to save and read small pieces of game data such as scores, lap times, progress values and flags.
python -m pip install bytewyrm
You do not need to set up a database or web server to use ByteWyrm as a student.
from bytewyrm import ByteWyrm
wyrm = ByteWyrm("bwk_YOUR_KEY_HERE")
wyrm.store.add(
player="Drake",
score=12500,
)
records = wyrm.store.records()
Quick start
You need Python, the ByteWyrm package, and an API key from your tutor.
python -m pip install bytewyrm
Your tutor will give you a key beginning with bwk_.
from bytewyrm import ByteWyrm
wyrm = ByteWyrm(
"bwk_YOUR_KEY_HERE"
)
wyrm.store.add(
player="Drake",
score=12500,
)
records = wyrm.store.records()
for record in records:
print(record)
Store
Store holds small structured records. Your tutor decides which fields the Store accepts and what rules apply to them.
.add()Add a new record to the Store.
wyrm.store.add(
player="Drake",
score=12500,
)
.records()Get records back from the Store.
records = wyrm.store.records(
limit=10,
)
.latest()Get the newest record.
latest = wyrm.store.latest()
if latest:
print(latest)
.schema()See the fields and types your Store accepts.
schema = wyrm.store.schema()
print(schema)
.records(...) sorting and filteringAsk the server to sort or filter the records before returning them.
scores = wyrm.store.records(
sort_by="score",
reverse=True,
limit=10,
)
done = wyrm.store.records(
where="completed",
equals=True,
)
Your Project
Not every ByteWyrm Project accepts the same data. The Store is configured before you connect to it.
A Project might accept player and score, while another might use lap_time and finished.
Fields can contain integers, floats, booleans or short pieces of text.
The server can limit record counts, request size and how quickly a key may send requests.
A Store can keep every record, replace matching records, or keep only the highest or lowest value for a key.
wyrm.store.schema().
Examples
These are all just different ways of using the same Store.
wyrm.store.add(
player="Drake",
score=12500,
)
scores = wyrm.store.records(
sort_by="score",
reverse=True,
limit=10,
)
wyrm.store.add(
player="Ember",
time=42.7,
)
times = wyrm.store.records(
sort_by="time",
limit=10,
)
wyrm.store.add(
level=3,
completed=True,
)
finished = wyrm.store.records(
where="completed",
equals=True,
)
Data safety
ByteWyrm is for small amounts of non-sensitive game data such as scores, player nicknames, lap times, progress values and flags.
Do not store real names, email addresses, passwords, addresses, private messages, medical information, or other personal, sensitive or confidential information.
For tutors
ByteWyrm Server is open source and can be self-hosted. This is useful for tutors who want to create their own Projects, schemas, limits and student API keys.
git clone https://github.com/William-Nitrosis/bytewyrm-server.git
cd bytewyrm-server
cp .env.example .env
Set your admin token, database location and optional Cloudflare Tunnel token.
docker compose up -d --build
The included stack provides the API, admin dashboard, homepage and Cloudflare Tunnel connector.
Cloudflare Tunnel is optional. Self-hosters can use their own reverse proxy or deployment setup instead.
Links