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 (plus multi-agent versions), SACTrainer
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
uv run --extra test --extra torch-cpu --extra torch-ext pytest --runslow            # also run learning benchmarks (minutes)

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.12

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.12
File Size Uploaded Provenance Actions
dragon_torch-1.1.12.tar.gz 212.5 kB With provenance Details for dragon_torch-1.1.12.tar.gz

Built distribution (wheel)

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

Total release size: 344.8 kB

Release files / dragon_torch-1.1.12.tar.gz

Download URL dragon_torch-1.1.12.tar.gz
Size 212.5 kB
Tags Source
SHA-256 checksum
How to use checksums
81b86bf1bfb8cc11c18cd69bebe45abd68f881d5d20d7e3858283a6d1d2c1229
BLAKE2b-256 checksum
How to use checksums
d080ae1ac70c7219c64759e7cb6e5cd6b8e35c1c6587977939ae80f11935469f
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 18, 2026.

Transparency log

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

Download URL dragon_torch-1.1.12-py3-none-any.whl
Size 132.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fc7f4053da93ab529c94a905ca952320d8143bf785645ae205940c73415e3b75
BLAKE2b-256 checksum
How to use checksums
98a545d5f3c365320a26d3a1c21d2a3e82035fcefe8970b2493eb292f8a6ded4
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 18, 2026.

Transparency log

Security for dragon-torch 1.1.12

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.12.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 18, 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