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.3.0.tar.gz (886.2 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.3.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nkparser-0.3.0.tar.gz
  • Upload date:
  • Size: 886.2 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.3.0.tar.gz
Algorithm Hash digest
SHA256 3d0d40d652bd6b572973b36ca366ed8283d05824eab731d48ac671660a337e96
MD5 671528c2288b187d0413f9a5d4e07db2
BLAKE2b-256 a34392ccb45786448a3f3ea080aed18b92fd7fe279de22f05eb9b7b4459ac59f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nkparser-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e20fd0d9b35da4cf57108a96cb40ca14395e6a950bab828b19070e04b4eb444e
MD5 8daa71e412d314c303ba73dbe2d0359f
BLAKE2b-256 0dec5d9a6ee42dc242b487dae25510c6632d2834577e7cc093f7e12c467c515f

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