Skip to content

Move pandas and matplotlib to optional extras#2244

Merged
araffin merged 6 commits into
masterfrom
feat/remove-panda
Apr 19, 2026
Merged

Move pandas and matplotlib to optional extras#2244
araffin merged 6 commits into
masterfrom
feat/remove-panda

Conversation

@araffin
Copy link
Copy Markdown
Member

@araffin araffin commented Apr 19, 2026

Description

Reduce the number of dependencies.

TODO:

  • Open a PR in RL zoo, need to add pandas to plot dependencies

Motivation and Context

  • I have raised an issue to propose this change (required for new features and bug fixes)

closes #680

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)

Checklist

  • I've read the CONTRIBUTION guide (required)
  • I have updated the changelog accordingly (docs/misc/changelog.md) (required).
  • My change requires a change to the documentation.
  • I have updated the tests accordingly (required for a bug fix or a new feature).
  • I have updated the documentation accordingly.
  • I have opened an associated PR on the SB3-Contrib repository (if necessary)
  • I have opened an associated PR on the RL-Zoo3 repository (if necessary)
  • I have reformatted the code using make format (required)
  • I have checked the codestyle using make check-codestyle and make lint (required)
  • I have ensured make pytest and make type both pass. (required)
  • I have checked that the documentation builds using make doc (required)

Note: You can run most of the checks using make commit-checks.

Note: we are using a maximum length of 127 characters per line

araffin added 2 commits April 19, 2026 19:33
Update setup.py to remove them from core dependencies.
Add lazy imports with clear error messages in
logger, monitor, and plotter. Move read_csv and
read_json helpers to test files. Update
documentation and changelog.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces Stable-Baselines3’s core dependency footprint by moving pandas and matplotlib out of install_requires and into optional extras, while adding clearer runtime errors and updating docs/tests to reflect the new optional plotting/loading behavior.

Changes:

  • Move pandas/matplotlib from core dependencies to the extra extra in setup.py.
  • Add explicit, user-facing ImportError messages when plotting/loading utilities are used without optional dependencies.
  • Update tests and documentation to reflect the new optional dependency model; bump version to 2.9.0a2.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
setup.py Removes pandas/matplotlib from core deps and adds them under extras_require["extra"].
stable_baselines3/common/results_plotter.py Wraps pandas/matplotlib imports with clearer ImportErrors for plotting.
stable_baselines3/common/monitor.py Makes pandas a lazy import in load_results() and raises a clearer ImportError if missing.
stable_baselines3/common/logger.py Removes hard dependency on matplotlib (type-only import) and drops read_csv/read_json helpers.
tests/test_logger.py Moves CSV/JSON reader helpers into tests and adds tests for missing pandas/matplotlib.
docs/guide/plotting.md Documents that plotting requires pandas and matplotlib (or stable-baselines3[extra]).
docs/misc/changelog.md Adds breaking-change notes for optional deps and moved helpers (needs minor corrections).
README.md Updates installation/extras description and minor wording/formatting fixes.
stable_baselines3/version.txt Bumps version from 2.9.0a1 to 2.9.0a2.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/misc/changelog.md Outdated
Comment thread docs/misc/changelog.md
Comment thread stable_baselines3/common/monitor.py Outdated
@araffin araffin merged commit 08d984c into master Apr 19, 2026
5 of 8 checks passed
@araffin araffin deleted the feat/remove-panda branch April 19, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] move pandas to extras

2 participants