feat: Dynamic improvements, logging, and comprehensive documentation#3
Merged
pyros-projects merged 11 commits intomainfrom Nov 24, 2025
Merged
feat: Dynamic improvements, logging, and comprehensive documentation#3pyros-projects merged 11 commits intomainfrom
pyros-projects merged 11 commits intomainfrom
Conversation
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
This PR introduces major enhancements to wishful's dynamic generation capabilities, comprehensive logging infrastructure, and improved documentation. The changes significantly improve the runtime-aware regeneration system, add production-grade logging, and enhance the developer experience.
✨ Key Features
📝 Logging Infrastructure (NEW)
.wishful/_logs/wishful.configure(log_level="DEBUG")orWISHFUL_LOG_LEVELenv vardebug=Trueenables DEBUG level, file logging, and disables spinners🔄 Dynamic Namespace Enhancements
wishful.dynamic.*modules now receive call-site context (function name, args, kwargs).wishful/_snapshots/for debugging🐛 Error Handling & Resilience
_wishful_loaderacross module reloads🛡️ Finder & Module System Improvements
wishfulroot📖 Documentation & Examples
10_cosmic_horror_line_by_line.py- demonstrates dynamic runtime context11_logging.py- showcases logging configurationdocs-site/📊 Changes by Category
Core System ()
New Files
src/wishful/logging.py- Complete logging infrastructure with loguru + RichModified Files
config.pylog_levelandlog_to_filesettingsconfigure()now acceptslog_levelandlog_to_fileparametersdebug=True→log_level="DEBUG",log_to_file=True,spinner=Falsereset_defaults()now reconfigures loggingcore/discovery.pyruntime_contextparameter indiscover()_append_runtime_context()helper to format runtime call info for LLM_is_plain_import()detects module-level imports (vs from-imports)core/finder.pyNonefor barewishfulto let package handle itsysdirectly instead of__import__("sys")core/loader.pyDynamicProxyModuleclass: New proxy that regenerates on each attribute access_resolve_generate_module_code(): Function resolver that respects monkeypatchesmodeparameter propagated through generation pipeline_regenerate_for_proxy(): Handles attribute access regeneration_call_with_runtime(): Captures args/kwargs and regenerates with runtime contextcache.write_dynamic_snapshot()for debug tracesfile_pathtracking: Proper__file__attribution for generated modulesllm/client.pymodeparameter added togenerate_module_code()and_call_llm()llm/prompts.pymode="dynamic"cache/manager.pywrite_dynamic_snapshot()anddynamic_snapshot_path()for dynamic mode tracingTests ()
conftest.pydebug=Truefor full loggingwishful.*modules, only clearsstatic/dynamictest_import_hook.pytest_dynamic_call_includes_runtime_context()- verifies runtime context injectiontest_static_syntax_error_retries_once()- validates retry logic for statictest_dynamic_syntax_error_retries_once()- validates retry logic for dynamictest_dynamic_writes_snapshot()- confirms snapshot creationtest_logging.py(NEW)test_logging_creates_file_and_records_generation()- file logging verificationtest_logging_records_syntax_retry()- retry event loggingtest_namespaces.pytest_dynamic_skips_cache()to expect multiple calls (import + proxy)test_dynamic_proxy_regenerates_on_each_access()- proxy behavior validationExamples
10_cosmic_horror_line_by_line.py- Creative writing with runtime context11_logging.py- Logging configuration showcaseDocumentation
Dependencies
loguru>=0.7.3to runtime dependencies🧪 Testing
🔧 Breaking Changes
None!
This PR is backward compatible. Existing code continues to work:
wishful.static.*imports behave identicallydebug=Trueor explicit config)📋 Migration Guide
No migration needed! To opt into new features:
Enable Logging
Use Dynamic Runtime Context
🎯 Next Steps (Future Work)
📸 Example Output
With
wishful.configure(debug=True):Logs are also written to
.wishful/_logs/2024-11-24.logwith daily rotation.🙏 Review Notes
This is a substantial PR but maintains clean separation of concerns:
Please review:
*Ready to merge/home/ai/projects/wishful && git fetch origin main && git status All tests passing, no breaking changes, comprehensive documentation.