Developer Information
This section describes the steps to build a development environment for cmdbox.
How to install the project
To install the project, follow these steps:
Clone project:
git clone https://github.com/hamacom2004jp/cmdbox.git
Go to the project directory:
cd cmdbox
Create a virtual environment for your project:
python -m venv .venv . .venv/bin/activate
Install project dependencies:
python.exe -m pip install --upgrade pip pip install -r requirements.txt
Build the project:
sphinx-apidoc -F -o docs_src/resources cmdbox sphinx-build -b html docs_src docs python -m collectlicense --out cmdbox/licenses --clear python -m build
How to commit a module
If you are willing to cooperate in the development, please follow these guidelines:
Create a new branch:
git checkout -b feature/your-feature
Make your changes and commit!:
git commit -m "Add your changes"Push to the branch you created:
git push origin feature/your-feature
Create a pull request.
Reference: Procedure for building a Windows environment for Redis
cmdbox uses Redis.
Download the installer from GitHub .
Run the downloaded installer (MSI file).
The wizard will ask you to set the installation directory, so please make a note of the path you set. The default is C:\Program Files\Redis .
In the wizard, there is a setting for the service port of the Redis server, so please make a note of the port you set. The default is 6379.
There is a setting in the wizard for the maximum amount of memory to be used, so set it as needed. For development use, about 100 mb is sufficient.
After installation is complete, open the installation directory in Explorer.
Open the redis.windows-service.conf and redis.windows-service.conf files in it with a text editor such as Notepad.
In this file, search for requirepass foobared, remove the # and uncomment it out.
Change the foobared part of requirepass foobared to your desired password. Make a note of the changed password.
This password will be the password specified in the cmdbox command.
Open the Windows Task Manager, open the Services tab, right-click Redis, and restart the service.
Reference: Procedure for Setting Up a WSL2-Ubuntu 24.04-Docker Environment
Installing WSL2
Execute the following command in the Windows Command Prompt:
wsl --install -d Ubuntu-24.04
Set the ID and password for ubuntu, and then start Ubuntu.
Initial Ubuntu Setup
Log in to the launched Ubuntu and execute the following commands:
cd /etc/apt sudo apt-get update && sudo apt-get install -y language-pack-ja sudo update-locale LANG=ja_JP.UTF-8 sudo apt-get install -y manpages-ja manpages-ja-dev python3.12-dev python3.12-venv libopencv-dev sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
Installing Docker
Execute the following commands in the same Ubuntu environment:
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io && docker --version sudo apt-get install -y docker-compose-plugin && docker compose version sudo systemctl start docker && sudo systemctl enable docker sudo usermod -aG docker $USER newgrp docker
If you want to use a GPU, execute the following commands as well:
cd ~ wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb sudo dpkg -i cuda-keyring_1.1-1_all.deb sudo apt-get update sudo apt-get -y install cuda-toolkit-13-1 curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list sudo apt-get update sudo apt-get install -y nvidia-container-toolkit nvidia-container-toolkit info
Creating a WSL-Ubuntu-cuda_docker file
Execute the following command in the Windows Command Prompt:
wsl --shutdown wsl --export Ubuntu-24.04 <AnyPath>/Ubuntu_cuda_docker-24.04.tar wsl --unregister Ubuntu-24.04 wsl --import Ubuntu_cuda_docker-24.04 <AnyPath>/Ubuntu_cuda_docker-24.04 <AnyPath>/Ubuntu_cuda_docker-24.04.tar --version 2
Starting WSL-Ubuntu-cuda_docker
Execute the following command in the Windows Command Prompt:
cd <AnyPath> wsl -d Ubuntu_cuda_docker-24.04 -u ubuntu
WSL Image Compaction
Execute the following command in the Windows Command Prompt:
diskpart diskpart > select vdisk file="<AnyPath>\ext4.vhdx" diskpart > attach vdisk readonly diskpart > compact vdisk diskpart > detach vdisk diskpart > exit
Reference: How to Use USB Devices in a WSL Environment
To use USB devices in Ubuntu on WSL2, follow these steps: Original Article
Install USBIPD on WSL. Download Site
Open a command prompt in administrator mode and execute the following command.
usbipd list
Note the BUSID of the device you want to attach.
Share the device using the following command. (If the BUSID is '3-1')
usbipd bind --busid 3-1
Attach the device to WSL using the following command. (If the BUSID is '3-1')
usbipd attach --wsl --busid 3-1
Verify that the USB device is available in Ubuntu on WSL.
lsusb