(3.1.0)
- improved version logic - now using hatch and hatch-vcs to automatically generate versions based on git tag / git commit / distance from last tag - raise an error if the voices cache is not populated correctly - lint with mypy in actions - use pyproject.toml for pylint configuration
This commit is contained in:
parent
a7113babb7
commit
c4205fc4f1
10 changed files with 66 additions and 28 deletions
|
@ -7,7 +7,7 @@ from pyflowery.exceptions import (
|
|||
)
|
||||
from pyflowery.models import FloweryAPIConfig, Language, Result, Voice
|
||||
from pyflowery.pyflowery import FloweryAPI
|
||||
from pyflowery.version import VERSION
|
||||
from pyflowery.version import __version__
|
||||
|
||||
__all__ = [
|
||||
"FloweryAPI",
|
||||
|
@ -15,7 +15,7 @@ __all__ = [
|
|||
"Language",
|
||||
"Result",
|
||||
"Voice",
|
||||
"VERSION",
|
||||
"__version__",
|
||||
"ResponseError",
|
||||
"ClientError",
|
||||
"InternalServerError",
|
||||
|
|
|
@ -3,7 +3,7 @@ from logging import Logger, getLogger
|
|||
from sys import version as pyversion
|
||||
from typing import Dict, List, Union
|
||||
|
||||
from pyflowery.version import VERSION
|
||||
from pyflowery.version import version
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -79,4 +79,4 @@ class FloweryAPIConfig:
|
|||
@property
|
||||
def prepended_user_agent(self) -> str:
|
||||
"""Return the user_agent with the PyFlowery module version prepended"""
|
||||
return f"PyFlowery/{VERSION} {self.user_agent} (Python {pyversion})"
|
||||
return f"PyFlowery/{version} {self.user_agent} (Python {pyversion})"
|
||||
|
|
|
@ -31,10 +31,9 @@ class FloweryAPI:
|
|||
async def _populate_voices_cache(self) -> None:
|
||||
"""Populate the voices cache. This method is called automatically when the FloweryAPI object is created, and should not be called directly."""
|
||||
self._voices_cache = tuple([voice async for voice in self.fetch_voices()]) # pylint: disable=consider-using-generator
|
||||
if self._voices_cache == ():
|
||||
if not self._voices_cache:
|
||||
raise ValueError("Failed to populate voices cache! Please report this issue at https://www.coastalcommits.com/cswimr/PyFlowery/issues.")
|
||||
else:
|
||||
self.config.logger.info("Voices cache populated!")
|
||||
self.config.logger.info("Voices cache populated!")
|
||||
|
||||
def get_voices(self, voice_id: str | None = None, name: str | None = None) -> Tuple[Voice, ...] | None:
|
||||
"""Get a set of voices from the cache.
|
||||
|
@ -150,7 +149,5 @@ class FloweryAPI:
|
|||
if request is not None:
|
||||
if isinstance(request.data, bytes):
|
||||
return request.data
|
||||
else:
|
||||
raise ResponseError(f"Invalid response from Flowery API: {request.data!r}")
|
||||
else:
|
||||
raise ResponseError("Invalid response from Flowery API: Empty Response!}")
|
||||
raise ResponseError(f"Invalid response from Flowery API: {request.data!r}")
|
||||
raise ResponseError("Invalid response from Flowery API: Empty Response!}")
|
||||
|
|
|
@ -1 +1,16 @@
|
|||
VERSION = "3.0.1"
|
||||
# file generated by setuptools_scm
|
||||
# don't change, don't track in version control
|
||||
TYPE_CHECKING = False
|
||||
if TYPE_CHECKING:
|
||||
from typing import Tuple, Union
|
||||
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
||||
else:
|
||||
VERSION_TUPLE = object
|
||||
|
||||
version: str
|
||||
__version__: str
|
||||
__version_tuple__: VERSION_TUPLE
|
||||
version_tuple: VERSION_TUPLE
|
||||
|
||||
__version__ = version = '3.0.2.dev0+ga7113ba.d20241115'
|
||||
__version_tuple__ = version_tuple = (3, 0, 2, 'dev0', 'ga7113ba.d20241115')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue