Skip to main content

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


Download files

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

Source Distribution

nkparser-0.1.0.tar.gz (55.5 kB view details)

Uploaded Source

Built Distribution

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

nkparser-0.1.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nkparser-0.1.0.tar.gz
  • Upload date:
  • Size: 55.5 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

Hashes for nkparser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58189ce419b5265bb21f8b469edae89a090ed28825ef8fb76b7252e58041f6f1
MD5 df13bd08f7bf1e6fb73fa562cd2e6a9d
BLAKE2b-256 29aa4b54862c0f2cefc530557e591cd6c52ed43546dd21be2741927722162ee7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nkparser-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.2 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

Hashes for nkparser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ee7263e6bc0d47069f4ba96b0499ffc6e70ffad2238ad237b3eec0dd7fa60dd
MD5 c27de2ca797b774b1a3c088521372f2a
BLAKE2b-256 ab314006b52eb18f94108a018b70691bd7a577ec766d884e373291f18f4c977a

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