Skip to content

Commit cdbf693

Browse files
authored
Remove TUI app components from Murfey (#715)
* Removed files and attributes related to the Murfey TUI app * Simplified optional dependency keys used in 'pyproject.toml'; 'instrument-server' as a key is no longer needed
1 parent c6036a9 commit cdbf693

File tree

16 files changed

+5
-3380
lines changed

16 files changed

+5
-3380
lines changed

Dockerfiles/murfey-instrument-server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN apt-get update && \
3232
pip \
3333
build \
3434
importlib-metadata && \
35-
/venv/bin/python -m pip install /python-murfey[client,instrument-server]
35+
/venv/bin/python -m pip install /python-murfey[client]
3636

3737

3838
# Transfer completed Murfey build to base image

pyproject.toml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ classifiers = [
2929
"Programming Language :: Python :: 3.12",
3030
]
3131
dependencies = [
32+
"aiohttp",
3233
"defusedxml", # For safely parsing XML files
34+
"fastapi[standard-no-fastapi-cloud-cli]>=0.116.0",
3335
"pydantic>=2",
3436
"pydantic-settings",
37+
"python-jose",
3538
"requests",
3639
"rich",
3740
"werkzeug",
@@ -42,7 +45,6 @@ cicd = [
4245
"pytest-cov", # Used for generating PyTest coverage reports
4346
]
4447
client = [
45-
"textual==0.42.0",
4648
"websocket-client",
4749
]
4850
developer = [
@@ -52,15 +54,8 @@ developer = [
5254
"pytest", # Test code functionality
5355
"pytest-mock", # Additional mocking tools for unit tests
5456
]
55-
instrument-server = [
56-
"aiohttp",
57-
"fastapi[standard-no-fastapi-cloud-cli]>=0.116.0",
58-
"python-jose",
59-
]
6057
server = [
61-
"aiohttp",
6258
"cryptography",
63-
"fastapi[standard-no-fastapi-cloud-cli]>=0.116.0",
6459
"graypy",
6560
"ispyb>=10.2.4", # Responsible for setting requirements for SQLAlchemy and mysql-connector-python;
6661
"jinja2",
@@ -70,7 +65,6 @@ server = [
7065
"passlib",
7166
"pillow",
7267
"prometheus_client",
73-
"python-jose[cryptography]",
7468
"sqlalchemy[postgresql]", # Add as explicit dependency
7569
"sqlmodel",
7670
"stomp-py>8.1.1", # 8.1.1 (released 2024-04-06) doesn't work with our project
@@ -82,7 +76,6 @@ Documentation = "https://github.com/DiamondLightSource/python-murfey"
8276
GitHub = "https://github.com/DiamondLightSource/python-murfey"
8377
[project.scripts]
8478
"murfey.add_user" = "murfey.cli.add_user:run"
85-
"murfey.client" = "murfey.client.tui.main:run"
8679
"murfey.create_db" = "murfey.cli.create_db:run"
8780
"murfey.db_sql" = "murfey.cli.murfey_db_sql:run"
8881
"murfey.decrypt_password" = "murfey.cli.decrypt_db_password:run"
@@ -121,7 +114,6 @@ include-package-data = true
121114
zip-safe = false
122115

123116
[tool.setuptools.package-data]
124-
"murfey.client.tui" = ["*.css"]
125117
"murfey.util" = ["route_manifest.yaml"]
126118

127119
[tool.setuptools.packages.find]

src/murfey/client/customlogging.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
import json
44
import logging
55

6-
from rich.logging import RichHandler
7-
8-
from murfey.client.tui.screens import LogBook
9-
106
logger = logging.getLogger("murfey.client.customlogging")
117

128

@@ -30,23 +26,3 @@ def emit(self, record):
3026
self._callback(self.prepare(record))
3127
except Exception:
3228
self.handleError(record)
33-
34-
35-
class DirectableRichHandler(RichHandler):
36-
def __init__(self, text_log: LogBook | None = None, **kwargs):
37-
super().__init__(**kwargs)
38-
self.text_log = text_log
39-
self.redirect = False
40-
self._last_time = None
41-
42-
def emit(self, record):
43-
try:
44-
if self.text_log:
45-
message = self.format(record)
46-
message_renderable = self.render_message(record, message)
47-
log_renderable = self.render(
48-
record=record, traceback=None, message_renderable=message_renderable
49-
)
50-
self.text_log.post_message(self.text_log.Log(log_renderable))
51-
except Exception:
52-
self.handleError(record)

src/murfey/client/rsync.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from typing import Awaitable, Callable, List, NamedTuple
2020
from urllib.parse import ParseResult
2121

22-
from murfey.client.tui.status_bar import StatusBar
2322
from murfey.util.client import Observer
2423

2524
logger = logging.getLogger("murfey.client.rsync")
@@ -59,7 +58,6 @@ def __init__(
5958
server_url: ParseResult,
6059
stop_callback: Callable = lambda *args, **kwargs: None,
6160
local: bool = False,
62-
status_bar: StatusBar | None = None,
6361
do_transfer: bool = True,
6462
remove_files: bool = False,
6563
required_substrings_for_removal: List[str] = [],
@@ -107,7 +105,6 @@ def __init__(
107105
)
108106
self._stopping = False
109107
self._halt_thread = False
110-
self._statusbar = status_bar
111108

112109
def __repr__(self) -> str:
113110
return f"<RSyncer ({self._basepath}{self._remote}) [{self.status}]"
@@ -116,15 +113,12 @@ def __repr__(self) -> str:
116113
def from_rsyncer(cls, rsyncer: RSyncer, **kwargs):
117114
kwarguments_from_rsyncer = {
118115
"local": rsyncer._local,
119-
"status_bar": rsyncer._statusbar,
120116
"do_transfer": rsyncer._do_transfer,
121117
"remove_files": rsyncer._remove_files,
122118
"notify": rsyncer._notify,
123119
}
124120
kwarguments_from_rsyncer.update(kwargs)
125121
assert isinstance(kwarguments_from_rsyncer["local"], bool)
126-
if kwarguments_from_rsyncer["status_bar"] is not None:
127-
assert isinstance(kwarguments_from_rsyncer["status_bar"], StatusBar)
128122
assert isinstance(kwarguments_from_rsyncer["do_transfer"], bool)
129123
assert isinstance(kwarguments_from_rsyncer["remove_files"], bool)
130124
assert isinstance(kwarguments_from_rsyncer["notify"], bool)
@@ -134,7 +128,6 @@ def from_rsyncer(cls, rsyncer: RSyncer, **kwargs):
134128
rsyncer._rsync_module,
135129
rsyncer._server_url,
136130
local=kwarguments_from_rsyncer["local"],
137-
status_bar=kwarguments_from_rsyncer["status_bar"],
138131
do_transfer=kwarguments_from_rsyncer["do_transfer"],
139132
remove_files=kwarguments_from_rsyncer["remove_files"],
140133
notify=kwarguments_from_rsyncer["notify"],
@@ -398,12 +391,6 @@ def parse_stdout(line: str):
398391
return
399392

400393
self._files_transferred += 1
401-
if self._statusbar:
402-
with self._statusbar.lock:
403-
self._statusbar.transferred = [
404-
self._statusbar.transferred[0] + 1,
405-
self._statusbar.transferred[1],
406-
]
407394
current_outstanding = self.queue.unfinished_tasks - (
408395
self._files_transferred - previously_transferred
409396
)

src/murfey/client/tui/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)