Skip to main content

Pop Config

Pop-config is the official tool to allow for creating and app-merging configuration options for pop projects. Plugin Oriented Programming presents a means to merge multiple applications together dynamically. This capabilities requires that the startup of these applications needs to be managed from within the programming paradigm. Since this is the case pop-config becomes a critical and hard requirement of pop.

Pop-config is not just about being able to work with pop projects to facilitate app-merging, it has also been designed to make the startup of an application much simpler, and to make the expensive boiler plate of startup and configuration as transparent as possible. When making pop projects the idea is that projects are developed in very small chunks and are then dynamically merged together. So the creation of these mergeable apps needs to be quick and easy!

Pop-config also solves a problem with configuration of applications, when making a new application, if you want robust configuration loading, you need to be able to take options from the command line, environment variables, and configuration files. Pop-config does all of this for you, and loads them in the correct order, all behind the scenes, making your life easier.

Understanding the conf.py

Pop relies on a configuration file to manage how to merge apps, and also how to manage and merge configuration data. The data in this file is presented in 4 Python dictionaries and defines every aspect of configuration loading.

The 4 dictionaries are called CONFIG, CLI_CONFIG, SUBCOMMANDS and DYNE. Each dictionary serves a specific purpose. Between them you can define how the cli arguments are presented, all configuration defaults, documentation, etc.

The CONFIG Dictionary

The bulk of the configuration will be present in the CONFIG dictionary. all of your configuration options are defined here. Most entries in the CONFIG dictionary will be very simple and just expose the most basic values:

CONFIG = {
    "name": {
        "default": "frank",
        "help": "Enter the name to use",
    },
}

This simple example presents the documentation for the configuration value and what the default value should be.

Many more options can be used, but they will be covered in the reference document.

The CLI_CONFIG Dictionary

Adding a configuration value does not make it appear on the command line. Each application can be extended to include command line options. Lets extend our earlier example to expose the “name” option as a command line argument:

CLI_CONFIG = {
    "name": {},
}
CONFIG = {
    "name": {
        "default": "frank",
        "help": "Enter the name to use",
    },
}

That’s it! The “name” option is now available on the command line and can be used as –name bob.

But what if we want it to be a positional argument? Simple! Just add the positional option to the CLI_CONFIG:

CLI_CONFIG = {
    "name": {
        "positional": True,
    },
}
CONFIG = {
    "name": {
        "default": "frank",
        "help": "Enter the name to use",
    },
}

Many more options exist that allow you to control every aspect of the user’s command line experience.

The SUBCOMMANDS Dictionary

Sometimes it is desirable to have subcommands. Subcommands allow your CLI to work in a way similar to the git cli, where you have multiple routines that all can be called from a single command.

Lets add a few more things to our example so that we can have subcommands.

CLI_CONFIG = {
    "name": {
        "subcommands": ["test", "apply"],
    },
    "weight": {},
    "power": {
        "subcommands": ["apply"],
    },
}
CONFIG = {
    "name": {
        "default": "frank",
        "help": "Enter the name to use",
    },
    "weight": {
        "default": "150",
        "help": "Enter how heavy it should be",
    },
    "power": {
        "default": "100",
        "help": "Enter how powerful it should be",
    },
}

SUBCOMMANDS = {
    "test": {
        "help": "Used to test",
        "desc": "When running in test mode, things will be tested",
    },
    "apply": {
        "help": "Used to apply",
        "desc": "When running in apply mode, things will be applied",
    },
}

In this example we see that the option name will be available under the subcommands test and apply. The option power will be available only under the subcommand apply and the option weight is globally available.

The DYNE Dictionary

The DYNE dictionary allows you to control what dynamic names your app is presenting to other pop projects. This name gets used not only inside of pop-config but also inside of pop to determine what plugin subsystems this application merges with. The DYNE system allows for your cli to be extended by third party code, enabling configuration options to be made available to your application via external code.

The DYNE system is very powerful. But since it is not critical to getting started with pop-config it will be covered in more depth in another document.

Metadata

Release files for pop-config 4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pop-config 4
File Size Uploaded
pop-config-4.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pop-config 4
File Interpreter ABI Platform
pop_config-4-py3-none-any.whl Python 3 none any Details

Total release size: 30.1 kB

Release files / pop-config-4.tar.gz

Download URL pop-config-4.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
776664ca14d6a6df9194754135f0dd8b1eb8dae5042f625ca92eb8efa4ebc22c
BLAKE2b-256 checksum
How to use checksums
25da3e0ac0df651ec57231c0555288772639dd85dc88f5bac27449bec258b84a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release files / pop_config-4-py3-none-any.whl

Download URL pop_config-4-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3c2279d67fda9cfd9a0e3ad76dc251a383bebdd8f77da0d6414eedfeff437fc
BLAKE2b-256 checksum
How to use checksums
87c9789edc01927c071ab34c592ba270736dd59042757447c3a3020b44a46478
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

Release history Release notifications | RSS feed

12.0.4

2 release files

12.0.3

2 release files

12.0.2

2 release files

12.0.1

2 release files

12.0.0

2 release files

11.0.1

2 release files

11.0.0

2 release files

10.2.4

2 release files

10.2.3

2 release files

10.2.1

2 release files

9.0.0

2 release files

8.0.2

2 release files

8.0.1

2 release files

8.0.0

2 release files

7.0.3

2 release files

7.0.2

2 release files

7.0.1

2 release files

6.11.1

2 release files

6.11

2 release files

6.10

2 release files

6.9

2 release files

6.8

2 release files

6.7

2 release files

6.6

2 release files

6.5

2 release files

6.4

2 release files

6.3

2 release files

6.2

2 release files

6.1

2 release files

6

2 release files

5.6

2 release files

5.5

2 release files

5.4

2 release files

5.3

2 release files

5.2

2 release files

5.1

2 release files

5

2 release files

This release

4 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page