Fix: Modernize Packaging to Resolve Editable Install Issues with pyproject.toml #84
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.
Description
This PR addresses an issue where
import liberowould fail with aModuleNotFoundErrorwhen theliberopackage was installed in editable mode (pip install -e .) using recent versions ofpipandsetuptools. The root cause was related to how modern packaging tools handle editable installs forsetup.py-based projects, where the default PEP 660 style "finder" mechanism did not consistently expose the project's path tosys.path.This was particularly noticeable when trying to import
liberofrom outside its root directory after an editable install. While a workaround (pip install --config-settings editable_mode=compat -e .) existed, this PR implements a more robust and future-proof solution.Solution Implemented
To resolve this and align the project with current Python packaging best practices, the following changes were made:
pyproject.toml: All project metadata (name, version, dependencies, entry points, author information, etc.) and build system configurations have been migrated fromsetup.pyto apyproject.tomlfile. This adheres to PEP 517, PEP 518, and PEP 621.setup.py: Thesetup.pyfile has been reduced to a minimal shim that defers tosetuptools(which now reads its configuration frompyproject.toml). This ensures compatibility for any tools that might still expect asetup.pyfile.These changes allow
pip install -e .to correctly configure the editable install using the modern PEP 660 mechanism, making theliberopackage importable lágrimas (system-wide, within the activated environment) without needing compatibility flags.Benefits
ModuleNotFoundError: Fixes the import issues encountered with editable installs using modernpipversions.How to Test
LIBEROdirectory (wherepyproject.tomlis now located).pip install -e .GRAPEdirectory or any other directory outsideLIBERO).import liberolibero.__path__to see how it's being located.This change should provide a smoother development experience for users relying on editable installs.