Config fetching from file or Zookeeper - with local backup - repackaging code from AIBS mpeconfig.
Project description
np_config
For use on internal Allen Institute network
Usage
Fetch configs from ZooKeeper nodes or .yaml/.json files:
import np_config
zk_config: dict[str, str | int] = np_config.from_zk('/rigs/NP.1')
file_config: dict[str, Any] = np_config.from_file('local_config.yaml')
If running on a machine attached to a Mindscope Neuropixels rig (NP.0
, ..., NP.3
), get rig-specific config info with:
rig = np_config.Rig()
name: str = rig.id # "NP.1"
index: int = rig.idx # 1
acquisition_pc_hostname: str = rig.acq # "W10DT713843"
config: dict[str, str | int] = rig.config # specific to NP.1
paths: dict[str, pathlib.Path] = rig.paths # using values from rig.config
If not running on a rig-attached machine, get the config for a particular rig by supplying rig-index as an int
to Rig
:
np1 = np_config.Rig(1)
np1_mvr_data_root: pathlib.Path = np.paths['MVR']
- the Mindscope ZooKeeper server is at
eng-mindscope:2181
- configs can be added via ZooNavigator webview: http://eng-mindscope:8081
- or more conveniently, via an extension for VSCode such as gaoliang.visual-zookeeper
Development
Initialize for local development
poetry install --with dev
Run the tests
poetry run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
np_config-0.4.29.tar.gz
(12.9 kB
view hashes)
Built Distribution
np_config-0.4.29-py3-none-any.whl
(12.0 kB
view hashes)
Close
Hashes for np_config-0.4.29-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a8dc2b87807341c8cdd40c37057e962607b9d4b863e27f347d06f8d5222a739 |
|
MD5 | 7cf1da1f1e7468e396108315978bf42d |
|
BLAKE2b-256 | 7f409cf14f2db67f1c4285d22c7a88348a8c926a8335d50c0efa0b1ca5160fa4 |