Skip to main content

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']

Development

Initialize for local development

poetry install --with dev

Run the tests

poetry run pytest

Project details


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.34.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

np_config-0.4.34-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file np_config-0.4.34.tar.gz.

File metadata

  • Download URL: np_config-0.4.34.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.12.2 CPython/3.11.5

File hashes

Hashes for np_config-0.4.34.tar.gz
Algorithm Hash digest
SHA256 42fb099dac52958868b1292e6b9bc22120acc238ebe2478dfb4c996d7ac8c547
MD5 b1274371abcc07ad8f2e6612f400cd12
BLAKE2b-256 a5e42fa13dc32a827a0141d53ee323bc81b52505f9b76d0d1960bc73168a3d4f

See more details on using hashes here.

File details

Details for the file np_config-0.4.34-py3-none-any.whl.

File metadata

  • Download URL: np_config-0.4.34-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.12.2 CPython/3.11.5

File hashes

Hashes for np_config-0.4.34-py3-none-any.whl
Algorithm Hash digest
SHA256 4c31a855c9444f2c4381e239c240f46e15a6cc65e1088bd7ffb5e03a210f6d95
MD5 f54913540657b16b990d86384a0566b7
BLAKE2b-256 b54451e37b6dfec974c8625e378131472486c21a1667a638c8fef8f6b6140dca

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page