Migration Guide¶
This is a historical guide: it covers the upgrade from 0.1.x to 0.2.0. Some APIs it shows were later changed or removed, so for the current tools and configuration see the README and namespace-packages.md.
Table of Contents¶
Version 0.2.0 Migration¶
From 0.1.x to 0.2.0¶
Version 0.2.0 introduces smart defaults, scope aliases, and performance optimizations.
What's New¶
- Smart Defaults: Methods now have intelligent default scopes
- Scope Aliases: Define custom scope combinations
- Scoped Caching: Separate caches per scope
- Parallel Search: Concurrent path searching
- Lazy Loading: On-demand namespace loading (no longer used; the class is deprecated, see #628)
Migration Steps¶
- Review your current configuration
Check your existing .pyeye.json:
cat .pyeye.json
- Update configuration format (optional)
Old format still works, but you can now add:
{
"scope_defaults": {
"global": "all",
"methods": {
"find_pydantic_models": "main"
}
},
"scope_aliases": {
"my-project": ["main", "namespace:company"]
}
}
- Update method calls (optional)
Methods now accept None for scope to use smart defaults:
# Old - explicit scope required
results = await analyzer.find_subclasses("Base", scope="all")
# New - uses smart default ("all" for find_subclasses)
results = await analyzer.find_subclasses("Base")
- Test your configuration
Validate scopes work as expected:
Deprecated:
ScopeValidatoris unused by pyeye and will be removed in v3.0 (#628); constructing it emits aDeprecationWarning.
from pyeye.scope_utils import ScopeValidator
validator = ScopeValidator(namespace_paths, additional_paths, scope_aliases)
available = validator.list_available_scopes()
print(available)
Breaking Changes¶
Version 0.2.0¶
-
Scope defaults: before 0.2.0, each method had a fixed default scope. From 0.2.0, an omitted scope resolves through the smart defaults and any
scope_defaultsyou configure. Impact: minimal, because existing calls keep working. -
Cache invalidation
-
Before: Single global cache
- After: Scoped caches
New Features¶
Smart Defaults¶
In 0.2.0, methods gained a default scope suited to their purpose; the current per-tool defaults are in Default Scopes for Plugin Tools.
Override the default for framework plugin tools in configuration. Keys are MCP tool names (see Default Scopes for Plugin Tools):
{
"scope_defaults": {
"methods": {
"find_flask_routes": "namespace:api"
}
}
}
Scope Aliases¶
Define reusable scope combinations:
{
"scope_aliases": {
"backend": ["namespace:api", "namespace:db"],
"frontend": ["namespace:ui", "namespace:components"]
}
}
Use the alias as the scope of a plugin tool call, e.g. find_flask_routes(scope="backend").
Performance Features¶
- Parallel Search: Automatically searches multiple paths concurrently
- Scoped Caching: Separate caches prevent unnecessary invalidation
- Lazy Loading: Namespaces loaded only when needed (no longer used; the class is deprecated, see #628)
Configuration Changes¶
Before (0.1.x)¶
{
"packages": ["../lib"],
"namespaces": {
"company": ["../company-api", "../company-auth"]
}
}
After (0.2.0)¶
{
"packages": ["../lib"],
"namespaces": {
"company": ["../company-api", "../company-auth"]
},
"scope_defaults": {
"global": "all",
"methods": {
"find_pydantic_models": "namespace:company"
}
},
"scope_aliases": {
"services": ["namespace:company.api", "namespace:company.auth"],
"libraries": ["packages", "namespace:company.lib"]
}
}
Environment Variables¶
PYEYE_CACHE_TTL: Seconds a cached scope file list or lookup result lives (default: 300)
Default scopes for the framework plugin tools are set in the config file
(scope_defaults), not through the environment. The full list of environment variables is in the README's
Performance Settings.
API Changes¶
Analyzer Methods¶
In 0.2.0, the scope-taking analyzer methods let you omit scope, which then resolves through the smart defaults.
New Utilities¶
from pyeye.scope_utils import (
SmartScopeResolver, # Smart defaults
ScopeValidator, # Validate scopes (deprecated, removed in v3.0)
ScopeDebugger, # Debug scope resolution (deprecated, removed in v3.0)
ScopedCache, # Scoped caching
LazyNamespaceLoader, # Lazy loading (deprecated, removed in v3.0)
parallel_search # Parallel file search
)
Troubleshooting Migration¶
Issue: Methods returning different results¶
Cause: Smart defaults may search different scopes than before
Solution: Explicitly specify scope or configure defaults:
{
"scope_defaults": {
"global": "all"
}
}
Issue: Cache not working as expected¶
Cause: Scoped caching separates caches
Solution: Ensure consistent scope usage:
# Always use same scope for related operations
scope = "namespace:company"
symbols = await analyzer.find_symbol("User", scope=scope)
subclasses = await analyzer.find_subclasses("User", scope=scope)
Issue: Performance regression¶
Cause: Searching too broad a scope
Solution: Use specific scopes and aliases:
# Instead of
results = await find_pydantic_models(scope="all")
# Use
results = await find_pydantic_models(scope="namespace:company.models")
Rollback Procedure¶
If you need to rollback to 0.1.x:
-
Restore previous version: 0.1.x was never published to PyPI as
pyeye-mcp(it waspython-code-intelligence-mcp, modulepycodemcp). To run it, check out the repository'sv0.1.0tag and install from that checkout. -
Remove new configuration keys:
- Remove
scope_defaults -
Remove
scope_aliases -
Update code to use explicit scopes:
# Add explicit scope to all calls
results = await analyzer.find_subclasses("Base", scope="all")
Getting Help¶
- Documentation: See namespace-packages.md
- Examples: Check
examples/configurations/ - Issues: Report at GitHub Issues