Skip to content

fix: add per-instance spec overrides to handle astropy setuptools conflict#593

Open
Oxygen56 wants to merge 1 commit into
SWE-bench:mainfrom
Oxygen56:fix/issue-584-astropy-setuptools
Open

fix: add per-instance spec overrides to handle astropy setuptools conflict#593
Oxygen56 wants to merge 1 commit into
SWE-bench:mainfrom
Oxygen56:fix/issue-584-astropy-setuptools

Conversation

@Oxygen56

@Oxygen56 Oxygen56 commented Jun 2, 2026

Copy link
Copy Markdown

Summary

Fixes #584 — the gold patch for astropy__astropy-8872 cannot be scored because setuptools==68.0.0 (from the repo-version spec) ships a vendored distutils whose LooseVersion emits a DeprecationWarning. Astropy 3.1's pytest config escalates warnings to errors, causing test collection to abort before any test runs.

Changes

  1. New MAP_INSTANCE_TO_SPECS dictionary in swebench/harness/constants/__init__.py — a per-instance override layer that is shallow-merged on top of the repo-version-level spec in make_test_spec(). Only the keys that need changing need to be provided.

  2. Override logic in make_test_spec() — after fetching specs from MAP_REPO_VERSION_TO_SPECS, checks MAP_INSTANCE_TO_SPECS for the current instance_id and applies any overrides via {**specs, **instance_overrides}.

  3. Instance override for astropy__astropy-8872 — adds a pre_install step that runs python -m pip install 'setuptools<60' to downgrade setuptools before astropy is installed. This uses the stdlib distutils (which does not emit the LooseVersion warning on Python 3.9) instead of the vendored copy.

Testing

  • Unit tests (tests/test_harness_utils.py) pass.
  • Verified that make_test_spec produces a repo install script containing the setuptools<60 pin for astropy__astropy-8872.
  • The override is zero-blast-radius: it only affects the single instance. All other astropy 3.1 instances continue to use setuptools==68.0.0 as before.

Introduce a MAP_INSTANCE_TO_SPECS dictionary that allows individual SWE-bench
instances to override specific fields in their repo-version-level spec without
affecting other instances of the same repo/version.

The instance overrides are shallow-merged on top of the base spec in
make_test_spec(), so only the keys that need changing need to be provided.

Use this mechanism to fix astropy__astropy-8872: the instance uses a cached
environment.yml that pins setuptools==68.0.0, whose vendored distutils emits
a DeprecationWarning for LooseVersion usage. astropy 3.1's pytest config
escalates warnings to errors, causing test collection to abort. Adding a
pre_install step that runs `pip install 'setuptools<60'` downgrades setuptools
before astropy is installed, bypassing the issue.
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.

[BUG] Gold patch for astropy__astropy-8872 does not resolve — pytest collection error from setuptools-vendored distutils

1 participant