dragon-torch
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()
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:
- re-checks that the commit is on
mainand that its tests passed, - picks the next version with
scripts/release.py, - builds the package and uploads it to PyPI through trusted publishing (workflow
release.yml, environmentpypi), - 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.preparewith loaders and gyms -
OUActionNoisefor RL - Better state memory solutions
- A trading environment as a self-implemented test problem
Metadata
Release files for dragon-torch 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dragon_torch-1.1.5.tar.gz | 127.1 kB | With provenance | Details for dragon_torch-1.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dragon_torch-1.1.5-py3-none-any.whl | Python 3 | none | any | Details for dragon_torch-1.1.5-py3-none-any.whl |
Total release size: 231.4 kB
Release files / dragon_torch-1.1.5.tar.gz
| Download URL | dragon_torch-1.1.5.tar.gz |
|---|---|
| Size | 127.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
785bea9f8c31644562ea03cbcc307fbad2a2a1f0fbd3b27cb57d6dfdcb1c23f4
|
|
BLAKE2b-256 checksum How to use checksums |
602c4766cd421559ab7ff9d533c058dd29b7b16e1c9dcb2f500e070dcc5df262
|
| 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 10, 2026.
Transparency logRelease files / dragon_torch-1.1.5-py3-none-any.whl
| Download URL | dragon_torch-1.1.5-py3-none-any.whl |
|---|---|
| Size | 104.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c405424080aef23ab09efd39f8d7ffa9b5c86a230ce293ac82312b0619037dcd
|
|
BLAKE2b-256 checksum How to use checksums |
dd3d353e249a9c4ead57a034a35d412409696444346da54f5e016f20ca8fdc74
|
| 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 10, 2026.
Transparency logSecurity for dragon-torch 1.1.5
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.
Attestation for dragon_torch-1.1.5.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 10, 2026.
Transparency logA 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.