def bump(self, idx: int = -1) -> Version:
        """Bump version by incrementing 1 on the given index of version part.
        If index is not provided: increment the last version bit unless version
        is a pre-release, in which case, increment the pre-release number.
        """
        version = self._version
        if idx == -1 and self.pre:
            ret = type(self)(version).complete()
            ret.pre = (self.pre[0], self.pre[1] + 1)
        else:
            head, value = version[:idx], int(version[idx])
            ret = type(self)((*head, value + 1)).complete()
            ret.pre = None
        return ret
Bump version by incrementing 1 on the given index of version part.
        If index is not provided: increment the last version bit unless version
        is a pre-release, in which case, increment the pre-release number.
        
src/pdm/models/versions.py