| Server IP : 178.105.222.151 / Your IP : 216.73.216.38 Web Server : nginx/1.28.3 System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.5.4 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/lib/python3/dist-packages/incremental/ |
Upload File : |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
import os
import shlex
from typing import Any, Dict, List, Type, TypedDict
from hatchling.version.source.plugin.interface import VersionSourceInterface
from hatchling.plugin import hookimpl
from incremental import _load_pyproject_toml, _existing_version
class _VersionData(TypedDict):
version: str
class IncrementalVersionSource(VersionSourceInterface):
PLUGIN_NAME = "incremental"
def get_version_data(self) -> _VersionData: # type: ignore[override]
path = os.path.join(self.root, "./pyproject.toml")
config = _load_pyproject_toml(path)
return {"version": _existing_version(config.version_path).public()}
def set_version(self, version: str, version_data: Dict[Any, Any]) -> None:
raise NotImplementedError(
f"Run `python -m incremental.version --newversion"
f" {shlex.quote(version)}` to set the version.\n\n"
f" See `python -m incremental.version --help` for more options."
)
@hookimpl
def hatch_register_version_source() -> List[Type[VersionSourceInterface]]:
return [IncrementalVersionSource]