Skip to main content

Organize a Nintendo Switch NSP/NSZ library and convert between NSP and NSZ

Project description

nsptool

CLI to organize a Nintendo Switch NSP/NSZ library into a clean per-game layout and convert between NSP and NSZ (delegating to nsz).

Library layout

Library/
  Game Name [0100XXXXXXXX0000] [US]/
    Game Name [0100XXXXXXXX0000][v0] [US].nsp            <- base game
    Game Name [0100XXXXXXXX0800][v65536] [US].nsp        <- update
    Game Name (DLC Name)[0100XXXXXXXX1234][v] [US].nsp   <- DLC

Files are identified by decrypting the CNMT metadata inside the container (authoritative), falling back to filename parsing ([titleid][vN]) when the title uses a master key that isn't in your prod.keys. Display names come from an existing library folder for the same title first, then from titledb.

Install

uv tool install nsptool     # or: pipx install nsptool / pip install nsptool

Requirements:

  • prod.keys dumped from your own console (Lockpick_RCM or similar). Titles newer than your dump's highest master key can't be decrypted, so keep it current.

Setup

The first run opens a short wizard asking for your library directory, the path to prod.keys, and the region tag, saved to ~/.config/nsp-tool/config.toml. Re-run it anytime with nsptool config --setup.

nsptool config              # show current settings
nsptool update-titledb      # one-time (~150 MB) download, cached as a small index

nsptool links your keys file to ~/.switch/prod.keys, where nsz expects it.

Commands

# inspect files (titleid, version, type, name)
nsptool scan ~/Downloads/incoming

# add new files to the library; dry run by default, shows the full plan
nsptool library add ~/Downloads/incoming
nsptool library add ~/Downloads/incoming --apply          # move for real
nsptool library add ~/Downloads/incoming --apply --copy   # copy instead
nsptool library add ~/Downloads/incoming --library /path  # different target

# normalize the library itself (fix drifted names/locations); dry run by default
nsptool library organize
nsptool library organize --apply

# per-game overview of the library (games, versions, DLC counts, sizes)
nsptool library list

# NSP <-> NSZ (verified by default)
nsptool compress "Game [0100...][v0] [US].nsp" --rm-source
nsptool decompress "Game [0100...][v0] [US].nsz" -o ./out

library add/library organize never overwrite: files whose titleid+version already exist in the library are reported as duplicate, and name collisions as conflict, both left untouched. --fast trusts filenames and skips decryption.

Dev

uv sync
uv run pytest tests/
uv run ruff check src/ tests/
uv run ty check src/

CI (.github/workflows/ci.yml) runs the same three checks. Test it locally with act:

act push --container-architecture linux/arm64 --pull=false

(--pull=false avoids act force-pulling the runner image with stale Docker Hub credentials; pull catthehacker/ubuntu:act-latest manually once first.)

License

MIT. Depends on nsz (MIT). This tool manages backups of games you own, dumped with your own console keys; it contains no keys and no copyrighted content.

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

nsptool-0.1.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

nsptool-0.1.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nsptool-0.1.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nsptool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e9a6017de8df0d6afe9797dc8ff8ff2520a8b7a6faa51f38a9b68ff7023a7e97
MD5 274d6d7585d34e17830d5e35bcbda7f1
BLAKE2b-256 1cba59e3c2acd5923c2e4a5a681e5ee9bed55c683a5d963328849b67775722b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nsptool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nsptool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a24b7583a3602b8a27f367a0b8eaba67d23337585764553134023684fb681f32
MD5 95fe2c3076a8bf276b0fb7091a1c0b73
BLAKE2b-256 7cfbabe17c84e72a543f3a9ed03eeaef8fd54ebb7cb81ff1d56f2c9124df7cbf

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