Skip to main content

Pluggable namespaces

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

This project is designed to facilitate the creation and management of pluggable software architectures using namespaces. The concept of pluggable namespaces enables the development of software that is modular and easy to extend.

Pluggable namespaces provide a framework for constructing applications composed entirely of interchangeable modules. This approach allows developers to scale their projects smoothly and integrate complex software components seamlessly.

Using pluggable namespaces, developers can build software in smaller, maintainable components. These components can then be combined and deployed as a single entity, simplifying the deployment process.

All of this is achieved using Python, one of the world’s most popular and powerful programming languages.

Installation

You can install pluggable-namespace from PyPI:

pip3 install pluggable-namespace

Creating a pluggable application can be accomplished with just a few lines of code. The heart of every pluggable-namespace project is the creation of a hub, adding dynamic subsystems, and interacting with them through the hub’s namespace.

import pns.shim
import asyncio


async def main():
    hub = await pns.shim.loaded_hub()
    await hub.my_sub.init.cli()

if __name__ == "__main__":
    asyncio.run(main())

Configuration

When building a pluggable-namespace app, all configuration settings are stored in a config.yaml file.

# Each configuration option for your module
config:
  my_namespace:
    my_opt:
      default: True

# Options exposed on the CLI when your app controls the CLI
cli_config:
  my_namespace:
    my_opt:
      help: Description of this option
      subcommands:
        - my_subcommand
      group: My arg group

# Subcommands to expose for your project
subcommands:
  my_namespace:
    my_subcommand:
      help: My subcommand

# Dynamic namespaces that your app merges onto and which folders extend those namespaces
dyne:
  my_dyne:
    - src_dir

# Python imports that your app uses, to be added to hub.lib for your app
import:
  - asyncio
  - importlib
  - importlib.resources
  - os
  - toml

From the example above, all arguments are loaded onto the namespace under hub.OPT.my_namespace. One config.yaml can add configuration options to multiple namespaces. They are merged in the order found in sys.path.

Extending Namespaces

locally

Extending pluggable-namespace is straightforward with dynamic namespaces. Extend any dynamic namespace on the hub by adding a directory containing a “config.yaml” to PYTHONPATH.

export PYTHONPATH=$PYTHONPATH:/path/to/project_root

Add a config.yaml to that directory:

# project_root/config.yaml
dyne:
  namespace:
    # This references the directory project_root/foo
    - foo

Now, every Python file in project_root/foo will be added to the hub under hub.namespace.

With PyPI

You can use the seed command to create all the boiler-plate code you need for a pluggable-namespace project.

hub seed.init.cli /path/to/project_root name=my_project

Now you can add all your code to /path/to/project_root/src/my_project

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

pluggable_namespace-2.2.1.tar.gz (2.4 MB view details)

Uploaded Source

Built Distributions

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

pluggable_namespace-2.2.1-cp314-cp314t-musllinux_1_2_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

pluggable_namespace-2.2.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.7 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pluggable_namespace-2.2.1-cp314-cp314-musllinux_1_2_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

pluggable_namespace-2.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pluggable_namespace-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

pluggable_namespace-2.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pluggable_namespace-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pluggable_namespace-2.2.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pluggable_namespace-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

pluggable_namespace-2.2.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file pluggable_namespace-2.2.1.tar.gz.

File metadata

  • Download URL: pluggable_namespace-2.2.1.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for pluggable_namespace-2.2.1.tar.gz
Algorithm Hash digest
SHA256 dbc0e5fb62c850fec62d98da203e734d23d605367e99a984c9d9eef21c222dda
MD5 f34bce9b157e3f6cb18acf184acf8102
BLAKE2b-256 5eeebc4660b9587edcb78f3228818b9c34b5be683d91f7c62ad9afdfac0a37ae

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 21059a6534022f07d639a7d71a66ed4e901dda33c61597c047d8887e95075b74
MD5 1a45d99b827941680103326e3f73af90
BLAKE2b-256 5748b3f0f1becb61b83b6dfe4d20ae59fc75a935c041514e424a58d075d5cd00

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5964ba32ed32c9231912b48ca4af5e04c00944b56d941fc4b042389ae17aa446
MD5 b41df973595200681c32548c8c3e072c
BLAKE2b-256 ab8fbf7fc62bc26fa1f0b8d7f693547921b661ae3f7c861baadc2b160c168045

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 535e8f8cafb6492f59f69660df39dae69ade84e53f55c7d0935442dd2828eb0b
MD5 43e717f0f5501d8f41bdf24640c5bc61
BLAKE2b-256 f94aedc8af69a13067b3ec2f2b2cfbc1cf0f58888d3b16ca79fb2e7f9e3297ed

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 41993875b96a59b2edfb4155fede2a37ed3275fce7256ef9ee12aaac93085e3f
MD5 78b31e5bca71cadae4a753c8bea991c8
BLAKE2b-256 01e91fadc08be62cedb62e26a7ed0597e5eba35e366402814688ce171fb8a9ae

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 23e18b7c92fa2b291a85c3139b78329af5bbae8eeeb2380c90f1b88d28bd1917
MD5 e252a76e02269cf571a1a9dbc99272d1
BLAKE2b-256 d2093e3e0eb893b199210026a19191d33b6c0558716e8541fd8315d142f0d162

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b35592e522804867f1eff5e5860e02dfeaccb514662f25d4362922bc04125c6c
MD5 a1d2208df77c8e5a5ad168dba0247641
BLAKE2b-256 8454b13baad6ef1f23607071916c8f4130978358e754a376226823e359e3f6c8

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e4b214f3192137214275d6169639e18d4ec3e2304bb5fa70fa5ee72f04e03cf4
MD5 763543cfb22bf5fe26dc1f182f6f8101
BLAKE2b-256 08b9c26f73deddafc8838f049c3802277ba8e4512e2d38bd4c61c4be7ed090e5

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 85a15d54f95785771317b159bd0e1f2a0f4616f32726f01036a92650aaec5bca
MD5 6cbea997ae7fc6acca1d4b520235ec01
BLAKE2b-256 c731024bfae884707fa7f0f2247d01e575b937eff9bea6ceee17ac84c663978c

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 31db97df0ab838232df7a04881ac3b493e9cc71ef3366052ee991cc111a72b5e
MD5 b33979f1f0f8c8d42596375a6e2fafa6
BLAKE2b-256 15dd40a5cf978a3984512002cec3a6c0d11db6a3cd2e6e9cdf7dd09f8b8e755f

See more details on using hashes here.

File details

Details for the file pluggable_namespace-2.2.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-2.2.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b8e2c1aad6c0a71f0a94f521eb3237739cdfc19fe099cfeb17fd51a167f8a4b3
MD5 dde3f5337a66fcf2b74f6e1d2da62ea4
BLAKE2b-256 d4c984d6c5818db3cbbdd0ee7785d563964eea3f2d070c49c43e0209687df6ea

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