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

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

Built distribution (wheel)

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

Total release size: 276.4 kB

Release files / dragon_torch-1.1.8.tar.gz

Download URL dragon_torch-1.1.8.tar.gz
Size 162.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a449ef454c4195df179c6f2dccdbac632dc6fbb4a915cb3e4a1be32b32dc989c
BLAKE2b-256 checksum
How to use checksums
b46a9c52417a7fd4221cf44aa71aeb79f44cd345d0cae2dde3a01db5ccab0470
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.8-py3-none-any.whl

Download URL dragon_torch-1.1.8-py3-none-any.whl
Size 114.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aaad2f3d38b601bf3d3b2b90250b13c0effed18420d265e1a4ffc80f7102b8c2
BLAKE2b-256 checksum
How to use checksums
a52834c7f5b5d1d97291e937cd9c3dd7e1fd38f6decafea93d39f231039f03d5
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.8

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