Skip to content

Commit 7821885

Browse files
authored
Changes to enable web based UI (#334)
Large set of changes which introduce two new server components: The hub which provides basic information about all instruments in a configuration file The instrument server which needs to be run on the instrument PC with access to the data and a network connection to the storage server where the data will land As the client is no longer necessary there is some refactoring of endpoints to avoid the need for client IDs with a focus on Murfey session IDs instead which should also aid recovery in the event of instrument server failures. This will very likely need patches
1 parent 41f283d commit 7821885

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2148
-582
lines changed

pyproject.toml

Lines changed: 172 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,172 @@
1-
[build-system]
2-
build-backend = "setuptools.build_meta"
3-
requires = [
4-
"setuptools >= 40.6.0",
5-
"wheel",
6-
]
7-
8-
[project]
9-
name = "murfey"
10-
version = "0.12.5"
11-
description = "Client-Server architecture hauling Cryo-EM data"
12-
readme = "README.md"
13-
keywords = [
14-
"",
15-
]
16-
license = {file = "LICENSE"}
17-
maintainers = []
18-
authors = []
19-
requires-python = ">=3.9"
20-
classifiers = [
21-
"Development Status :: 3 - Alpha",
22-
"Environment :: Console",
23-
"Intended Audience :: Science/Research",
24-
"License :: OSI Approved :: BSD License",
25-
"Operating System :: OS Independent",
26-
"Programming Language :: Python :: 3 :: Only",
27-
"Programming Language :: Python :: 3.9",
28-
"Programming Language :: Python :: 3.10",
29-
"Programming Language :: Python :: 3.11",
30-
"Programming Language :: Python :: 3.12",
31-
]
32-
dependencies = [
33-
"defusedxml", # For safely parsing XML files
34-
"pydantic<2", # Locked to <2 by zocalo
35-
"requests",
36-
"rich",
37-
"werkzeug",
38-
]
39-
[project.optional-dependencies]
40-
cicd = [
41-
"pytest-cov", # Used by Azure Pipelines for PyTest coverage reports
42-
]
43-
client = [
44-
"procrunner",
45-
"textual==0.42.0",
46-
"websocket-client",
47-
"xmltodict",
48-
]
49-
developer = [
50-
"bump2version", # Version control
51-
"ipykernel", # Enable interactive coding with VS Code and Jupyter Notebook
52-
"pre-commit", # Formatting, linting, type checking, etc.
53-
"pytest", # Test code functionality
54-
]
55-
server = [
56-
# "matplotlib", # For visual statistical analysis of images
57-
"cryptography",
58-
"fastapi[standard]",
59-
"ispyb", # Responsible for setting requirements for SQLAlchemy and mysql-connector-python; v10.0.0: sqlalchemy <2, mysql-connector-python >=8.0.32
60-
"jinja2",
61-
"mrcfile",
62-
"numpy",
63-
"packaging",
64-
"passlib",
65-
"pillow",
66-
"prometheus_client",
67-
"python-jose[cryptography]",
68-
"sqlalchemy[postgresql]", # Add as explicit dependency
69-
"sqlmodel",
70-
"stomp-py<=8.1.0", # 8.1.1 (released 2024-04-06) doesn't work with our project
71-
"uvicorn[standard]",
72-
"zocalo",
73-
]
74-
[project.urls]
75-
Bug-Tracker = "https://github.com/DiamondLightSource/python-murfey/issues"
76-
Documentation = "https://github.com/DiamondLightSource/python-murfey"
77-
GitHub = "https://github.com/DiamondLightSource/python-murfey"
78-
[project.scripts]
79-
murfey = "murfey.client:run"
80-
"murfey.add_user" = "murfey.cli.add_user:run"
81-
"murfey.create_db" = "murfey.cli.create_db:run"
82-
"murfey.db_sql" = "murfey.cli.murfey_db_sql:run"
83-
"murfey.decrypt_password" = "murfey.cli.decrypt_db_password:run"
84-
"murfey.generate_key" = "murfey.cli.generate_crypto_key:run"
85-
"murfey.generate_password" = "murfey.cli.generate_db_password:run"
86-
"murfey.server" = "murfey.server:run"
87-
"murfey.sessions" = "murfey.cli.db_sessions:run"
88-
"murfey.simulate" = "murfey.cli.dummy:run"
89-
"murfey.spa_inject" = "murfey.cli.inject_spa_processing:run"
90-
"murfey.spa_ispyb_entries" = "murfey.cli.spa_ispyb_messages:run"
91-
"murfey.transfer" = "murfey.cli.transfer:run"
92-
[project.entry-points."murfey.workflows"]
93-
"lif_to_stack" = "murfey.workflows.lif_to_stack:zocalo_cluster_request"
94-
"tiff_to_stack" = "murfey.workflows.tiff_to_stack:zocalo_cluster_request"
95-
96-
[tool.setuptools]
97-
package-dir = {"" = "src"}
98-
include-package-data = true
99-
zip-safe = false
100-
101-
[tool.setuptools.package-data]
102-
"murfey.client.tui" = ["*.css"]
103-
104-
[tool.setuptools.packages.find]
105-
where = ["src", "tests"]
106-
107-
[tool.isort]
108-
profile = "black"
109-
110-
[tool.flake8]
111-
# Flake8-pyproject allows TOML file settings to be read into Flake8
112-
# URL: https://pypi.org/project/Flake8-pyproject/
113-
select = [
114-
"C4",
115-
"E401",
116-
"E711",
117-
"E712",
118-
"E713",
119-
"E714",
120-
"E721",
121-
"E722",
122-
"E901",
123-
"F401",
124-
"F402",
125-
"F403",
126-
"F405",
127-
"F541",
128-
"F631",
129-
"F632",
130-
"F633",
131-
"F811",
132-
"F812",
133-
"F821",
134-
"F822",
135-
"F841",
136-
"F901",
137-
"W191",
138-
"W291",
139-
"W292",
140-
"W293",
141-
"W602",
142-
"W603",
143-
"W604",
144-
"W605",
145-
"W606",
146-
]
147-
ignore = [
148-
"E203",
149-
"E266",
150-
"E501",
151-
"W503",
152-
]
153-
max-line-length = "88"
154-
155-
[tool.pyproject-fmt]
156-
inputs = "pyproject.toml"
157-
check = false
158-
indent = 4
159-
keep_full_version = true
160-
max-supported-python = "3.12"
161-
162-
[tool.pytest.ini_options]
163-
addopts = "-ra"
164-
165-
[tool.mypy]
166-
disable_error_code = [
167-
"annotation-unchecked", # Notification that the bodies of untyped functions aren't checked. Not critical
168-
"import-untyped", # Error for missing library stubs. Not critical
169-
]
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = [
4+
"setuptools >= 40.6.0",
5+
"wheel",
6+
]
7+
8+
[project]
9+
name = "murfey"
10+
version = "0.12.5"
11+
description = "Client-Server architecture hauling Cryo-EM data"
12+
readme = "README.md"
13+
keywords = [
14+
"",
15+
]
16+
license = {file = "LICENSE"}
17+
maintainers = []
18+
authors = []
19+
requires-python = ">=3.9"
20+
classifiers = [
21+
"Development Status :: 3 - Alpha",
22+
"Environment :: Console",
23+
"Intended Audience :: Science/Research",
24+
"License :: OSI Approved :: BSD License",
25+
"Operating System :: OS Independent",
26+
"Programming Language :: Python :: 3 :: Only",
27+
"Programming Language :: Python :: 3.9",
28+
"Programming Language :: Python :: 3.10",
29+
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
31+
]
32+
dependencies = [
33+
"defusedxml", # For safely parsing XML files
34+
"pydantic<2", # Locked to <2 by zocalo
35+
"requests",
36+
"rich",
37+
"werkzeug",
38+
]
39+
[project.optional-dependencies]
40+
cicd = [
41+
"pytest-cov", # Used by Azure Pipelines for PyTest coverage reports
42+
]
43+
client = [
44+
"procrunner",
45+
"textual==0.42.0",
46+
"websocket-client",
47+
"xmltodict",
48+
]
49+
developer = [
50+
"bump2version", # Version control
51+
"ipykernel", # Enable interactive coding with VS Code and Jupyter Notebook
52+
"pre-commit", # Formatting, linting, type checking, etc.
53+
"pytest", # Test code functionality
54+
]
55+
server = [
56+
# "matplotlib", # For visual statistical analysis of images
57+
"aiohttp",
58+
"cryptography",
59+
"fastapi[standard]",
60+
"ispyb", # Responsible for setting requirements for SQLAlchemy and mysql-connector-python; v10.0.0: sqlalchemy <2, mysql-connector-python >=8.0.32
61+
"jinja2",
62+
"mrcfile",
63+
"numpy",
64+
"packaging",
65+
"passlib",
66+
"pillow",
67+
"prometheus_client",
68+
"python-jose[cryptography]",
69+
"sqlalchemy[postgresql]", # Add as explicit dependency
70+
"sqlmodel",
71+
"stomp-py<=8.1.0", # 8.1.1 (released 2024-04-06) doesn't work with our project
72+
"uvicorn[standard]",
73+
"zocalo",
74+
]
75+
[project.urls]
76+
Bug-Tracker = "https://github.com/DiamondLightSource/python-murfey/issues"
77+
Documentation = "https://github.com/DiamondLightSource/python-murfey"
78+
GitHub = "https://github.com/DiamondLightSource/python-murfey"
79+
[project.scripts]
80+
murfey = "murfey.client:run"
81+
"murfey.add_user" = "murfey.cli.add_user:run"
82+
"murfey.create_db" = "murfey.cli.create_db:run"
83+
"murfey.db_sql" = "murfey.cli.murfey_db_sql:run"
84+
"murfey.decrypt_password" = "murfey.cli.decrypt_db_password:run"
85+
"murfey.generate_key" = "murfey.cli.generate_crypto_key:run"
86+
"murfey.generate_password" = "murfey.cli.generate_db_password:run"
87+
"murfey.hub" = "murfey.hub:run"
88+
"murfey.instrument_server" = "murfey.instrument_server:run"
89+
"murfey.server" = "murfey.server:run"
90+
"murfey.sessions" = "murfey.cli.db_sessions:run"
91+
"murfey.simulate" = "murfey.cli.dummy:run"
92+
"murfey.spa_inject" = "murfey.cli.inject_spa_processing:run"
93+
"murfey.spa_ispyb_entries" = "murfey.cli.spa_ispyb_messages:run"
94+
"murfey.transfer" = "murfey.cli.transfer:run"
95+
[project.entry-points."murfey.workflows"]
96+
"lif_to_stack" = "murfey.workflows.lif_to_stack:zocalo_cluster_request"
97+
"tiff_to_stack" = "murfey.workflows.tiff_to_stack:zocalo_cluster_request"
98+
99+
[tool.setuptools]
100+
package-dir = {"" = "src"}
101+
include-package-data = true
102+
zip-safe = false
103+
104+
[tool.setuptools.package-data]
105+
"murfey.client.tui" = ["*.css"]
106+
107+
[tool.setuptools.packages.find]
108+
where = ["src", "tests"]
109+
110+
[tool.isort]
111+
profile = "black"
112+
113+
[tool.flake8]
114+
# Flake8-pyproject allows TOML file settings to be read into Flake8
115+
# URL: https://pypi.org/project/Flake8-pyproject/
116+
select = [
117+
"C4",
118+
"E401",
119+
"E711",
120+
"E712",
121+
"E713",
122+
"E714",
123+
"E721",
124+
"E722",
125+
"E901",
126+
"F401",
127+
"F402",
128+
"F403",
129+
"F405",
130+
"F541",
131+
"F631",
132+
"F632",
133+
"F633",
134+
"F811",
135+
"F812",
136+
"F821",
137+
"F822",
138+
"F841",
139+
"F901",
140+
"W191",
141+
"W291",
142+
"W292",
143+
"W293",
144+
"W602",
145+
"W603",
146+
"W604",
147+
"W605",
148+
"W606",
149+
]
150+
ignore = [
151+
"E203",
152+
"E266",
153+
"E501",
154+
"W503",
155+
]
156+
max-line-length = "88"
157+
158+
[tool.pyproject-fmt]
159+
inputs = "pyproject.toml"
160+
check = false
161+
indent = 4
162+
keep_full_version = true
163+
max-supported-python = "3.12"
164+
165+
[tool.pytest.ini_options]
166+
addopts = "-ra"
167+
168+
[tool.mypy]
169+
disable_error_code = [
170+
"annotation-unchecked", # Notification that the bodies of untyped functions aren't checked. Not critical
171+
"import-untyped", # Error for missing library stubs. Not critical
172+
]

src/murfey/cli/add_user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from sqlmodel import Session, create_engine
55

66
from murfey.server.api.auth import hash_password
7-
from murfey.server.config import get_machine_config
87
from murfey.server.murfey_db import url
8+
from murfey.util.config import get_machine_config
99
from murfey.util.db import MurfeyUser as User
1010

1111

src/murfey/cli/db_sessions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
from sqlmodel import Session, create_engine, select
44

5-
from murfey.server.config import get_machine_config
65
from murfey.server.murfey_db import url
6+
from murfey.util.config import get_machine_config
77
from murfey.util.db import Session as MurfeySession
88

99

src/murfey/cli/decrypt_db_password.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from cryptography.fernet import Fernet
55

6-
from murfey.server.config import get_machine_config
6+
from murfey.util.config import get_machine_config
77

88

99
def run():

src/murfey/cli/generate_db_password.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from cryptography.fernet import Fernet
55

6-
from murfey.server.config import get_machine_config
6+
from murfey.util.config import get_machine_config
77

88

99
def run():

src/murfey/cli/inject_spa_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
import zocalo
99
from sqlmodel import Session, create_engine, select
1010

11-
from murfey.server.config import get_machine_config, get_microscope
1211
from murfey.server.ispyb import TransportManager
1312
from murfey.server.murfey_db import url
13+
from murfey.util.config import get_machine_config, get_microscope
1414
from murfey.util.db import (
1515
AutoProcProgram,
1616
ClientEnvironment,

0 commit comments

Comments
 (0)