Skip to content

Commit

Permalink
Feature/SK-918 | Add --version to fedn CLI (#649)
Browse files Browse the repository at this point in the history
* added --version command for fedn package

* fixed single quotes with double quotes

* fixed double quotes for version

* intendation error fixed

* fixed the global variable

* removed raise in the round handler
  • Loading branch information
sowmyasris authored Jul 4, 2024
1 parent 28631b7 commit 19e08c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 10 additions & 2 deletions fedn/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import importlib.metadata

import click

CONTEXT_SETTINGS = dict(
# Support -h as a shortcut for --help
help_option_names=["-h", "--help"],
)

# Dynamically get the version of the package
try:
version = importlib.metadata.version("fedn")
except importlib.metadata.PackageNotFoundError:
version = "unknown"


@click.group(context_settings=CONTEXT_SETTINGS)
@click.version_option(version)
@click.pass_context
def main(ctx):
""":param ctx:
"""
""":param ctx:"""
ctx.obj = dict()
3 changes: 0 additions & 3 deletions fedn/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

import yaml

global STATESTORE_CONFIG
global MODELSTORAGE_CONFIG

SECRET_KEY = os.environ.get("FEDN_JWT_SECRET_KEY", False)
FEDN_JWT_CUSTOM_CLAIM_KEY = os.environ.get("FEDN_JWT_CUSTOM_CLAIM_KEY", False)
FEDN_JWT_CUSTOM_CLAIM_VALUE = os.environ.get("FEDN_JWT_CUSTOM_CLAIM_VALUE", False)
Expand Down
1 change: 0 additions & 1 deletion fedn/network/combiner/roundhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ def _assign_round_clients(self, n, type="trainers"):
clients = self.server.get_active_trainers()
else:
logger.error("(ERROR): {} is not a supported type of client".format(type))
raise

# If the number of requested trainers exceeds the number of available, use all available.
if n > len(clients):
Expand Down

0 comments on commit 19e08c0

Please sign in to comment.