Working with the code

Install dependencies

This project uses uv for development. Follow the uv Getting Started guide to install and configure it.

Windows

Make sure the swig executable is in your PATH.

macOS

brew install swig

Linux (Debian-based distributions)

sudo apt install swig libu2f-udev pcscd libpcsclite-dev

Linux (RPM-based distributions)

Tested on Fedora 34
sudo dnf install pcsc-lite-devel python3-devel swig

Install yubikey-manager from source

Clone the repository:

git clone https://github.com/Yubico/yubikey-manager.git
cd yubikey-manager

Running from source

To run ykman from source, use the uv run command:

uv run ykman

Show available commands:

uv run ykman --help

Show information about inserted YubiKey:

uv run ykman info

Run ykman in DEBUG mode:

uv run ykman --log-level DEBUG info

Code Style & Security

This project uses ruff for code style, and security linting. mypy and pyright are used for static type checking. These are invoked with a pre-commit hook.

To use these:

uv tool install pre-commit
pre-commit install

Unit tests

To run unit tests:

uv run pytest

Integration tests

Warning
ONLY run these on dedicated developer keys, as it will permanently delete data on the device(s)!

To run integration tests, indicate the serial number (given by ykman list) of the YubiKey to test with. Make sure no other YubiKey is connected when running the test!

uv run pytest --device 123456

To run the tests over NFC, place the YubiKey to test on an NFC reader, and indicate both the reader and the serial number of the YubiKey:

uv run pytest --reader HID --device 123456

The integration test suite will automatically identify which test cases can be run with the attached YubiKey.

Packaging

For third-party packaging, use the source releases and signatures available here. These artifacts are also published on Github on the Releases page.