@Override
	public boolean run(DocletEnvironment env) {

		docEnv = env;
		docConverter = new JavadocConverter(env, log);

		processedPackages = new HashSet<>();
		topLevelPackages = new HashSet<>();

		// Create destination directory
		if (destDir == null) {
			log.print(Kind.ERROR, "Destination directory not set");
			return false;
		}
		if (!destDir.exists()) {
			if (!destDir.mkdirs()) {
				log.print(Kind.ERROR, "Failed to create destination directory at: " + destDir);
				return false;
			}
		}

		Elements elements = docEnv.getElementUtils();
		Set<ModuleElement> modules = ElementFilter.modulesIn(docEnv.getSpecifiedElements());
		if (!modules.isEmpty()) {
			useAllTypes = true;
			modules.stream()
					.map(ModuleElement::getDirectives)
					.flatMap(List::stream)
					// only exported packages
					.filter(d -> d.getKind() == ModuleElement.DirectiveKind.EXPORTS)
					.map(ModuleElement.ExportsDirective.class::cast)
					// only exported to ALL-UNNAMED
					.filter(export -> export.getTargetModules() == null)
					.map(ModuleElement.ExportsDirective::getPackage)
					.map((el) -> new PythonTypeStubPackage(this, el))
					.forEach(PythonTypeStubPackage::process);
			return true;
		}

		Set<PackageElement> packages = ElementFilter.packagesIn(docEnv.getSpecifiedElements());
		if (!packages.isEmpty()) {
			useAllTypes = true;
			packages.stream()
					.map((el) -> new PythonTypeStubPackage(this, el))
					.forEach(PythonTypeStubPackage::process);
			return true;
		}

		// it is not safe to use parallelStream :(
		ElementFilter.typesIn(docEnv.getSpecifiedElements())
				.stream()
				.map(elements::getPackageOf)
				.distinct()
				.map((el) -> new PythonTypeStubPackage(this, el))
				.forEach(PythonTypeStubPackage::process);

		// ghidra docs always explicitly specifies the types
		// so we only need to check the option here
		if (ghidraMode) {
			GhidraBuiltinsBuilder builder = new GhidraBuiltinsBuilder(this);
			builder.process();
		}

		return true;
	}
Doclet that outputs Python pyi files.<p/>

To run: gradle createPythonTypeStubs
GhidraBuild/BuildFiles/Doclets/src/main/java/ghidra/doclets/typestubs/PythonTypeStubDoclet.java