void (@NotNull Project project, @NotNull ConfiguratorContext context) { final CommandLineInspectionProgressReporter logger = context.getLogger(); if (PythonSdkUtil.getAllSdks().isEmpty()) { logger.reportMessage(1, "No configured python interpreters"); return; } final PythonFacetType facetType = PythonFacetType.getInstance(); int skippedModules = 0; for (Module m : ModuleManager.getInstance(project).getModules()) { if (ReadAction.compute(() -> !FileTypeIndex.containsFileOfType(PythonFileType.INSTANCE, m.getModuleContentScope()))) { skippedModules++; continue; } final FacetManager facetManager = FacetManager.getInstance(m); final var facet = facetManager.getFacetByType(facetType.getId()); if (facet == null) { logger.reportMessage(3, "Setting Python facet for: " + m.getName()); invokeLaterOnWriteThreadUnderLock( () -> { final PythonFacet addedFacet = facetManager.addFacet(facetType, facetType.getPresentableName(), null); PySdkExtKt.excludeInnerVirtualEnv(m, addedFacet.getConfiguration().getSdk()); } ); } else { logger.reportMessage(3, "Python facet already here: " + m.getName()); } } logger.reportMessage( 3, "Skipped Python interpreter configuration for " + skippedModules + " module(s) because they don't contain any Python files" ); }