Skip to main content

Library to read and write configs using API and CLI with Typer

Reason this release was yanked:

This is the same as 1.11.

Project description

The configuration is a JSON structure. We'll use the following for the coming examples.

{
  "courses": {
    "datintro22": {
      "timesheet": {
        "url": "https://sheets.google..."
      },
      "schedule": {
        "url": "https://timeedit.net/..."
      }
    }
  }
}

The format is actually irrelevant to anyone outside of this library, since it will never be accessed directly anyway. But it will be used to illustrate the examples.

We can access values by dot-separated addresses. For instance, we can use courses.datintro22.schedule.url to access the TimeEdit URL of the datintro22 course.

Let's have a look at some usage examples. Say we have the program nytid that wants to use this config module and subcommand.

import typer
import typerconf as config

cli = typer.Typer()
# add some other subcommands
config.add_config_cmd(cli)

We want the CLI command to have the following form when used with nytid.

  nytid config courses.datintro22.schedule.url --set https://timeedit.net/...

will set the configuration value at the path, whereas

  nytid config courses.datintro22.schedule.url

will return it.

Internally, nytid's different parts can access the config through the following API.

import typerconf as config

url = config.get("courses.datintro22.schedule.url")

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

typerconf-1.12.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

typerconf-1.12-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file typerconf-1.12.tar.gz.

File metadata

  • Download URL: typerconf-1.12.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/5.19.0-45-generic

File hashes

Hashes for typerconf-1.12.tar.gz
Algorithm Hash digest
SHA256 6c2ccf1fc2d6ced8c09a7b2a1f718de16405af7773f71119c5b2315b356b2370
MD5 0419d543746cd1e8f9753c546a265484
BLAKE2b-256 54744a37065343c9fb507e0b6ae1bbfc4bdc41f93d3c6467a604f5f194534dc2

See more details on using hashes here.

File details

Details for the file typerconf-1.12-py3-none-any.whl.

File metadata

  • Download URL: typerconf-1.12-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/5.19.0-45-generic

File hashes

Hashes for typerconf-1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 68e404620848e1aab0b9a15323fc80b68da8dd1fc0e24e5830ca426da060f2db
MD5 473c777b49a5dcac25d55a7a571e0c2b
BLAKE2b-256 d319b89a6d5c1f39b10dc79281e614e7154f8fcdebd07ce57c6a657b3e50a984

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