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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pluggable_namespace-0.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

pluggable_namespace-0.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

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

pluggable_namespace-0.0.0-cp314-cp314-musllinux_1_2_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

pluggable_namespace-0.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

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

pluggable_namespace-0.0.0-cp313-cp313-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

pluggable_namespace-0.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

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

pluggable_namespace-0.0.0-cp312-cp312-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

pluggable_namespace-0.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

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

pluggable_namespace-0.0.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

pluggable_namespace-0.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.7 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-0.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f0c61d98f21cd5c5553cedfe03dd4f2d5730ddbd7c89224cdc13e3dced8abab5
MD5 3a8ea4662c2d3fab33bd3b7630790eb1
BLAKE2b-256 4ef7f5ec3aa161cd433a36e90cae1942cf849ede1f7d4f54bd43d754a3c7870f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c7b5454f69c75ad65a0aab03a34ff4c9ff52100a0ed0306482720b75e90ed460
MD5 f3778d8823f1b2f7b5e10a0936dde0f8
BLAKE2b-256 b210eb69550d43b6ab4ab6e4ec8fc8b6b2f77bbb64035ee9cb5b39e590aa3468

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a5e6460d19d66744ce04046dddaf1c691080c2637d3baa53571a3477c449bde0
MD5 9f32af1035beaa14030937120fad523f
BLAKE2b-256 cd9b573b108348a3b6165425894ebf56df3cb0477b1cb350ac295362f13b3008

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 79e042a3e3efa993e8841959da0dd14ca2998c1d575c7fa332d36a118f7cb30f
MD5 af8705a524f59b8811d0dfefe5a7b9f0
BLAKE2b-256 5a50254b05a063ce146350e1d7f9ebd859a6d5f9b325637e47ca75cb178e5a89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 37c0986e24645c1938e5ccab77b72117d908446a05762d975b8eef95eb964a4e
MD5 000956b777ebc5f5d67397d739ae56c5
BLAKE2b-256 5ae859daf37f149291cbf895daa6d2d0ad3ebfa2fe5135e7da293cf1826f6872

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 077cf78bc3636654cebcfb70db94963a8b19180234cf6b76c2c9c8c488974bc0
MD5 1ae181b0a2a07d0d5110d2051806eea0
BLAKE2b-256 d94edaf25aaf0e197e054ef23c6816a2a48eebf1e1cc295e2b066904471c2b65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 58b2d83559ff5e53660426d602eda9789a11cb29e27bd71975fa94a892cbddd5
MD5 95efb5f747ef070cb33aee148de44551
BLAKE2b-256 108bac1a44d1374c0ef54d9f369d3c290a2342aee288336fb3565b5b6772edce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 988670d0d813d080969facdcc6265c3c2fb0883e2c22eb9d372f82fb097a9187
MD5 6fe80eaf17f0e0421ed5fc2fd9d6262f
BLAKE2b-256 b028be6ab0bb447e81194258b4bdcf9fe233d6fc108447da017db6a7003d1be7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 682e962a698e255d17d28ef42113e5c429c73780b6860009f9eda1c79ae6b7a4
MD5 9cea905cac26533b39cead437d74ad45
BLAKE2b-256 b3abaab14fa15867a83169fc08a9473a5e1b76229021ffbf06e2f8696830c12a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pluggable_namespace-0.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5c6a4ebe288bb6ef260e6d564a853beec61e1702957635d7bec70d7dadff7b9e
MD5 3c6ebb1f9003d541ef5aca01fc7901b8
BLAKE2b-256 63fed6ca7fad55f8ccd2983a10281c8c7cb72ff342420515e3f7182b17a49f40

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