This directory contains example scripts demonstrating how to use the Lore Python SDK.
example.py— uses the high-level fluent API (lore.Lore).example-native.py— uses the low-level native API (lore.native), which mirrors the underlying FFI calls.
Both examples run the same basic workflow: create a repository, write a couple of files, stage them, and commit a revision. In online mode they additionally push the revision and clone the repository back.
Each example accepts an optional remote URL as the first command-line argument.
- No argument → fully offline run. The example creates a local repository and commits a file. Nothing is pushed; nothing is cloned.
- With argument (e.g.
lore://localhost) → online run. The example also pushes the revision and clones the repository back.
# Offline run
python3 examples/example.py
# Online run against a local server
python3 examples/example.py lore://localhost
# Same for the native variant
python3 examples/example-native.py
python3 examples/example-native.py lore://localhostThese examples do not perform authentication. If the remote requires it, run
lore auth from the CLI before invoking the example.
To exercise the online mode of these examples, you can run a Lore server locally. The steps below build the server from source and configure it for local development:
-
Clone the Lore repository and build the server in release mode:
git clone https://github.com/EpicGames/lore.git cd lore cargo build --release -
Create a local config file by copying the example:
cp lore-server/config/local.toml.example lore-server/config/local.toml
-
Generate a random secret and set it as
presigned_url_hmac_keyinlore-server/config/local.toml:openssl rand -hex 32
-
Generate a self-signed TLS certificate (run from the directory where the server expects
cert.pemandkey.pem):openssl req \ -subj '/CN=localhost:8443/O=Self signed/C=CH' \ -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 \ -keyout key.pem -out cert.pem -
Start the server:
RUST_LOG=info ./target/release/loreserver 2>&1 | tee /tmp/lore.log
The server is now reachable as lore://localhost, which you can pass to the
examples as the first argument.