diff --git a/doc/requirements.txt b/doc/requirements.txt index 683955e2..1e6b2dcb 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,9 +1,9 @@ -r ../requirements.txt -pyTooling>=2.12.0 +pyTooling >= 5.0.0, < 6.0 # Enforce latest version on ReadTheDocs -sphinx<6.0.0 +sphinx < 6.0.0 # Sphinx Extenstions sphinxcontrib-mermaid>=0.7.1 diff --git a/pyVersioning/Configuration.py b/pyVersioning/Configuration.py index 42b82914..1e249924 100644 --- a/pyVersioning/Configuration.py +++ b/pyVersioning/Configuration.py @@ -35,7 +35,7 @@ from ruamel.yaml import YAML from pyTooling.Decorators import export from pyTooling.MetaClasses import ExtendedType -from pyTooling.Versioning import SemVersion +from pyTooling.Versioning import SemanticVersion @export @@ -53,14 +53,14 @@ class Configuration(Base, metaclass=ExtendedType): class Project(Base): name: str variant: str - version: SemVersion + version: SemanticVersion def __init__(self, root: 'Base', parent: 'Base', settings: Dict): super().__init__(root, parent) self.name = settings["name"] self.variant = settings["variant"] if "variant" in settings else None - self.version = SemVersion(settings["version"]) if "version" in settings else None + self.version = SemanticVersion(settings["version"]) if "version" in settings else None class Build(Base): class Compiler(Base): diff --git a/pyVersioning/Utils.py b/pyVersioning/Utils.py index b47daa9b..72c8b762 100644 --- a/pyVersioning/Utils.py +++ b/pyVersioning/Utils.py @@ -74,7 +74,7 @@ def __init__(self, command: str, errorMessage: str): @export -class GitHelper: +class GitHelper(metaclass=ExtendedType, mixin=True): __GIT_SHOW_COMMAND_TO_FORMAT_LOOKUP = { GitShowCommand.CommitHash: "%H", GitShowCommand.CommitDateTime: "%ct", diff --git a/pyVersioning/__init__.py b/pyVersioning/__init__.py index 7b92f30e..514c9122 100644 --- a/pyVersioning/__init__.py +++ b/pyVersioning/__init__.py @@ -32,7 +32,7 @@ __email__ = "Paebbels@gmail.com" __copyright__ = "2020-2023, Patrick Lehmann" __license__ = "Apache License, Version 2.0" -__version__ = "0.10.0" +__version__ = "0.11.0" __keywords__ = ["Python3", "Template", "Versioning", "Git"] from dataclasses import dataclass, make_dataclass, field @@ -44,7 +44,7 @@ from typing import Union, Any, Dict from pyTooling.Decorators import export -from pyTooling.Versioning import SemVersion +from pyTooling.Versioning import SemanticVersion from pyTooling.TerminalUI import ILineTerminal from pyVersioning.Utils import SelfDescriptive, GitHelper, GitShowCommand @@ -61,11 +61,11 @@ class Tool(SelfDescriptive): """This data structure class describes the tool name and version of pyVersioning.""" _name: str - _version: SemVersion + _version: SemanticVersion _public = ["name", "version"] - def __init__(self, name: str, version: SemVersion): + def __init__(self, name: str, version: SemanticVersion): self._name = name self._version = version @@ -74,7 +74,7 @@ def name(self) -> str: return self._name @property - def version(self) -> SemVersion: + def version(self) -> SemanticVersion: return self._version def __str__(self) -> str: @@ -162,22 +162,22 @@ def __post_init__(self) -> None: class Project(SelfDescriptive): _name: str _variant: str - _version: SemVersion + _version: SemanticVersion _public = ["name", "variant", "version"] - def __init__(self, name: str, version: Union[str, SemVersion] = None, variant: str = None) -> None: + def __init__(self, name: str, version: Union[str, SemanticVersion] = None, variant: str = None) -> None: """Assign fields and convert version string to a `Version` object.""" self._name = name if name is not None else "" self._variant = variant if variant is not None else "" - if isinstance(version, SemVersion): + if isinstance(version, SemanticVersion): self._version = version elif isinstance(version, str): - self._version = SemVersion(version) + self._version = SemanticVersion(version) elif version is None: - self._version = SemVersion(0, 0, 0) + self._version = SemanticVersion(0, 0, 0) @property def name(self) -> str: @@ -188,7 +188,7 @@ def variant(self) -> str: return self._variant @property - def version(self) -> SemVersion: + def version(self) -> SemanticVersion: return self._version def __str__(self) -> str: @@ -198,32 +198,32 @@ def __str__(self) -> str: @export class Compiler(SelfDescriptive): _name: str - _version: SemVersion + _version: SemanticVersion _configuration: str _options: str _public = ["name", "version", "configuration", "options"] - def __init__(self, name: str, version: Union[str, SemVersion] = "", configuration: str = "", options: str = "") -> None: + def __init__(self, name: str, version: Union[str, SemanticVersion] = "", configuration: str = "", options: str = "") -> None: """Assign fields and convert version string to a `Version` object.""" self._name = name if name is not None else "" self._configuration = configuration if configuration is not None else "" self._options = options if options is not None else "" - if isinstance(version, SemVersion): + if isinstance(version, SemanticVersion): self._version = version elif isinstance(version, str): - self._version = SemVersion(version) + self._version = SemanticVersion(version) elif version is None: - self._version = SemVersion(0, 0, 0) + self._version = SemanticVersion(0, 0, 0) @property def name(self) -> str: return self._name @property - def version(self) -> SemVersion: + def version(self) -> SemanticVersion: return self._version @property @@ -316,7 +316,7 @@ def collectData(self) -> None: else: self.service = WorkStation() - self.variables["tool"] = Tool("pyVersioning", SemVersion(__version__)) + self.variables["tool"] = Tool("pyVersioning", SemanticVersion(__version__)) self.variables["git"] = self.getGitInformation() self.variables["env"] = self.getEnvironment() self.variables["platform"] = self.service.getPlatform() @@ -327,11 +327,11 @@ def calculateData(self) -> None: if self.variables["git"].tag != "": pass - def getVersion(self, config: Configuration.Project) -> SemVersion: + def getVersion(self, config: Configuration.Project) -> SemanticVersion: if config.version is not None: return config.version else: - return SemVersion("0.0.0") + return SemanticVersion("0.0.0") def getGitInformation(self) -> Git: return Git( @@ -511,7 +511,7 @@ def getBuild(self, config: Configuration.Build) -> Build: def getCompiler(self, config: Configuration.Build.Compiler) -> Compiler: return Compiler( name=config.name, - version=SemVersion(config.version), + version=SemanticVersion(config.version), configuration=config.configuration, options=config.options ) diff --git a/pyproject.toml b/pyproject.toml index 10be84ac..ca89a90f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ - "pyTooling >= 2.12.0", - "setuptools >= 62.3.3", - "wheel >= 0.38.1" + "pyTooling >= 5.0.0", + "setuptools >= 68.0.0", + "wheel >= 0.40.0" ] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 69b76870..39e81999 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ -ruamel.yaml>=0.17.18 +ruamel.yaml >= 0.17.18 -pyTooling>=2.12.1 -pyTooling.TerminalUI>=1.5.9 -pyAttributes>=2.5.1 +pyTooling >= 5.0.0, < 6.0 +pyAttributes >= 2.5.1 diff --git a/tests/requirements.txt b/tests/requirements.txt index b29d3be6..053fcfd6 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -8,5 +8,5 @@ pytest>=7.2.1 pytest-cov>=4.0.0 # Static Type Checking -mypy>=1.0.0 +mypy>=1.2.0 lxml>=4.9 diff --git a/tests/unit/Database.py b/tests/unit/Database.py index bd297a06..6da2a68f 100644 --- a/tests/unit/Database.py +++ b/tests/unit/Database.py @@ -31,7 +31,7 @@ """Unit tests for project information.""" from unittest import TestCase -from pyTooling.Versioning import SemVersion +from pyTooling.Versioning import SemanticVersion from pyVersioning import Project as pyV_Project @@ -51,7 +51,7 @@ def test_ProjectName(self): self.assertEqual(project.name, name) self.assertEqual(project.variant, variant) - self.assertEqual(project.version, SemVersion("0.0.0")) + self.assertEqual(project.version, SemanticVersion("0.0.0")) def test_ProjectName_VariantName(self): name = "Project 1" @@ -61,7 +61,7 @@ def test_ProjectName_VariantName(self): self.assertEqual(project.name, name) self.assertEqual(project.variant, variant) - self.assertEqual(project.version, SemVersion("0.0.0")) + self.assertEqual(project.version, SemanticVersion("0.0.0")) def test_ProjectName_VersionAsString(self): name = "Project 1" @@ -72,12 +72,12 @@ def test_ProjectName_VersionAsString(self): self.assertEqual(project.name, name) self.assertEqual(project.variant, variant) - self.assertEqual(project.version, SemVersion(version)) + self.assertEqual(project.version, SemanticVersion(version)) def test_ProjectName_VersionAsVersion(self): name = "Project 1" variant = "" - version = SemVersion("1.3.2") + version = SemanticVersion("1.3.2") project = pyV_Project(name, version)