Add libero/__init__.py for PEP 660 editable installs#54
Open
reeceomahoney wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an empty
libero/__init__.pyso the top-levelliberopackage is discoverable bysetuptools.find_packages().Problem
Installing this project in editable mode with modern package managers (e.g.
uv, orpip install -e .on newer setuptools using the PEP 660 backend) produces an editable install whose finder registers nolibero*packages.import liberothen fails withModuleNotFoundError.Root cause:
setup.pycallsfind_packages(), which does not discover PEP 420 implicit namespace packages. Because thelibero/directory has no__init__.py, setuptools finds onlylibero.libero,libero.configs,libero.lifelong,libero.randomizer— but there is no parentliberopackage declared, so the editable finder's package mapping ends up empty.The legacy
python setup.py developflow (whatpip install -e .used before PEP 660) sidestepped this by appending the project root tosys.path, which allowed PEP 420 namespace resolution to findlibero/at import time. Modern editable installs do not do this.Fix
Add an empty
libero/__init__.py. This turnslibero/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__.pyuv sync --reinstall-package liberopython -c "import libero; print(libero.__file__)"now resolves to the installedlibero/__init__.pyinstead of raisingModuleNotFoundErrorAlternative considered: switching
find_packages()→find_namespace_packages()insetup.py. That would also work, but adding the__init__.pyis a smaller, more conventional change.