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.33.tar.gz
(12.7 kB
view details)
Built Distribution
File details
Details for the file np_config-0.4.33.tar.gz
.
File metadata
- Download URL: np_config-0.4.33.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.12.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 524cc5fae089db28433d883ed23089a0e89b2b808370891e1293cb583e2dbbbb |
|
MD5 | 0ea0c0da9e330923e9d969077dc229c1 |
|
BLAKE2b-256 | a78e2b09de415488f7cc8756c30824df774b5bc2f23088fdb45ac909f7d25be5 |
Provenance
File details
Details for the file np_config-0.4.33-py3-none-any.whl
.
File metadata
- Download URL: np_config-0.4.33-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.12.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e71a35c4e6423b75153790078338d8e3f1812641079842a38eaa1cf84882cf30 |
|
MD5 | 5ac07ac454684b7e3a218f35bcb621af |
|
BLAKE2b-256 | 77467c76b7b857f135467f9cbd2c7b981af3c35dad903cbc62587c68dda32a4e |