This issue summarizes several critical fixes applied to the mcp-libre project to improve its installation, compatibility, and runtime stability.
Summary of Changes:
-
Resolved ModuleNotFoundError: No module named 'src':
- Problem: The
mcp-libre command failed after installation due to Python's inability to find the src module. This was caused by incorrect packaging configuration in pyproject.toml.
- Fix: Modified
pyproject.toml to correctly package the src directory by changing packages = ["libremcp.py", "main.py"] to packages = ["src"] under [tool.hatch.build.targets.wheel].
-
Updated Python Version Compatibility:
- Problem: The project's
pyproject.toml specified requires-python = ">=3.12", but the current environment was Python 3.10.12, leading to installation errors.
- Fix: Adjusted
requires-python = ">=3.12" to requires-python = ">=3.10" in pyproject.toml to ensure compatibility with Python 3.10 and above.
-
Fixed SyntaxError: f-string expression part cannot include a backslash:
- Problem: A
SyntaxError occurred in src/libremcp.py due2 to an improperly escaped f-string within a multi-line string literal.
- Fix: Refactored the problematic
script_content string in src/libremcp.py to correctly handle string formatting and backslashes, resolving the syntax error.
-
Refactored Test Function for Pytest Best Practices:
- Problem: The
tests/test_insert_fix.py::test_insert_text_fix function returned boolean values, which is not the recommended practice for pytest test functions.
- Fix: Modified
test_insert_fix.py to remove boolean returns and instead use raise for failures, aligning with pytest's assertion model.
Verification:
pytest works: All 3 tests now pass successfully with pytest --asyncio-mode=auto, and there are no warnings.
- Application runs: The
mcp-libre command now executes without any ModuleNotFoundError or SyntaxError, indicating the application starts correctly.
These changes significantly improve the project's installability, compatibility, and code quality.
This issue summarizes several critical fixes applied to the
mcp-libreproject to improve its installation, compatibility, and runtime stability.Summary of Changes:
Resolved
ModuleNotFoundError: No module named 'src':mcp-librecommand failed after installation due to Python's inability to find thesrcmodule. This was caused by incorrect packaging configuration inpyproject.toml.pyproject.tomlto correctly package thesrcdirectory by changingpackages = ["libremcp.py", "main.py"]topackages = ["src"]under[tool.hatch.build.targets.wheel].Updated Python Version Compatibility:
pyproject.tomlspecifiedrequires-python = ">=3.12", but the current environment was Python3.10.12, leading to installation errors.requires-python = ">=3.12"torequires-python = ">=3.10"inpyproject.tomlto ensure compatibility with Python 3.10 and above.Fixed
SyntaxError: f-string expression part cannot include a backslash:SyntaxErroroccurred insrc/libremcp.pydue2 to an improperly escaped f-string within a multi-line string literal.script_contentstring insrc/libremcp.pyto correctly handle string formatting and backslashes, resolving the syntax error.Refactored Test Function for Pytest Best Practices:
tests/test_insert_fix.py::test_insert_text_fixfunction returned boolean values, which is not the recommended practice forpytesttest functions.test_insert_fix.pyto remove boolean returns and instead useraisefor failures, aligning withpytest's assertion model.Verification:
pytestworks: All 3 tests now pass successfully withpytest --asyncio-mode=auto, and there are no warnings.mcp-librecommand now executes without anyModuleNotFoundErrororSyntaxError, indicating the application starts correctly.These changes significantly improve the project's installability, compatibility, and code quality.