Skip to main content

PyPI Status Python Version License

Tests Codecov

pre-commit Black

Features

adorn is a configuration tool for python code.

adorn can currently

  • instantiate an object

  • check that a config can instantiate an object

Example

from adorn.orchestrator.base import Base
from adorn.params import Params
from adorn.unit.complex import Complex
from adorn.unit.constructor_value import ConstructorValue
from adorn.unit.parameter_value import ParameterValue
from adorn.unit.python import Python


@Complex.root()
class Example(Complex):
   pass

@Example.register(None)
class Parent(Example):
    def __init__(self, parent_value: str) -> None:
        super().__init__()
        self.parent_value = parent_value


@Parent.register("child")
class Child(Parent):
    def __init__(self, child_value: int, **kwargs) -> None:
        super().__init__(**kwargs)
        self.child_value = child_value


base = Base(
    [
        ConstructorValue(),
        ParameterValue(),
        Example(),
        Python()
    ]
)

params = Params(
        {
            "type": "child",
            "child_value": 0,
            "parent_value": "abc"
        }
)

# well specified configuration
# we can type check from any level in the
# class hierarchy
assert base.type_check(Example, params) is None
assert base.type_check(Parent, params) is None
assert base.type_check(Child, params) is None

# instantiate
# we can instantiate from any level in the
# class hierarchy
example_obj = base.from_obj(
    Example,
    params
)

assert isinstance(example_obj, Child)


parent_obj = base.from_obj(
    Parent,
    params
)

assert isinstance(parent_obj, Child)


child_obj = base.from_obj(
    Child,
    params
)

assert isinstance(child_obj, Child)

Installation

You can install Adorn via pip from PyPI:

$ pip install adorn

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the Apache 2.0 license, Adorn is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This project was generated from @cjolowicz’s Hypermodern Python Cookiecutter template.

Release files for adorn 0.1.7

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

Source distribution (sdist)

Source distribution for adorn 0.1.7
File Size Uploaded
adorn-0.1.7.tar.gz 43.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for adorn 0.1.7
File Interpreter ABI Platform
adorn-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 106.8 kB

Release files / adorn-0.1.7.tar.gz

Download URL adorn-0.1.7.tar.gz
Size 43.4 kB
Tags Source
SHA-256 checksum
How to use checksums
853064087377c5b997755eb8cb01336dd97a11b246ecf3d615aaa439d0cfe526
BLAKE2b-256 checksum
How to use checksums
937df587e8ffc7e6f704440ea0b42b38df8da7e0b3dfc1c27c8ae41f3fd3b955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.9

Release files / adorn-0.1.7-py3-none-any.whl

Download URL adorn-0.1.7-py3-none-any.whl
Size 63.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c419c5c439cd139f5d82fea0d915b9367993c7483b38ce2ea744fb29f837116
BLAKE2b-256 checksum
How to use checksums
0353271cb6ac4f66f21abb6bb403c15a946b0018e3db7f933de83516060d0ea2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

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