Get started
Add a package
Edge Python ships no standard library. Nothing resolves until edge.json declares it. This page adds the json package to print the counts of words as JSON.
Declare it
From the words folder, add the package.
edge add json$ edge add json
+ json 0.1.0
updated edge.json, run edge lock to resolve itedge add looks the name up in the registry and writes its newest version into edge.json.
{
"edge": "0.9.4",
"imports": {
"json": "0.1.0"
}
}Lock it
Resolve the declared version.
edge lock$ edge lock
+ json https://cdn.edgepython.com/pkg/json/0.1.0/app.edge
wrote edge.lockedge lock writes edge.lock beside the manifest. It records the URL and the digest of each declared version. edge run, edge test and edge build read the lock and never ask the registry themselves.
Run edge lock again after every change to edge.json, and commit edge.lock with the code. A version the lock does not hold stops the run with 'json' is not locked, run edge lock.
Import it
A bare name such as json resolves through edge.json. Here is the package on its own.
{"name": "edge", "tags": ["fast", "small", "sandboxed"]}Now use it in main.py. The two functions stay the same. The script imports json at the top and prints the ranking as one JSON object.
{"the": 3, "cat": 2, "mat": 1}Run it again.
edge run main.py- edge.json describes the manifest format.
- edge.lock describes the file
edge lockwrites. - edge add covers versions, custom URLs and
edge remove.