Skip to main content

Name

DEWI: Old Welsh form of David

The name is chosen because of the similarity to DWA, which was the project’s original name, which stands for Developer’s Work Area.

Purpose

This code is the core part of DEWI.

The plugins ensure load codes dynamically, without loading everything. An application implementation is also added in MainApplication class.

Installation

It can be installed from source:

python3 setup.py

Or from pip:

pip install dewi_core

Usage as a plugin framework

A minimal example can be found in the samples/as_framework directory, the application is named as Steven.

Assuming that it’s already created, it can be the aforementioned way:

dewi -p example.my.custom.Plugin mycustom-command
dewi -p steven.StevenPlugin xssh ....

The exact plugin can be hidden if there is a main entry point or script:

#!/usr/bin/env python3
import sys

from dewi_core.application import Application


def main():
    app = Application('steven')
    app.add_plugin('steven.StevenPlugin')
    app.run(sys.argv[1:])


if __name__ == '__main__':
    main()

Usage as a regular Python library

Some parts of DEWI can be used as regular Python library, without the Plugin boilerplate. A simple example is creating a somewhat typesafe (config) tree with the help of the now extracted dewi_dataclass:

from dewi_core.config.config import Config
from dewi_dataclass import DataClass


class Hardware(DataClass):
    def __init__(self):
        self.hw_type: str = ''
        self.mem_size: int = None
        self.mem_free: int = None
        self.mem_mapped: int = None


class MainNode(DataClass):
    def __init__(self):
        # Handling as str, but None is used as unset
        self.version: str = None
        self.hw = Hardware()
        # ... further fields

    def __repr__(self) -> str:
        return str(self.__dict__)


class SampleConfig(Config):
    def __init__(self):
        super().__init__()
        self.set('root', MainNode())

    def get_main_node(self) -> MainNode:
        return self.get('root')


# ....
sc = SampleConfig()
sc.get_main_node().hw.mem_size = 1024  # OK
sc.set('root.hw.mem_size', 1024)       # OK
sc.set('root.hw.memsize', 1024)        # NOT OK, typo

# but...
c = Config()
c.set('root.hw.mem_size', 1024)  # OK
c.set('root.hw.memsize', 1024)   # OK, but typo

As you can see, DEWI can be used as library, and it can contain slightly different solutions of the same problem.

Release files for dewi-core 6.1.0

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

Source distribution (sdist)

Source distribution for dewi-core 6.1.0
File Size Uploaded
dewi_core-6.1.0.tar.gz 38.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dewi-core 6.1.0
File Interpreter ABI Platform
dewi_core-6.1.0-py3-none-any.whl Python 3 none any Details

Total release size:87.0 kB

Release files / dewi_core-6.1.0.tar.gz

Download URL dewi_core-6.1.0.tar.gz
Size 38.4 kB
Tags Source
SHA-256 checksum
How to use checksums
00a9749f5372a1f6f861b7cd29d6bac8af1186e76eb70b6fce11b4da13327dc1
BLAKE2b-256 checksum
How to use checksums
4c9fd642186d851608e533a57392b943d9e7789e60da3e4f94d79fdc7aafd4e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / dewi_core-6.1.0-py3-none-any.whl

Download URL dewi_core-6.1.0-py3-none-any.whl
Size 48.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
091ff09a02e15b36a0ef4e81a1dae4d830bfef43c05e090077d7a95dfa65273f
BLAKE2b-256 checksum
How to use checksums
0f0687b28c9bd55ca4e3d886ce1a0dc6c94dfa1289dd4791efcff3b8d5e57bb6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release history Release notifications | RSS feed

6.1.1

2 release files

This release

6.1.0 This release

2 release files

5.4.0

2 release files

5.3.0

1 release file

5.2.0

1 release file

5.1.1

1 release file

5.1.0

1 release file

5.0.1

1 release file

5.0.0

1 release file

4.0.0

1 release file

3.3.0

1 release file

3.2.0

1 release file

3.1.0

1 release file

3.0.0

1 release file

2.0.1

1 release file

2.0

1 release file

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