Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/pufferlib-core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# PufferLib Core

Minimal PufferLib core functionality with vectorized environments.

This package contains only the essential components:
- `spaces`: Observation/action space handling
- `emulation`: Environment compatibility layer for Gym/Gymnasium/PettingZoo
- `vector`: Vectorized environment implementations

For the full PufferLib with training capabilities and environments, see the main `pufferlib` package.
27 changes: 27 additions & 0 deletions packages/pufferlib-core/pufferlib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
PufferLib Core - Minimal vectorized environment functionality
"""

import sys

# Import individual modules with delayed loading to avoid circular imports
def _import_modules():
from . import spaces
from . import pufferlib

# Temporarily add pufferlib to the current module namespace to resolve imports
current_module = sys.modules[__name__]
current_module.PufferEnv = pufferlib.PufferEnv
current_module.set_buffers = pufferlib.set_buffers
current_module.unroll_nested_dict = pufferlib.unroll_nested_dict

from . import emulation
from . import vector

return spaces, pufferlib, emulation, vector

# Perform the imports
spaces, pufferlib, emulation, vector = _import_modules()

__version__ = "3.0.3"
__all__ = ["spaces", "emulation", "vector", "pufferlib"]
1 change: 1 addition & 0 deletions packages/pufferlib-core/pufferlib/emulation.py
1 change: 1 addition & 0 deletions packages/pufferlib-core/pufferlib/pufferlib.py
1 change: 1 addition & 0 deletions packages/pufferlib-core/pufferlib/spaces.py
1 change: 1 addition & 0 deletions packages/pufferlib-core/pufferlib/vector.py
54 changes: 54 additions & 0 deletions packages/pufferlib-core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
[build-system]
requires = ["setuptools>=45", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "pufferlib-core"
version = "3.0.3"
description = "Minimal PufferLib core functionality with vectorized environments"
readme = "README.md"
requires-python = ">=3.8"
license = {text = "MIT"}
authors = [
{name = "Joseph Suarez", email = "[email protected]"},
]
keywords = [
"reinforcement-learning",
"machine-learning",
"multi-agent",
"vectorized-environments",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
"numpy",
"gymnasium",
"psutil"
]

[project.urls]
Homepage = "https://github.com/PufferAI/PufferLib"
Documentation = "https://puffer.ai"
Repository = "https://github.com/PufferAI/PufferLib"
Issues = "https://github.com/PufferAI/PufferLib/issues"

[tool.setuptools.packages.find]
include = ["pufferlib*"]

[tool.setuptools.package-data]
pufferlib = ["*.py"]
429 changes: 429 additions & 0 deletions packages/pufferlib-core/uv.lock

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion pufferlib/spaces.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import numpy as np
import gym
import gymnasium

try:
import gym
except ImportError:
# Alias gymnasium as gym when gym is not available
gym = gymnasium

Box = (gym.spaces.Box, gymnasium.spaces.Box)
Dict = (gym.spaces.Dict, gymnasium.spaces.Dict)
Discrete = (gym.spaces.Discrete, gymnasium.spaces.Discrete)
Expand Down
Loading