Commit 977af5d4 authored by Felix Delattre's avatar Felix Delattre
Browse files

Renamed rcli to rcom and prepared for publication

parent 4fd12267
Pipeline #22623 canceled with stage
...@@ -19,7 +19,7 @@ test: ...@@ -19,7 +19,7 @@ test:
coverage: coverage:
script: script:
- pytest --cov=rcli/ tests/ - pytest --cov=rcom/ tests/
- coverage xml - coverage xml
artifacts: artifacts:
reports: reports:
......
=============================== =======
rabotnik command line interface rcom
=============================== =======
A command line interface for `rabotnik <https://git.gfz-potsdam.de/dynamicexposure/rabotnik/rabotnik>`__.
Copyright and copyleft Copyright and copyleft
---------------------- ----------------------
......
...@@ -28,15 +28,15 @@ from .argument_factory import ArgumentFactory ...@@ -28,15 +28,15 @@ from .argument_factory import ArgumentFactory
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class RCLI: class RCOM:
"""The Rabotnik Command-Line Interface (RCLI). """The Rabotnik Command-Line Interface (RCOM).
Communicate with nodes running within the `rabotnik` ecosystem via the `message_bus`. Communicate with nodes running within the `rabotnik` ecosystem via the `message_bus`.
Args: Args:
parser: Creates and parses command line arguments. parser: Creates and parses command line arguments.
Attributes: Attributes:
arguments: The arguments that are made available in the rcli. arguments: The arguments that are made available in the rcom.
""" """
def __init__(self, parser: argparse.ArgumentParser): def __init__(self, parser: argparse.ArgumentParser):
...@@ -73,7 +73,7 @@ class RCLI: ...@@ -73,7 +73,7 @@ class RCLI:
def main(args: list = None, message_bus: MessageBus = None): def main(args: list = None, message_bus: MessageBus = None):
"""RCLI entry point. """RCOM entry point.
Args: Args:
args: List of arguments. If not provided, read arguments from commandline args: List of arguments. If not provided, read arguments from commandline
...@@ -88,8 +88,8 @@ def main(args: list = None, message_bus: MessageBus = None): ...@@ -88,8 +88,8 @@ def main(args: list = None, message_bus: MessageBus = None):
args = args or sys.argv[1:] args = args or sys.argv[1:]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
rcli = RCLI(parser=parser) rcom = RCOM(parser=parser)
rcli.setup_parser() rcom.setup_parser()
group = parser.add_argument_group("message bus") group = parser.add_argument_group("message bus")
...@@ -131,9 +131,9 @@ def main(args: list = None, message_bus: MessageBus = None): ...@@ -131,9 +131,9 @@ def main(args: list = None, message_bus: MessageBus = None):
) )
) )
rcli.set_message_bus(message_bus) rcom.set_message_bus(message_bus)
# Parse `args` to dictionary. # Parse `args` to dictionary.
args_dict = vars(args) args_dict = vars(args)
loop.run_until_complete(rcli.execute(args_dict)) loop.run_until_complete(rcom.execute(args_dict))
#!/usr/bin/python3 #!/usr/bin/env python3
from setuptools import setup, find_packages # Copyright (c) 2020-2021
#
# * Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup, find_packages
tests_require = [ tests_require = [
"pytest", "pytest",
...@@ -13,20 +29,19 @@ tests_require = [ ...@@ -13,20 +29,19 @@ tests_require = [
linters_require = ["pylint", "pre-commit"] linters_require = ["pylint", "pre-commit"]
setup( setup(
name="rcli", name="rcom",
version="0.1", version="0.0.3",
description="Rabotnik command-line interface", description="A command line interface for rabotnik.",
author="Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ", author="Helmholtz-Zentrum Potsdam Deutsches GeoForschungsZentrum GFZ",
url="https://git.gfz-potsdam.de/dynamicexposure/rabotnik/rcom",
license="AGPLv3+", license="AGPLv3+",
install_requires=[ install_requires=["rabotnik==0.0.3"],
"rabotnik@https://git.gfz-potsdam.de/dynamicexposure/rabotnik/rabotnik/-/archive/master/rabotnik-master.zip" # noqa: E501
],
tests_require=tests_require, tests_require=tests_require,
extras_require={ extras_require={
"tests": tests_require, "tests": tests_require,
"linters": linters_require, "linters": linters_require,
}, },
entry_points={"console_scripts": ["rcli = rcli.rcli:main"]}, entry_points={"console_scripts": ["rcom = rcom.rcom:main"]},
packages=find_packages(), packages=find_packages(),
python_requires=">=3.6", python_requires=">=3.6",
) )
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see http://www.gnu.org/licenses/. # along with this program. If not, see http://www.gnu.org/licenses/.
from rcli.argument_base import ArgumentBase from rcom.argument_base import ArgumentBase
def test_get_format_argument(): def test_get_format_argument():
......
...@@ -20,7 +20,7 @@ import asyncio ...@@ -20,7 +20,7 @@ import asyncio
import pytest import pytest
import argparse import argparse
from rcli.rcli import RCLI from rcom.rcom import RCOM
class MockMessageBus: class MockMessageBus:
...@@ -34,19 +34,19 @@ class MockMessageBus: ...@@ -34,19 +34,19 @@ class MockMessageBus:
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_rcli(): async def test_rcom():
message_bus = MockMessageBus() message_bus = MockMessageBus()
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
rcli = RCLI(parser=parser) rcom = RCOM(parser=parser)
rcli.set_message_bus(message_bus) rcom.set_message_bus(message_bus)
rcli.setup_parser() rcom.setup_parser()
help_formatted = parser.format_help() help_formatted = parser.format_help()
assert help_formatted.startswith("usage:") assert help_formatted.startswith("usage:")
arguments = {"building_id": "1"} arguments = {"building_id": "1"}
await rcli.execute(arguments) await rcom.execute(arguments)
assert message_bus.calls == [((), {"message": "building", "payload": {"building_id": "1"}})] assert message_bus.calls == [((), {"message": "building", "payload": {"building_id": "1"}})]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment