Skip to main content

ndnc

A DSL interpreter for transparent distributed execution over NDN (Named Data Networking).

Write code without thinking about where it runs — local or remote. The system handles it.

Installation

pip install ndnc

Usage

Run a .ndn script

ndnc run path/to/script.ndn

Run with arguments

ndnc run path/to/script.ndn arg0 arg1

Start a gRPC function server

pip install 'ndnc[grpc]'
ndnc serve path/to/function.ndn --port 50051

ndnc serve requires a function source. The existing --grpc flag is accepted for compatibility. The fixed-data NDN Producer is a repository example: from a checkout with NFD running, start it with python3 examples/producer.py.

Examples

Fetch data by NDN name and print it:

let height = interest "/height/Mt.Fuji/"
print height

Fetch data and convert units with a registered remote function:

let height_m = interest "/height/Mt.Fuji/"
let height_ft = m_to_feet(height_m)
print height_ft

These examples require NFD and a Producer serving /height/Mt.Fuji, such as examples/producer.py. The unit conversion example also requires a remote function server providing m_to_feet.

Requirements

NDN Network Requirements

To fetch data or execute functions over an actual NDN network, the following must be running on your machine:

  • NFD (NDN Forwarding Daemon) — handles NDN packet forwarding
  • NLSR (Named-data Link State Routing) — manages routing between NDN nodes

Without these, interest expressions will fall back to local data only.

Function calls use remote function endpoints. Request failures propagate as errors; ndnc does not fetch function source code or execute a local fallback.

Interest responses and function results are cached in memory within the process. No disk cache is read or written. Cached values are discarded when the process exits.

Function return values

Use return to produce a function result. It stops execution of the current script/function. print writes to stdout only and is never used as the result. Without a return, the result is None (an empty response over the text NDN/gRPC interface).

Function (average.ndn):

let avg = (arg0 + arg1) / 2
return avg

Caller:

let result = average(10, 20)
print result

For CLI integrations, keep logs on stdout and write the return value separately:

ndnc run --result-file result.json average.ndn 10 20

result.json contains JSON 15. ndnc run does not automatically print return values. This also applies to exec_in_context. Existing function scripts that used print as their return value must change to return. Caller scripts that print results remain unchanged.

Release: the existing release-branch workflow increments the package version from 0.0.6 to 0.0.7. Publish that version before building the function runtime and invoker images pinned to 0.0.7; deploy both images before registering scripts using return.

Returning an image

return interest "/print_image"

Returns the image served by /print_image and stops execution. The Producer must already serve that image.

All function calls use remote endpoints; concat and put_image are not built-in local functions.

Save a result with ndnc run --output received.png script.ndn.

Metadata

Release files for ndnc 0.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ndnc 0.0.19
File Size Uploaded Provenance Actions
ndnc-0.0.19.tar.gz 17.3 kB Without provenance Details for ndnc-0.0.19.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ndnc 0.0.19
File Interpreter ABI Platform Actions
ndnc-0.0.19-py3-none-any.whl Python 3 none any Details for ndnc-0.0.19-py3-none-any.whl

Total release size: 36.0 kB

Release files / ndnc-0.0.19.tar.gz

Download URL ndnc-0.0.19.tar.gz
Size 17.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1d4e83d13ad3cc1065c0e349b6d7b7f1f53dd7ddb471759381d57b87c7f10547
BLAKE2b-256 checksum
How to use checksums
9803a324be4ba4f2350cd98dc76c081a84adaab8d210c2b6661fa2e9e999018f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ndnc-0.0.19-py3-none-any.whl

Download URL ndnc-0.0.19-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9609b5e2906e1dde675b79f0fba21c2df8270a5802da38c46e49eb57c03b0aba
BLAKE2b-256 checksum
How to use checksums
427ee64afe302f13bff42a5642c8043b10fe392e820b3164a224c80e819cb20c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ndnc 0.0.19

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page