Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

EzPPO

A simple, unified PPO (Proximal Policy Optimization) library for PyTorch. Supports both discrete and continuous action spaces.

Features

  • Unified API: Same training loop for discrete and continuous
  • Observation normalization: Online running statistics
  • GAE (Generalized Advantage Estimation): For stable advantage estimation
  • Clipped surrogate objective: Standard PPO clipping
  • Mini-batch training: With random shuffling
  • Gradient clipping: Prevents exploding gradients
  • Checkpoint save/load: Resume training easily
  • Multi-environment support: Parallel environments built-in
  • GPU support: Automatic device management

Quick Start

Discrete Actions (CartPole)

from ezppo import DiscretePPOAgent
import gymnasium as gym

agent = DiscretePPOAgent(state_dim=4, action_dim=2)
env = gym.make("CartPole-v1")

state, _ = env.reset()
action, log_prob = agent.act(state)  # Stochastic action
# action = agent.act_deterministic(state)  # Greedy action (for eval)

Continuous Actions (Pendulum)

from ezppo import ContinuousPPOAgent
import gymnasium as gym

agent = ContinuousPPOAgent(state_dim=3, action_dim=1)
env = gym.make("Pendulum-v1")

state, _ = env.reset()
action, log_prob, raw_action = agent.act(state)
# action = agent.act_deterministic(state)[0]  # Mean action (for eval)

Installation

pip install torch gymnasium numpy

Architecture

ezppo/
├── __init__.py          # Public API
├── networks.py          # DiscretePPO, ContinuousPPO, BasePPO
├── normalizer.py        # RunningNormalizer
└── agents.py            # DiscretePPOAgent, ContinuousPPOAgent

examples/
├── discrete_cartpole.py
└── continuous_pendulum.py

Training Loop Template

trajectory = []
max_trajectory = 2048

for episode in range(num_episodes):
    state, _ = env.reset()
    done = False

    while not done:
        action, log_prob = agent.act(state)
        next_state, reward, terminated, truncated, _ = env.step(action.item())
        done = terminated or truncated

        trajectory.append((state, action.item(), reward, log_prob.item(), 
                           next_state, terminated))
        state = next_state

    if len(trajectory) >= max_trajectory:
        agent.train(num_epochs=4, batch_size=64)
        trajectory.clear()

API Reference

Networks

Class Purpose
BasePPO Base class with configurable architecture
DiscretePPO Discrete actions → logits output
ContinuousPPO Continuous actions → mean + learnable log_std

Agents

Class Purpose
DiscretePPOAgent Discrete action space
ContinuousPPOAgent Continuous action space

Key Methods

Agent.act(state) → (action, log_prob) or (action, log_prob, raw_action) Agent.act_deterministic(state) → Deterministic action (for evaluation) Agent.train(num_epochs=4, batch_size=64) → Train on trajectory Agent.store(packet) → Add transition to trajectory Agent.clear() → Clear trajectory buffer Agent.save(path) → Save checkpoint Agent.load(path) → Load checkpoint

Configuration

agent = DiscretePPOAgent(
    state_dim=4, action_dim=2,
    architecture={                    # Custom network architecture
        "actor": [state_dim, 64, 64, action_dim],
        "critic": [state_dim, 64, 64, 1]
    },
    lr=3e-4, gamma=0.99, 
    gae_lambda=0.95, epsilon=0.2,
    critic_coef=0.5, entropy_coef=0.01,
    num_envs=1, trajectory_size=2048,
    device="cpu"
)

License

MIT

Metadata

Release files for ezppo 0.0.1a4

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

Source distribution (sdist)

Source distribution for ezppo 0.0.1a4
File Size Uploaded Provenance Actions
ezppo-0.0.1a4.tar.gz 18.3 kB With provenance Details for ezppo-0.0.1a4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ezppo 0.0.1a4
File Interpreter ABI Platform Actions
ezppo-0.0.1a4-py3-none-any.whl Python 3 none any Details for ezppo-0.0.1a4-py3-none-any.whl

Total release size: 28.7 kB

Release files / ezppo-0.0.1a4.tar.gz

Download URL ezppo-0.0.1a4.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0e078cc67ab2cdc6487f3204827f6e974d6f965cbd0f8b9fc3c3014a0bafa773
BLAKE2b-256 checksum
How to use checksums
05b324b59eaea6d56cd4b4a8cf654b231cc8727cd0a2ee225c45b29e036dda4c
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 5, 2026.

Transparency log

Release files / ezppo-0.0.1a4-py3-none-any.whl

Download URL ezppo-0.0.1a4-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b674ad1a35943803ef0798d4637121f8bf0f237f14f51958bc78e7180966cd2
BLAKE2b-256 checksum
How to use checksums
c2b7a88cb63061b7f5c9624e1d6180c359c70cbabc9d5bdbce44a0884599b1b3
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 5, 2026.

Transparency log

Security for ezppo 0.0.1a4

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ezppo-0.0.1a4.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 5, 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.

Release history Release notifications | RSS feed

This release
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