Skip to content

Add libero/__init__.py for PEP 660 editable installs#54

Open
reeceomahoney wants to merge 1 commit into
sylvestf:mainfrom
reeceomahoney:fix/libero-init-py
Open

Add libero/__init__.py for PEP 660 editable installs#54
reeceomahoney wants to merge 1 commit into
sylvestf:mainfrom
reeceomahoney:fix/libero-init-py

Conversation

@reeceomahoney
Copy link
Copy Markdown

Summary

Adds an empty libero/__init__.py so the top-level libero package is discoverable by setuptools.find_packages().

Problem

Installing this project in editable mode with modern package managers (e.g. uv, or pip install -e . on newer setuptools using the PEP 660 backend) produces an editable install whose finder registers no libero* packages. import libero then fails with ModuleNotFoundError.

Root cause: setup.py calls find_packages(), which does not discover PEP 420 implicit namespace packages. Because the libero/ directory has no __init__.py, setuptools finds only libero.libero, libero.configs, libero.lifelong, libero.randomizer — but there is no parent libero package declared, so the editable finder's package mapping ends up empty.

The legacy python setup.py develop flow (what pip install -e . used before PEP 660) sidestepped this by appending the project root to sys.path, which allowed PEP 420 namespace resolution to find libero/ at import time. Modern editable installs do not do this.

Fix

Add an empty libero/__init__.py. This turns libero/ into a regular package, find_packages() returns it plus its subpackages, and the editable install's finder registers them correctly.

Test plan

  • touch libero/__init__.py
  • Reinstall in editable mode via uv sync --reinstall-package libero
  • python -c "import libero; print(libero.__file__)" now resolves to the installed libero/__init__.py instead of raising ModuleNotFoundError

Alternative considered: switching find_packages()find_namespace_packages() in setup.py. That would also work, but adding the __init__.py is a smaller, more conventional change.

Without this file, find_packages() in setup.py returns no packages
starting with "libero" because modern editable installs (PEP 660)
do not discover PEP 420 implicit namespace packages. The legacy
`python setup.py develop` flow worked because it just appended the
project root to sys.path, but tools like uv that use the new
editable-install protocol end up with an empty package mapping and
`import libero` fails.
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.

1 participant