"""EchoNext is a lightweight, fast and scalable web framework for PythonCopyright (C) 2024 Alexeev Bronislav (C) 2024This library is free software; you can redistribute it and/ormodify it under the terms of the GNU Lesser General PublicLicense as published by the Free Software Foundation; eitherversion 2.1 of the License, or (at your option) any later version.This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301USA"""importrequestsfromrichimportprintfromrich.tracebackimportinstall__version__="0.7.17"install(show_locals=True)
[docs]defcheck_for_update():""" Check for update in pypi """try:response=requests.get("https://pypi.org/pypi/pyechonext/json").json()latest_version=response["info"]["version"]latest_digits=[int(n)forninlatest_version.split(".")]current_digits=[int(n)fornin__version__.split(".")]ifsum(latest_digits)>sum(current_digits):message=f"New version of library pyEchoNext available: {latest_version}"print(f"[red]{'#'*(len(message)+4)}\n#[/red][bold yellow] {message} [/bold yellow][red]#\n{'#'*(len(message)+4)}[/red]\n")elifsum(latest_digits)<sum(current_digits):print(f"[yellow]You use [bold]UNSTABLE[/bold] branch of pyEchoNext. Stable version: {latest_version}, your version: {__version__}[/yellow]\n")exceptrequests.RequestException:print(f"[dim]Version updates information not available. Your version: {__version__}[/dim]")