Skip to main content

Setting up OpenCXL

The following instructions are for Ubuntu 22.04.

Install Dependencies

sudo apt update && \
sudo apt install git python3-pip python3.11-dev libpcap-dev -y
pip install --force poetry==1.8.0

Get Source Code

Top-level

git clone https://github.com/opencxl/opencxl.git

This top-level source contains multiple git submodules. We will work through them one at a time.

Get OpenCXL Core

In the root directory of opencxl (i.e. top-level project), run:

git submodule update --init --progress opencxl-core && cd opencxl-core

Install Python Packages

The core component of OpenCXL uses poetry to manage Python packages and their dependencies in a virtual environment. This is to both minimize impact to the user's native environment as well as to maximize stability by controlling package versions.

In the root directory of opencxl-core, run:

poetry env use python3.11 && poetry config keyring.enabled false
poetry install

To confirm that the installation was successful, run:

poetry show

The output should be something like:

aiohttp          3.9.1  Async http client/server framework (asyncio)
aiosignal 1.3.1 aiosignal: a list of registered asynchronous callbacks
astroid 3.0.2 An abstract syntax tree for Python with inference support.
attrs 23.2.0 Classes Without Boilerplate
bidict 0.22.1 The bidirectional mapping library for Python.
...

Continue to Setting up QEMU

If you had run into issues during setup, try Troubleshooting.

(Optional) Setup For Visual Studio Code IDE Users

Black Formatter

The coding style enforced is based on PEP8. You can automate compliance with VSCode Black Formatter. To install, run the following in VSCode Quick Open (Ctrl+P).

ext install ms-python.black-formatter

Additional info can be found here.

Poetry Interpreter

Select poetry Python interpreter by

  • In root project directory, run
poetry env info --path
  • Set the output path as the value in .vscode/settings.json as python.defaultInterpreterPath. e.g.
"python.defaultInterpreterPath": "/home/eeum/.cache/pypoetry/virtualenvs/cxl-emulator-test-y1iAWfuv-py3.11"

Pytest Integration

Pytest tests can be both managed and run in debug mode in VSCode. Simply click on the flask icon (Testing) on the left side of the UI. VSCode will automatically detect Pytest cases given python.testing.pytestEnabled and python.testing.pytestArgs in .vscode/settings.json.

Once set up, hover over a test case to select Run Test or Debug Test icon to run or debug, respectively.