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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

np_config-0.4.37-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: np_config-0.4.37.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.22.4 CPython/3.11.5 Windows/10

File hashes

Hashes for np_config-0.4.37.tar.gz
Algorithm Hash digest
SHA256 300b322094d4e5824c31e4851f802869c324c3b4f960136bb719f1137be48b5e
MD5 6eb7f41e9bf4fa4bbd2992297331446f
BLAKE2b-256 560306e2830a54f4df23860dd0d7ed915f58d38aa5c89a2c3552df0551d90951

See more details on using hashes here.

File details

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

File metadata

  • Download URL: np_config-0.4.37-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.22.4 CPython/3.11.5 Windows/10

File hashes

Hashes for np_config-0.4.37-py3-none-any.whl
Algorithm Hash digest
SHA256 5106f385a538079602c5a5fde176f20ac1f185f81b5c3545e6baa0b98b946d46
MD5 8f594bd99cc8e49d47f6f51fe848ede2
BLAKE2b-256 37619528a7fa83a7e8b3e5673498468db0249178c0b9e228c23bfb70c7e90910

See more details on using hashes here.

Supported by

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