Parse, query, and serialize Foundry Nuke .nk script files
Project description
nkparser
nkparser parses, queries, validates, and round-trips Foundry Nuke .nk script files.
Install
This project is managed with uv.
uv sync
Install the package into the current environment:
uv pip install .
Install with Graphviz rendering support:
uv pip install '.[graphviz]'
CLI
The package exposes two console scripts:
uv run nkparser --help
uv run nkparse --help
You can also run it as a module:
uv run python -m nkparser --help
Examples
uv run nkparser info tests/fixtures/minimal.nk
uv run nkparser validate tests/fixtures/malformed_unclosed.nk
uv run nkparser tree tests/fixtures/complex_groups.nk --knobs
uv run nkparser nodes tests/fixtures/minimal.nk --class Grade
uv run nkparser dot tests/fixtures/minimal.nk -o graph.dot
uv run nkparser dot tests/fixtures/minimal.nk -o graph.dot --render --dot-command /opt/homebrew/bin/dot
Development
Sync the dev environment:
uv sync --dev
Run checks:
uv run pytest
uv run ruff check .
uv run mypy
Build distributions:
uv build
Python API
import nkparser
script = nkparser.Script.from_file("comp.nk")
print(script.nuke_version)
print(len(list(script.all_nodes())))
reads = script.query().of_class("Read").all()
grade = script.find("Grade1")
if grade:
grade.set("disable", "true")
script.write("comp_modified.nk")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nkparser-0.2.0.tar.gz.
File metadata
- Download URL: nkparser-0.2.0.tar.gz
- Upload date:
- Size: 56.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7aeb8270ad27dd48913f2116c60d6ae15f5d4c8c22eb7bdeae8991917815fb81
|
|
| MD5 |
69877ebc761587eb75514db692a9ff89
|
|
| BLAKE2b-256 |
2ec21544e76d71e0ba7e9bda262311da75511ff05d1b752f38d0d912bc66a5ae
|
File details
Details for the file nkparser-0.2.0-py3-none-any.whl.
File metadata
- Download URL: nkparser-0.2.0-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a498d22ea155d53d157cfc99f6c00993cd6dba301a01f3d36f20593bde5e116
|
|
| MD5 |
b070da3fb4a2691f6f8950b0a811527c
|
|
| BLAKE2b-256 |
b8e7699f427ec38e4a7ac287c0359395446f54d7bb9628d8dec05ef2166a26c7
|