Skip to content

Declare the direct dependencies TRL gets transitively - #7713

Merged
albertvillanova merged 3 commits into
mainfrom
declare-direct-dependencies
Oct 15, 2026
Merged

albertvillanova merged 3 commits into
mainfrom
declare-direct-dependencies

Conversation

@albertvillanova

@albertvillanova albertvillanova commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

This PR declares huggingface_hub, numpy, pandas, psutil, pyarrow and pyyaml as dependencies, with a floor for each.

Fix #7653.

Motivation

TRL imports these six packages directly but only gets them through accelerate, datasets and transformers. If one of those drops a package or makes it optional, import trl breaks.

Solution

Under the criterion in CONTRIBUTING.md (#7638), a first floor drops support for nothing and only records what we test.

Each floor is the higher of two versions: the floor accelerate, datasets or transformers already declare, and the oldest release with Python 3.12 wheels. None of the APIs TRL uses requires anything newer. The full suite passes with exactly these floors on Python 3.12: https://github.com/huggingface/trl/actions/runs/38434120299

Package Floor Released Reason
huggingface_hub 0.34.0 Jul 2025 transformers 4.56.2 floor
numpy 1.26.0 Sep 2023 first release with Python 3.12 wheels
pandas 2.1.1 Sep 2023 first release with Python 3.12 wheels
psutil 5.9.4 Nov 2022 first release with Python 3.12 wheels
pyarrow 21.0.0 Jul 2025 datasets 4.7.0 floor
pyyaml 6.0.1 Jul 2023 first release with Python 3.12 wheels

numpy, pandas, psutil and pyyaml are all more than 2 years old. Their floors only exclude releases that cannot be installed on Python 3.12, plus, on Python 3.11, numpy 1.23 to 1.25 and pandas 1.5 to 2.1.0. huggingface_hub and pyarrow match floors the stack already enforces.

pyyaml is imported lazily, but only by the CLI config parsing, which is still a direct use. torch is declared by #7642.

No version guard, shim or warning filter is retired, since nothing in the code depended on a version older than these floors.

Changes

  • Add huggingface_hub>=0.34.0, numpy>=1.26.0, pandas>=2.1.1, psutil>=5.9.4, pyarrow>=21.0.0 and pyyaml>=6.0.1 to the project dependencies

Note

Low Risk
Packaging-only change that documents and pins already-used libraries; no runtime logic changes in this diff.

Overview
Adds explicit minimum-version dependencies for six packages TRL imports directly but previously only received transitively via accelerate, datasets, and transformers: huggingface_hub>=0.34.0, numpy>=1.26.0, pandas>=2.1.1, psutil>=5.9.4, pyarrow>=21.0.0, and pyyaml>=6.0.1.

This hardens installs so import trl does not break if an upstream package drops or optionalizes one of these libraries. The chosen floors align with existing stack constraints and Python 3.12 wheel availability rather than new API requirements.

Reviewed by Cursor Bugbot for commit a4faf33. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added the 🔧 maintenance CI, tooling, tests, or repo upkeep label Oct 14, 2026
@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@qgallouedec qgallouedec left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! #7648 moved the minimum-versions job to Python 3.13 after this ran on 3.12; merging main to this branch right now so that it's green (hopefully) tomorrow with 3.13

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 713143b. Configure here.

Comment thread .github/workflows/tests.yml Outdated
@albertvillanova
albertvillanova merged commit 9d0d8a4 into main Oct 15, 2026
11 checks passed
@albertvillanova
albertvillanova deleted the declare-direct-dependencies branch October 15, 2026 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔧 maintenance CI, tooling, tests, or repo upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Declare direct dependencies we currently get transitively

2 participants