Using the cryptography
library (the linked ed25519
library looks abandoned at this point):
from cryptography.hazmat.primitives import serialization
with open('private_key.pem', 'rb') as f:
# returns Ed25519PrivateKey
ed_priv = serialization.load_pem_private_key(f.read(), password=None)
signature = ed_priv.sign(b"my authenticated message")
For other methods see https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ed25519/