Skip to main content

resolve_python_import_to_path

Function resolve_python_import_to_path 

Source
pub fn resolve_python_import_to_path(
    import_path: &str,
    packages: &[PythonPackage],
    current_file_path: Option<&str>,
) -> Option<String>
Expand description

Resolve a Python import to a file path

Handles:

  • Absolute imports: from myapp.models import Usermyapp/models.py or myapp/models/__init__.py
  • Relative imports: from .models import User (requires current_file_path)
  • Package imports: import myapp.utilsmyapp/utils.py or myapp/utils/__init__.py