Skip to main content

Manage Ubuntu WSL virtual machines from the command line

Project description

wslx

Manage Ubuntu WSL virtual machines from the command line.

wslx imports an Ubuntu Noble rootfs as a WSL distribution, seeds it with cloud-init (a passwordless-sudo box user, the hostname, a few conveniences) and gets you a shell in it — one command per lifecycle step, no manual wsl --import juggling.

It is a Python port of the box wsl provider from gitlab.com/xtec/box, packaged on its own so it installs with uv/pip instead of a Rust toolchain. Machines created by either tool are interchangeable: same rootfs, same cloud-init, same box user.

Install

uv tool install wslx

or run it without installing:

uvx wslx list

pip install wslx works too. Python 3.11+.

Use

wslx create alfa          # import a new Ubuntu distribution named alfa
wslx connect alfa         # open a shell in it (starts it if needed)
wslx connect beta --new   # create, start and enter in one step
wslx list                 # every registered distribution
wslx stop alfa            # terminate
wslx delete alfa          # unregister and remove its disk

create, start, stop and delete take any number of names:

wslx create alfa beta gamma

What a machine looks like

Inside every distribution wslx creates:

  • user box, password password, passwordless sudo, UID 1000 and the default login user
  • hostname set to the distribution name (in /etc/wsl.conf, /etc/hostname and /etc/hosts)
  • install-docker alias — curl -L sh.xtec.dev/docker.sh | sh

Where things live

What Where
Distribution disks (ext4.vhdx) %APPDATA%\wslx\<name>\
Downloaded rootfs image %APPDATA%\wslx\cache\
cloud-init user-data %USERPROFILE%\.cloud-init\<name>.user-data

wslx delete removes all three for the distribution it deletes.

wslx list shows every registered WSL distribution, not just the ones wslx made — the Managed column tells you which ones it owns. Deleting an unmanaged distribution still unregisters it, but its disk lives wherever its own installer put it.

Requirements

WSL only exists on Windows: every command needs wsl.exe on PATH and fails with a clear message anywhere else. The package still installs and imports on macOS and Linux so it can be developed and tested there.

Development

uv sync --all-groups
uv run pytest
uv run ruff check

The test suite is platform-independent — the Windows-only paths are covered through their pure helpers (output parsing, cloud-init rendering, path resolution) and the platform guard itself.

License

AGPL-3.0-only. © David de Mingo.

Project details


Download files

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

Source Distribution

wslx-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wslx-0.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file wslx-0.1.0.tar.gz.

File metadata

  • Download URL: wslx-0.1.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wslx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e7f8bdd053247e04de6a76815a0f0c92d89004e7d261ba1c28d010d4e55d604
MD5 69dbec4e41944947037a459dbec29a32
BLAKE2b-256 3d22b95c809cf21ed340d1b7a929b9fc9227dd55e6c3cf98efd589ca2d420873

See more details on using hashes here.

File details

Details for the file wslx-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: wslx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for wslx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3338b51e059ec70c11ca4bbe0da289883379187d9fa5ce26e74f4ab73ec0a5d2
MD5 ae8626b9c025b926fc56cb58de22637e
BLAKE2b-256 6d29a58c2963cbbc7b95dce6e8b4bc46aa832d4d50bdf4cc7b8bcdf41e2e5150

See more details on using hashes here.

Supported by

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