Skip to main content

MXCuBE Web user interface

Project description

Build and test PyPI codecov

MXCuBE-Web

MXCuBE-Web is the latest generation of the data acquisition software MXCuBE (Macromolecular Xtallography Customized Beamline Environment). The project started in 2005 at ESRF, and has since then been adopted by other institutes in Europe. In 2010, a collaboration agreement has been signed for the development of MXCuBE with the following partners:

MXCuBE-Web is developed as a web application and runs in any recent browser. The application is further built using standard web technologies and does not require any third party plugins to be installed in order to function. Being a web application, it's naturally divided into a server and client part. The communication between the client and server are made using HTTP/HTTPS and web-sockets. It's strongly recommended to use HTTPS, SSL/TLS encrypted HTTP. The traffic passes through the conventional HTTP/HTTPS ports minimizing the need for special firewall or proxy settings to get the application to work.

The underlaying beamline control layer is implemented using the library mxcubecore previously known as HardwareRepository. The mxcubecore module is compatable with both MXCuBE-Web and the MXCuBE-Qt application.

Data collection Sample grid
datacollection-view samplegrid-view

Latest information about the MXCuBE project can be found on the project webpage.

Technologies in use

The backend is built on a Python-flask micro-framework, a library called SocketIO is further used to provide a bi-directional communication channel between backend and client. The backend exposes a REST API to the client.

The client is implemented in ECMAScript6 and HTML5. React, Boostrap and FabricJS are the main libraries used for the UI development

Information for developers

Information for users

Oscarsson, M. et al. 2019. “MXCuBE2: The Dawn of MXCuBE Collaboration.” Journal of Synchrotron Radiation 26 (Pt 2): 393–405.

Gabadinho, J. et al. (2010). MxCuBE: a synchrotron beamline control environment customized for macromolecular crystallography experiments. J. Synchrotron Rad. 17, 700-707

Installation and testing

We recommend using conda to create an isolated environment, conda can be downloaded here.

1. Create a folder that will contain both mxcubeweb and mxcubecore

mkdir mxcube
cd mxcube

2. Clone mxcubeweb and mxcubecore

git clone https://github.com/mxcube/mxcubeweb.git
git clone https://github.com/mxcube/mxcubecore.git

3. Create Conda environment mxcubeweb

We recommend using conda a convenience and create a seperate environemnt for libraries and python version. This, though, is not compulsory and one can use any other tool or configuration for installing the application and the necessary third party libraries.

Create Conda environment mxcubeweb using the conda environment file in mxcubeweb. The installation of the dependencies in the environment takes a few minutes.

The name of the environment is located at the top of file conda-environment.yml. It can be changed from the command line with --name <env-name>.

cd mxcubeweb
conda env create -f conda-environment.yml
# or (to pass a different name)
conda env create -f conda-environment.yml --name another_name

4. Activate the environment

conda activate mxcubeweb

5. Install remaining dependencies

poetry install
npm install --global pnpm@8

6. Install front-end dependencies and build the UI

pnpm --prefix ui install
pnpm --prefix ui build

7. Starting the MXCuBE server

# Activate the conda environement and start the Redis server (if not already running)
conda activate mxcubeweb
redis-server

# In a separate terminal, start the MXCuBE server (note the use of `$(pwd)` to specify absolute paths):
mxcubeweb-server -r $(pwd)/test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/ui/build/ -L debug

Running the above should give something similar to mxcube-backend

8. Serving the MXCuBE-Web front-end application

All that is needed to run the application is to start the server and point your browser to http://localhost:8081, which will serve the prebuilt client (if any).

The test username is idtest0 and the password can be any string (except wrong and ispybDown, those are used to emulate different behaviors), you can use test as a password for example: mxcube-login

The client is not built if nothing appears or you get a "404 page not found" error when browsing localhost:8081. Follow the instructions in step 6 "Install front-end dependencies and build the UI" to build a client .

9. Installing MXCUBE-Web for development

Please read the contributing guidelines before getting started with the development.

The additional tools for development are in the conda-environment-dev.yml file, the environment created above needs to be updated with this.

# Make sure the environment created above is activated
conda activate mxcubeweb

# To install the additional dependencies run:
conda env update --file conda-environment-dev.yml

It's recommended to install mxcubeweb and mxcubecore as links to be able to add breakpoints and debug the application more easily. This can be done with pip.

# In the project root of mxcubeweb (please note that the . (period) is important):
pip install -e .

# In the project root of mxcubecore:
pip install -e .

9.1 Running the back-end tests

The tests are located in the test folder and are executed with pytest.

# Make sure that the conda environment is activated and that the local Redis server is running:
conda activate mxcubeweb
redis-server

# In a separate terminal, activate the environment again and run pytest from the project root of mxcubeweb:
conda activate mxcubeweb
pytest

The output should look something like the following: image

9.2 Starting the front-end development server

The front-end development server listens to changes on the file system and re-builds the UI when changes are made. This makes it very easy and fast to see how changes affect the UI. The development server listens on port 3000.

# Activate the Conda environment and start the MXCuBE server (cf. step 7)
conda activate mxcubeweb
mxcubeweb-server -r $(pwd)/test/HardwareObjectsMockup.xml/ --static-folder $(pwd)/ui/build/ -L debug

# Enter the `ui` folder and start the front-end developement server:
cd ui
pnpm start

# Note that you can also run any pnpm script from the root folder with:
pnpm --prefix ui <script>

Your default browser will open automatically at http://localhost:3000.

9.4 Running the end-to-end tests (E2E)

# With the MXCuBE server still running, run:
pnpm e2e

This should give a result looking something like: image

9.5 Ready to develop

Use your favorite editor to start working with the code. Read the contributing guidelines and check that linting tools are setup correctly. There are settings files for visual studio code in the repository.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mxcubeweb-1.94.0.tar.gz (130.1 kB view details)

Uploaded Source

Built Distribution

mxcubeweb-1.94.0-py3-none-any.whl (152.0 kB view details)

Uploaded Python 3

File details

Details for the file mxcubeweb-1.94.0.tar.gz.

File metadata

  • Download URL: mxcubeweb-1.94.0.tar.gz
  • Upload date:
  • Size: 130.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.13 Linux/6.2.0-1012-azure

File hashes

Hashes for mxcubeweb-1.94.0.tar.gz
Algorithm Hash digest
SHA256 e63a6fd198ec70e00b1d033c41cb896a8138388f158a771646f365c433251cdf
MD5 f1a1fcd61a5dc69604a2a5b6e1acd232
BLAKE2b-256 eb328175c81bbebff5da412074bde52930763af192b14e5bb97a14d8780cac11

See more details on using hashes here.

File details

Details for the file mxcubeweb-1.94.0-py3-none-any.whl.

File metadata

  • Download URL: mxcubeweb-1.94.0-py3-none-any.whl
  • Upload date:
  • Size: 152.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.13 Linux/6.2.0-1012-azure

File hashes

Hashes for mxcubeweb-1.94.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54f974ee54549527dd34a6be880191e9c34f7ed9eaa10aad6681698a487e039c
MD5 2c05c975332a33cf6790f7ac788308cc
BLAKE2b-256 63dbe0088259664612eb75c6dc355f811ec3b3d17a224a9b2fc8db8bd9ec5def

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page