Skip to main content

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

Reason this release was yanked:

Same as 1.13

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

Uploaded Source

Built Distribution

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

typerconf-2.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typerconf-2.0.tar.gz
  • Upload date:
  • Size: 12.7 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-2.0.tar.gz
Algorithm Hash digest
SHA256 5c3d8b3b7ffa9cf1856a69feae27387dadc093bfe6a91ad3cfdae3c009c8a9bf
MD5 b98d205bd9257bb584ce711c2cd8d54a
BLAKE2b-256 6af7ac91c1248cff935e6acd6ef9037acee5b50cc3bccdce35531e18db19deed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typerconf-2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 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-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 007c981245ced15ea5f3869a29d48421a161f2d2b2f475310e20a3f2d5622d81
MD5 68cb8c8c99454515d6f82d9a28c758be
BLAKE2b-256 a11d99f55e74c8a6695f9a42500ee0a95c1478325379f26c37edf3208a59b03b

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