Skip to content

Commit

Permalink
Change project's name in pyproject.toml file
Browse files Browse the repository at this point in the history
  • Loading branch information
taleksovska committed May 15, 2024
1 parent 7f1ae58 commit 0b88bbd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.poetry]
name = "Enabler" # noqa
name = "enabler_keitaro_inc" # noqa
version = "0.1.0" # noqa
description = "Enabler is a CLI application built for making life easier when working on microservice-based applications. Through this package we can create, edit and execute custom commands to configure microservices." # noqa
authors = ["Your Name <[email protected]>"] # noqa
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from setuptools import setup


setup(
name="enabler",
version="0.1.0",
Expand Down
5 changes: 1 addition & 4 deletions src/enabler_keitaro_inc/commands/cmd_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from src.enabler_keitaro_inc.enabler import pass_environment, logger
import pkg_resources
import click
from src.enabler_keitaro_inc.type.semver import BasedVersionParamType

# Command to get the current Enabler version
@click.group('version', short_help='Get current version of Enabler', invoke_without_command=True) # noqa
Expand All @@ -11,6 +10,4 @@ def cli(ctx, kube_context_cli):
"""Get current version of Enabler"""
distribution = pkg_resources.get_distribution("enabler")
version = distribution.version
# Ensure the version string has three parts (major, minor, patch)
formatted_version = BasedVersionParamType().convert(version, None, None)
logger.info(f"Enabler {formatted_version}")
logger.info("Enabler "+version)
22 changes: 10 additions & 12 deletions src/enabler_keitaro_inc/type/semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ class BasedVersionParamType(click.ParamType):
def convert(self, value, param, ctx):
try:
parse(value)
return value
except (TypeError, ValueError):
parts = value.split('.')
if len(parts) == 2:
parts.append('0') # Default patch version to 0 if not provided
elif len(parts) == 3:
# Increment patch version for bug fixes
parts[2] = str(int(parts[2]) + 1)
else:
self.fail(f'{value!r} is not a valid version, please use semver', param, ctx) # noqa

return '.'.join(parts)
return (value)
except TypeError:
self.fail(
'{value!r} is not a valid version, please use semver',
param,
ctx,
)
except ValueError:
self.fail(f'{value!r} is not a valid version, please use semver',
param, ctx)

0 comments on commit 0b88bbd

Please sign in to comment.