Skip to content

Fix egg_info.writers entry point module path - #829

Merged
danieldk merged 1 commit into
huggingface:mainfrom
jiqing-feng:fix-egg-info-writer-entry-point
Sep 16, 2026
Merged

danieldk merged 1 commit into
huggingface:mainfrom
jiqing-feng:fix-egg-info-writer-entry-point

Conversation

@jiqing-feng

Copy link
Copy Markdown
Contributor

Problem

With kernels installed, any setuptools source build in the same environment fails, including builds of unrelated packages:

File "setuptools/command/egg_info.py", line 304, in run
    writer = ep.load()
ModuleNotFoundError: No module named 'kernels.lockfile'

Reproducer:

pip install kernels==0.17.0
printf 'from setuptools import setup\nsetup(name="smoke", version="0.1")\n' > setup.py
python setup.py egg_info

Cause

kernels/pyproject.toml registers a setuptools entry point pointing at a module that is not shipped:

[project.entry-points."egg_info.writers"]
"kernels.lock" = "kernels.lockfile:write_egg_lockfile"

write_egg_lockfile lives in kernels/locking.py; there is no kernels/lockfile.py in the wheel. The entry point was not updated when lockfile.py was renamed to locking.py.

setuptools loads all registered egg_info.writers on every egg_info run, so a broken writer from any installed distribution takes down unrelated builds. PEP 517 isolated builds are unaffected; --no-build-isolation builds reuse the ambient setuptools and always hit it.

Present in 0.17.0 and on main; 0.16.2 is the last good release.

Fix

Point the entry point at kernels.locking, and add a regression test that loads it the way setuptools does — nothing covered this path, which is why the rename regressed silently.

Validation

Built a wheel from this branch and installed it:

  • ep.load() resolves to the real function.
  • The reproducer above succeeds.
  • The new test passes, and fails when reverted to kernels.lockfile.

The entry point points at `kernels.lockfile`, but `write_egg_lockfile` lives in
`kernels.locking`; no `lockfile` module is shipped in the wheel.

setuptools loads every registered `egg_info.writers` entry point when it runs
`egg_info`, so with `kernels` installed any setuptools source build in the same
environment fails, including builds of unrelated packages:

    File "setuptools/command/egg_info.py", line 304, in run
        writer = ep.load()
    ModuleNotFoundError: No module named 'kernels.lockfile'

Reproducer:

    pip install kernels
    printf 'from setuptools import setup\nsetup(name="smoke", version="0.1")\n' > setup.py
    python setup.py egg_info

PEP 517 isolated builds are unaffected, since kernels is absent from the isolated
build environment. Builds using --no-build-isolation reuse the ambient setuptools
and always hit it.

Add a regression test that loads the entry point the way setuptools does.
@jiqing-feng

Copy link
Copy Markdown
Contributor Author

Hi @danieldk. Would you please review this PR? Thanks!

@danieldk danieldk 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 a lot for catching this! Will also backport to 0.17.

@danieldk
danieldk merged commit 1b79dba into huggingface:main Sep 16, 2026
1 check passed
danieldk pushed a commit that referenced this pull request Sep 16, 2026
With `kernels` installed, any setuptools source build in the same
environment fails, including builds of unrelated packages:

```
File "setuptools/command/egg_info.py", line 304, in run
    writer = ep.load()
ModuleNotFoundError: No module named 'kernels.lockfile'
```

Reproducer:

```bash
pip install kernels==0.17.0
printf 'from setuptools import setup\nsetup(name="smoke", version="0.1")\n' > setup.py
python setup.py egg_info
```

`kernels/pyproject.toml` registers a setuptools entry point pointing at
a module that is not shipped:

```toml
[project.entry-points."egg_info.writers"]
"kernels.lock" = "kernels.lockfile:write_egg_lockfile"
```

`write_egg_lockfile` lives in `kernels/locking.py`; there is no
`kernels/lockfile.py` in the wheel. The entry point was not updated when
`lockfile.py` was renamed to `locking.py`.

setuptools loads **all** registered `egg_info.writers` on every
`egg_info` run, so a broken writer from any installed distribution takes
down unrelated builds. PEP 517 isolated builds are unaffected;
`--no-build-isolation` builds reuse the ambient setuptools and always
hit it.

Present in 0.17.0 and on `main`; 0.16.2 is the last good release.

Point the entry point at `kernels.locking`, and add a regression test
that loads it the way setuptools does — nothing covered this path, which
is why the rename regressed silently.

Built a wheel from this branch and installed it:

- `ep.load()` resolves to the real function.
- The reproducer above succeeds.
- The new test passes, and fails when reverted to `kernels.lockfile`.
danieldk added a commit that referenced this pull request Sep 16, 2026
Backport of #829 to 0.17.

## Problem

With `kernels` installed, any setuptools source build in the same
environment fails, including builds of unrelated packages:

```
File "setuptools/command/egg_info.py", line 304, in run
    writer = ep.load()
ModuleNotFoundError: No module named 'kernels.lockfile'
```

Reproducer:

```bash
pip install kernels==0.17.0
printf 'from setuptools import setup\nsetup(name="smoke", version="0.1")\n' > setup.py
python setup.py egg_info
```

## Cause

`kernels/pyproject.toml` registers a setuptools entry point pointing at
a module that is not shipped:

```toml
[project.entry-points."egg_info.writers"]
"kernels.lock" = "kernels.lockfile:write_egg_lockfile"
```

`write_egg_lockfile` lives in `kernels/locking.py`; there is no
`kernels/lockfile.py` in the wheel. The entry point was not updated when
`lockfile.py` was renamed to `locking.py`.

setuptools loads **all** registered `egg_info.writers` on every
`egg_info` run, so a broken writer from any installed distribution takes
down unrelated builds. PEP 517 isolated builds are unaffected;
`--no-build-isolation` builds reuse the ambient setuptools and always
hit it.

Present in 0.17.0 and on `main`; 0.16.2 is the last good release.

## Fix

Point the entry point at `kernels.locking`, and add a regression test
that loads it the way setuptools does — nothing covered this path, which
is why the rename regressed silently.

## Validation

Built a wheel from this branch and installed it:

- `ep.load()` resolves to the real function.
- The reproducer above succeeds.
- The new test passes, and fails when reverted to `kernels.lockfile`.

Co-authored-by: jiqing-feng <jiqing.feng@intel.com>
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.

2 participants