def save(  # type: ignore[override]
        self,
        name: str,
        version: Optional[str] = None,
        description: Optional[str] = None,
        attrs: Optional[list[str]] = None,
        update_version: Optional[str] = "patch",
        **kwargs,
    ) -> "DataChain":
        """Save to a Dataset. It returns the chain itself.

        Parameters:
            name : dataset name.
            version : version of a dataset. If version is not specified and dataset
                already exists, version patch increment will happen e.g 1.2.1 -> 1.2.2.
            description : description of a dataset.
            attrs : attributes of a dataset. They can be without value, e.g "NLP",
                or with a value, e.g "location=US".
            update_version: which part of the dataset version to automatically increase.
                Available values: `major`, `minor` or `patch`. Default is `patch`.
        """
        if version is not None:
            semver.validate(version)

        if update_version is not None and update_version not in [
            "patch",
            "major",
            "minor",
        ]:
            raise ValueError(
                "update_version can have one of the following values: major, minor or"
                " patch"
            )

        schema = self.signals_schema.clone_without_sys_signals().serialize()

        # Handle retry and delta functionality
        if self.delta and name:
            from datachain.delta import delta_retry_update

            # Delta chains must have delta_on defined (ensured by _as_delta method)
            assert self._delta_on is not None, "Delta chain must have delta_on defined"

            result_ds, dependencies, has_changes = delta_retry_update(
                self,
                name,
                on=self._delta_on,
                right_on=self._delta_result_on,
                compare=self._delta_compare,
                delta_retry=self._delta_retry,
            )

            if result_ds:
                return self._evolve(
                    query=result_ds._query.save(
                        name=name,
                        version=version,
                        feature_schema=schema,
                        dependencies=dependencies,
                        **kwargs,
                    )
                )

            if not has_changes:
                # sources have not been changed so new version of resulting dataset
                # would be the same as previous one. To avoid duplicating exact
                # datasets, we won't create new version of it and we will return
                # current latest version instead.
                from .datasets import read_dataset

                return read_dataset(name, **kwargs)

        return self._evolve(
            query=self._query.save(
                name=name,
                version=version,
                description=description,
                attrs=attrs,
                feature_schema=schema,
                update_version=update_version,
                **kwargs,
            )
        )
Save to a Dataset. It returns the chain itself.

        Parameters:
            name : dataset name.
            version : version of a dataset. If version is not specified and dataset
                already exists, version patch increment will happen e.g 1.2.1 -> 1.2.2.
            description : description of a dataset.
            attrs : attributes of a dataset. They can be without value, e.g "NLP",
                or with a value, e.g "location=US".
            update_version: which part of the dataset version to automatically increase.
                Available values: `major`, `minor` or `patch`. Default is `patch`.
        
src/datachain/lib/dc/datachain.py