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 NDN server (producer)
ndnc serve
Examples
Fetch data by NDN name and print it:
let height = interest "/height/Mt.Fuji/"
print height
Fetch data and convert units with a local function:
let height_m = interest "/height/Mt.Fuji/"
let height_ft = m_to_feet(height_m)
print height_ft
These examples use locally registered data and run without NFD. When NFD and NLSR are running,
interestfirst checks local data, and if not found, fetches it over the NDN network transparently.
Requirements
- Python 3.10+
- python-ndn
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.
Remote function calls execute on the remote function endpoint first. If that
request fails, ndnc falls back to locally executing a cached (or newly fetched)
/function-name/code source.
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 or a standalone put_image(...), 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 cached function execution and 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. Source-cache entries from before the migration may remain until their
TTL expires (300 seconds).
Returning an image
put_image("sample.png")
Returns the image and stops execution. Relative paths use the script directory. The image must already exist on the producer.
Save a result with ndnc run --output received.png script.ndn.
Consumer scripts should use return interest "/print_image" to return the image.
Metadata
Release files for ndnc 0.0.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ndnc-0.0.18.tar.gz | 20.2 kB | Without provenance | Details for ndnc-0.0.18.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ndnc-0.0.18-py3-none-any.whl | Python 3 | none | any | Details for ndnc-0.0.18-py3-none-any.whl |
Total release size: 41.9 kB
Release files / ndnc-0.0.18.tar.gz
| Download URL | ndnc-0.0.18.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d5990b1eb8a51991469c2cacb90f62aa3c7051f6db75eee108bf1fa384d71e3
|
|
BLAKE2b-256 checksum How to use checksums |
657ae17d41913231cbea79d8feb24231d695b33ced2fefcbba6e2de9f636d637
|
| 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.18-py3-none-any.whl
| Download URL | ndnc-0.0.18-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6339f60f4fa3920a797103e83d0dda702ef5a92dfeb6d7e641c77ea5acb432c
|
|
BLAKE2b-256 checksum How to use checksums |
4f0c6c004d136603c62fa00004f1d056a070a3b0b2ba188588adf73eb47340ac
|
| 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.18
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.