def parse(script: str) -> Optional["ScriptConfig"]:
        """
        Method that is parsing inline script metadata from datachain script and
        instantiating ScriptConfig class with found data. If no inline metadata is
        found, it returns None
        """
        try:
            meta = ScriptConfig.read(script)
            if not meta:
                return None
            custom = meta.get("tools", {}).get("datachain", {})
            return ScriptConfig(
                python_version=meta.get("requires-python"),
                dependencies=meta.get("dependencies"),
                num_workers=custom.get("workers", {}).get("num_workers"),
                attachments=custom.get("attachments"),
                params={k: str(v) for k, v in custom.get("params").items()}
                if custom.get("params")
                else None,
                inputs=custom.get("inputs"),
                outputs=custom.get("outputs"),
            )
        except Exception as e:
            raise ScriptConfigParsingError(
                f"Error when parsing script meta: {e}"
            ) from e

        Method that is parsing inline script metadata from datachain script and
        instantiating ScriptConfig class with found data. If no inline metadata is
        found, it returns None
        
src/datachain/script_meta.py