neu_mark.config

Site defaults for building DVID URLs, from an uncommitted TOML file.

It builds URLs; it is never a silent fallback. cfg.url("synapses") returns a complete dvid://server/uuid/instance string, and the CLI consults the config only for a value written as @name, printing what it resolved to. Provenance records store the resolved URL, so an export stays traceable without the config.

Search order, first hit wins:

  1. $NEU_MARK_CONFIG (an error if it names no file);

  2. neu-mark.toml, then configs/neu-mark.toml, in the current directory or any parent, so one file at the workspace root serves notebooks in subdirectories.

There is no machine-wide location, so two people running the same command in the same tree get the same config.

# neu-mark.toml, at the workspace root
[dvid]
server = "dvid.example.org"
uuid    = "93fdbc:main"      # a branch ref is fine; it is resolved per run
locked  = true               # prefer the newest locked node

[instances]
synapses = "synapses"
bodies   = "labels_annotations"
labels   = "labels"
counts   = "synapses_labelsz"
todo     = "labels_todo"

# Named ROI lists, for `--rois @neuropils`. They must not overlap; see
# `dvid.label_point_rois`.
[roi_sets]
neuropils = ["ME(L)", "ME(R)", "LO(L)", "LO(R)", "AL(L)", "LH(L)", "LH(R)"]

# Named rules modules, for `--rules @wasp`. Paths are relative to this file.
[rule_sets]
wasp = "rules/wasp_rules.py"

Attributes

Classes

Config

Resolved site defaults. Immutable; build URLs from it.

Functions

find([start]) → str | None

The config file that would be used, or None.

load([path]) → Config

Load the config, or an empty one if there is none. Asking an empty config for a URL

Module Contents

class neu_mark.config.Config(data: Mapping[str, Any], path: str | None = None)

Resolved site defaults. Immutable; build URLs from it.

resolve(value: str) → str

Turn @name into a URL; leave anything else untouched.

roi_set(name: str) → list[str]

A named ROI list from [roi_sets].

rule_set(name: str) → str

The path of a named rules module from [rule_sets], resolved relative to the config file rather than the working directory.

url(name: str, *, uuid: str | None = None) → str

A complete dvid:// URL for a configured instance name.

name is a key under [instances] or a literal DVID instance name.

instances
locked
path = None
roi_sets
rule_sets
scheme
server
uuid
neu_mark.config.find(start: str | pathlib.Path | None = None) → str | None

The config file that would be used, or None.

Walks up from start (the cwd by default) looking for FILENAME, or for it inside SUBDIR, at each level.

neu_mark.config.load(path: str | None = None) → Config

Load the config, or an empty one if there is none. Asking an empty config for a URL raises, naming where it looked.

neu_mark.config.ENV_VAR = 'NEU_MARK_CONFIG'
neu_mark.config.FILENAME = 'neu-mark.toml'
neu_mark.config.REFERENCE_PREFIX = '@'
neu_mark.config.SUBDIR = 'configs'