From 345b9e5cf525d9125d498225ac67a68e3d586f6d Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 2 Oct 2024 18:15:55 +0300 Subject: [PATCH 1/2] fix: remove need for pkg_resources (setuptools) --- gigalixir/__init__.py | 12 +++++++----- setup.py | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gigalixir/__init__.py b/gigalixir/__init__.py index 0a3a9e7..058398e 100644 --- a/gigalixir/__init__.py +++ b/gigalixir/__init__.py @@ -39,7 +39,9 @@ import os import platform from functools import wraps -import pkg_resources +import importlib.metadata + +CLI_VERSION = importlib.metadata.version("gigalixir") def _show_usage_error(self, file=None): if file is None: @@ -61,7 +63,7 @@ def _show_usage_error(self, file=None): if env == "prod": rollbar.init(ROLLBAR_POST_CLIENT_ITEM, 'production', enabled=True, allow_logging_basic_config=False, - code_version=pkg_resources.get_distribution("gigalixir").version) + code_version=CLI_VERSION) elif env == "dev": rollbar.init(ROLLBAR_POST_CLIENT_ITEM, 'development', enabled=False, allow_logging_basic_config=False) elif env == "test": @@ -85,7 +87,7 @@ def wrapper(*args, **kwds): try: f(*args, **kwds) except: - version = pkg_resources.get_distribution("gigalixir").version + version = CLI_VERSION rollbar.report_exc_info(sys.exc_info(), payload_data={"version": version}) logging.getLogger("gigalixir-cli").error(sys.exc_info()[1]) sys.exit(1) @@ -228,7 +230,7 @@ def cli(ctx, env): else: raise Exception("Invalid GIGALIXIR_ENV") - ctx.obj['session'] = gigalixir_api_session.ApiSession(host, pkg_resources.get_distribution("gigalixir").version) + ctx.obj['session'] = gigalixir_api_session.ApiSession(host, CLI_VERSION) ctx.obj['host'] = host ctx.obj['env'] = env @@ -1123,7 +1125,7 @@ def version(ctx): """ Show the CLI version. """ - click.echo(pkg_resources.get_distribution("gigalixir").version) + click.echo(CLI_VERSION) @cli.command(name='open') diff --git a/setup.py b/setup.py index 8c2ac0a..53e42cd 100644 --- a/setup.py +++ b/setup.py @@ -5,13 +5,14 @@ url='https://github.com/gigalixir/gigalixir-cli', author='Tim Knight', author_email='tim@gigalixir.com', - version='1.13.0', + version='1.13.1', packages=find_packages(), include_package_data=True, install_requires=[ 'certifi>=2024.2.2', 'click>=8.1', 'cryptography>=38.0', + 'importlib-metadata>=7.0.1', 'pygments>=2.13', 'pyOpenSSL>=22.1', 'qrcode>=7.3', From efc26fe4e3d3619e4316f58b3f67f3dfbe9ca1a5 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 2 Oct 2024 18:18:16 +0300 Subject: [PATCH 2/2] fix: typo in remote command Merged from: akoutmos:patch-1 PR #114 --- gigalixir/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gigalixir/app.py b/gigalixir/app.py index f86dc36..1f346a3 100644 --- a/gigalixir/app.py +++ b/gigalixir/app.py @@ -120,7 +120,7 @@ def distillery_eval(session, app_name, ssh_opts, ssh_cmd, expression): # capture_output == True as this isn't interactive # and we want to return the result as a string rather than # print it out to the screen - return ssh_helper(session, app_name, ssh_opts, ssh_cmd, True, "gigalixir_run", "distillery_eval", "--", expression) + return ssh_helper(session, app_name, ssh_opts, ssh_cmd, True, "gigalixir_run", "distillery-eval", "--", expression) def distillery_command(session, app_name, ssh_opts, ssh_cmd, *args): ssh(session, app_name, ssh_opts, ssh_cmd, "gigalixir_run", "shell", "--", "bin/%s" % customer_app_name(session, app_name), *args)