Skip to content

Conversation

@xingdi-eric-yuan
Copy link
Collaborator

@xingdi-eric-yuan xingdi-eric-yuan commented Jan 8, 2026

Summary

Modernizes package data configuration by migrating from MANIFEST.in to pyproject.toml's package-data section.

Changes

Replace MANIFEST.in with package-data in pyproject.toml

  • Remove MANIFEST.in (had incorrect path and referenced non-existent files)
  • Add [tool.setuptools.package-data] section to pyproject.toml
  • Correctly specify gym/envs/configs/*.yaml for YAML config files

Impact

  • YAML config files in debug_gym/gym/envs/configs/ will be properly included in both source and wheel distributions
  • Modern approach using only pyproject.toml (Python packaging best practice)
  • Fixes incorrect path that would have excluded config files from distributions

xingdi-eric-yuan and others added 6 commits January 8, 2026 14:20
Replace importlib.resources.files() with Path(__file__).parent for
loading config YAML files in R2EGymEnv and SWESmithEnv.

## Problem

When debug-gym is installed as an editable package using pip 23.1+,
pip uses the PEP 660 editable install format by default. This format
is incompatible with importlib.resources.files() in Python 3.12,
causing a NotADirectoryError:

    NotADirectoryError: MultiplexedPath only supports directories

This breaks imports and prevents tests from running.

## Root Cause

- PEP 660 was introduced in 2021, but pip didn't make it the default
  until version 23.1 (April 2023)
- The old editable install format used .egg-link files
- The new PEP 660 format uses __editable__*.pth files
- importlib.resources.files() has known issues with PEP 660 in
  Python 3.12

When users reinstall debug-gym with modern pip versions, they get
the new format, which breaks the importlib_files() calls.

## Solution

Use Path(__file__).parent to locate config files relative to the
source file. This approach:
- Works with all installation methods (editable and non-editable)
- Works with both old and new editable install formats
- Is simpler and more direct
- Avoids the importlib.resources compatibility issues

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Replace importlib.resources.files() with Path(__file__).parent for
loading config YAML files in R2EGymEnv and SWESmithEnv.

## Problem

When debug-gym is installed as an editable package with setuptools >= 64,
setuptools uses the PEP 660 editable install format. This format is
incompatible with importlib.resources.files() in Python 3.12, causing:

    NotADirectoryError: MultiplexedPath only supports directories

This breaks imports and prevents tests from running.

## Root Cause

The editable install method depends on setuptools version, not pip version:

- setuptools >= 64: Uses PEP 660 format (__editable__*.pth files)
- setuptools < 64: Uses legacy format (.egg-link files)

When users reinstall debug-gym with modern setuptools (>= 64), they get
the PEP 660 format, which is incompatible with importlib.resources.files()
in Python 3.12.

Previous installations likely used setuptools < 64 (legacy format), which
worked fine. After upgrading setuptools and reinstalling, the new format
breaks the importlib_files() calls even though the code hasn't changed.

## Solution

Use Path(__file__).parent to locate config files relative to the source
file. This approach:
- Works with all installation methods (editable and non-editable)
- Works with both legacy and PEP 660 editable install formats
- Is simpler and more direct
- Avoids the importlib.resources compatibility issues

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Fix MANIFEST.in path: debug_gym/gym/envs/configs/*.yaml (was incorrectly debug_gym/envs/configs/)
- Remove non-existent scripts/templates/*.jinja from MANIFEST.in
- Add package-data configuration to pyproject.toml for wheel distributions

This ensures YAML config files are properly included in both sdist and wheel distributions.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Reverts PR #328 changes that switched from importlib.resources.files() to Path(__file__).parent.

Since debug-gym requires Python >= 3.12 (as documented in README), the stdlib importlib.resources.files() works correctly with PEP 660 editable installs. The Path(__file__).parent workaround is unnecessary.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@xingdi-eric-yuan xingdi-eric-yuan changed the title Fix config path loading to support PEP 660 editable installs YAML Jan 9, 2026
xingdi-eric-yuan and others added 4 commits January 9, 2026 11:24
MANIFEST.in with include_package_data=true is sufficient for including
non-Python files in both sdist and wheel distributions.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Remove MANIFEST.in
- Add [tool.setuptools.package-data] section with YAML configs
- Package-data is sufficient for files inside Python packages
- Excludes configs/templates/*.jinja (outside package, not needed in distribution)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@MarcCote MarcCote merged commit b1e23d1 into main Jan 9, 2026
8 checks passed
@MarcCote MarcCote deleted the minof_fix_jan8 branch January 9, 2026 16:50
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.

3 participants