Skip to main content

dragon-torch

Tests on main PyPI version

A PyTorch research framework focused on reinforcement learning. It provides environments, policies, losses, models and trainers that compose, plus Optuna-based hyperparameter tuning.

Installation

pip install "dragon-torch[RL,torch-cpu]"
Extra Adds
RL Gymnasium, PettingZoo, stable-retro, Stable-Baselines3
tune Optuna and optuna-dashboard
torch-cpu, torch-cuda12, torch-cuda13 PyTorch builds
torch-ext Transformers, Accelerate, Datasets
test pytest

Quick start

from dragon_torch.data.envs import DragonEnvConfig
from dragon_torch.models.RL import PPOConfig
from dragon_torch.trainers.RL import EvalConfig, PPOTrainer, PPOTrainerConfig

cfg = PPOTrainerConfig(
    env=DragonEnvConfig(env_id='CartPole-v1', n_envs=4),
    model=PPOConfig(checkpoint_dir='runs/ppo', save_every=50, total_timesteps=25_000),
    eval=EvalConfig(every_steps=5_000))

with PPOTrainer(cfg) as trainer:
    history = trainer.fit()

New to dragon-torch? The tutorial walks through this example step by step.

Documentation

See docs/index.md.

Page Contents
Framework How the pieces fit, and every hook for adding algorithms
Extending dragon-torch Tutorials: new algorithms, networks, multi-agent and off-policy versions
Algorithms Available and planned algorithms, with their settings
dragon_torch.data.envs Env configs, wrappers as data, env checks
dragon_torch.models.RL, .modules.RL, .loss.RL, .data.RL Model base classes, ActorCritic and heads, losses, collectors and sources
dragon_torch.modules.RL.replay Replay buffers and their checkpointing
dragon_torch.trainers.RL PPOTrainer, A2CTrainer and their multi-agent versions
dragon_torch.utils.tuning Optuna studies, search-space presets, the dragon-tune CLI
Multi-agent RL PettingZoo ParallelEnvs and Gymnasium Dict-space envs, agent groups
dragon_torch.data.sources, .datasets Data sources (disk, Hugging Face, Hugging Face + Polars) and the datasets that batch them. Source.__getitem__ is cached and returns the full dataset; aggregators combine datasets
dragon_torch.modules.external.sb3 DragonFeaturesExtractor and sb3_policy_kwargs, for using dragon modules in Stable-Baselines3

Development

Tests. Pushes to dev run the test suite in GitHub Actions and, when it passes, merge dev into main. Pushes to main run the tests without merging. The badge shows the pass count on main. To run the tests locally:

uv run --extra test --extra torch-cpu --extra torch-ext pytest                       # everything
uv run --extra test --extra torch-cpu --extra torch-ext pytest -m "not network"      # skip Hugging Face Hub tests

Releases. A passing main run starts release.yml, which:

  1. re-checks that the commit is on main and that its tests passed,
  2. picks the next version with scripts/release.py,
  3. builds the package and uploads it to PyPI through trusted publishing (workflow release.yml, environment pypi),
  4. tags the commit vX.Y.Z. A tagged commit is never released twice.

Versions bump the patch number. Parts carry over at caps of 10, 10 and 20, so 1.1.20 is followed by 1.2.0, and 10.10.20 is the last version. The version in pyproject.toml is a floor: raise it to jump straight to that version.

TODO

  • Lazy loading for Hugging Face sources
  • Monitoring and experimentation with Optuna
  • Off-policy algorithms
  • Test Accelerate.prepare with loaders and gyms
  • OUActionNoise for RL
  • Better state memory solutions
  • A trading environment as a self-implemented test problem

Metadata

Release files for dragon-torch 1.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dragon-torch 1.1.10
File Size Uploaded Provenance Actions
dragon_torch-1.1.10.tar.gz 190.0 kB With provenance Details for dragon_torch-1.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dragon-torch 1.1.10
File Interpreter ABI Platform Actions
dragon_torch-1.1.10-py3-none-any.whl Python 3 none any Details for dragon_torch-1.1.10-py3-none-any.whl

Total release size: 309.3 kB

Release files / dragon_torch-1.1.10.tar.gz

Download URL dragon_torch-1.1.10.tar.gz
Size 190.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2f601484e0c2ce310639e86dfbfb5c4a34be17022ae5c9f02b53400a921ea16e
BLAKE2b-256 checksum
How to use checksums
203545e450f5436ad8d95b0309c7506c8218e63af39b7dcff20aee4186f029e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / dragon_torch-1.1.10-py3-none-any.whl

Download URL dragon_torch-1.1.10-py3-none-any.whl
Size 119.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc3a475f32cd915ece7500ae5ab278efc9e107af7fd0ce43c410496f5a65464d
BLAKE2b-256 checksum
How to use checksums
22127f81736426f0cf171e9326e04dfb634d03dbef669264e86ad11af9726a3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for dragon-torch 1.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dragon_torch-1.1.10.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page