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.

Package Contents
dragon_torch.data.envs Env configs, wrappers as data, env checks
dragon_torch.models.RL, .modules.RL, .loss.RL, .data.RL PPOModel / A2CModel, ActorCritic, losses, rollout sources
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.7

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

Built distribution (wheel)

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

Total release size: 262.5 kB

Release files / dragon_torch-1.1.7.tar.gz

Download URL dragon_torch-1.1.7.tar.gz
Size 151.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2631862331fd51f34b94b915ebd73997a9c9dda8d0b9cbc6def2e4a6d25865a0
BLAKE2b-256 checksum
How to use checksums
42c70016896974109931f8870ea9f56f2f40f2b82b6caa906fd2a7946c87f7f7
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 11, 2026.

Transparency log

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

Download URL dragon_torch-1.1.7-py3-none-any.whl
Size 111.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ace16fdd9d9e5739f5a5ad117e1ebaa15b62a68530167336661c86fb135f63da
BLAKE2b-256 checksum
How to use checksums
df564d1b57f9c4ecd0efd197a418b796d0f5dc0b09eb4c04eab6557e953b7c62
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 11, 2026.

Transparency log

Security for dragon-torch 1.1.7

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.7.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 11, 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