From 918547f6daa96395e1034c1f79155c582e3f1df4 Mon Sep 17 00:00:00 2001 From: Richard Dzurus Date: Wed, 25 Jun 2025 16:57:29 +0200 Subject: [PATCH 1/3] version command in python --- polyapi/cli.py | 15 +++++++++++++++ pyproject.toml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/polyapi/cli.py b/polyapi/cli.py index 1efe663..e99cded 100644 --- a/polyapi/cli.py +++ b/polyapi/cli.py @@ -14,6 +14,16 @@ CLI_COMMANDS = ["setup", "generate", "function", "clear", "help", "update_rendered_spec"] +def _get_version_string(): + """Get the version string for the package.""" + try: + import importlib.metadata + version = importlib.metadata.version('polyapi-python') + return version + except Exception: + return "Unknown" + + def execute_from_cli(): # First we setup all our argument parsing logic # Then we parse the arguments (waaay at the bottom) @@ -22,6 +32,11 @@ def execute_from_cli(): description="Manage your Poly API configurations and functions", formatter_class=argparse.RawTextHelpFormatter ) + + # Add global --version/-v flag + parser.add_argument('-v', '--version', action='version', + version=_get_version_string(), + help="Show version information") subparsers = parser.add_subparsers(help="Available commands") diff --git a/pyproject.toml b/pyproject.toml index 497818c..e27bb41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.8.dev3" +version = "0.3.8.dev5" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [ From f19033ddff085ab25d224370a6a3041bbcf77f49 Mon Sep 17 00:00:00 2001 From: Richard Dzurus Date: Thu, 26 Jun 2025 17:12:05 +0200 Subject: [PATCH 2/3] version increment --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e27bb41..99ffea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.8.dev5" +version = "0.3.8.dev6" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [ From 344ef39ee7c87bb0750d905850100e4fcb819a5c Mon Sep 17 00:00:00 2001 From: Richard Dzurus Date: Fri, 27 Jun 2025 09:11:10 +0200 Subject: [PATCH 3/3] version increment --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 99ffea9..516a121 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.8.dev6" +version = "0.3.8.dev7" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [