Skip to content

Releases: InvestmentSystems/class-only-design

Version 0.3.0

10 Apr 17:44
Compare
Choose a tag to compare
Version 0.3.0 Pre-release
Pre-release

This is an api breaking release. It changes the api to use inheritance rather than decorators. This provides more clarity as to what is actually happening.

Instead of:

from class_only_design import class_only

@class_only
class MyClass:
    ...

You now do:

from class_only_design import ClassOnly

class MyClass(ClassOnly):
    ...

This release also adds autoname to the namespace class:

>>> from class_only_design import Namespace
>>> from class_only_design import autoname
>>> class NS(Namespace):
>>>     symbolic_handle = autoname

>>> NS.symbolic_handle
    'symbolic_handle'

Version 0.2.0

15 Aug 05:14
0403743
Compare
Choose a tag to compare
Version 0.2.0 Pre-release
Pre-release

This adds the namespace decorator, intended for use on class_only classes that just define constant attributes.

For example, given the following class:

from class_only_design import namespace

@namespace
class ColourConstants:
    RED = 'FF0000'
    GREEN = '00FF00'
    BLUE = '0000FF'

The namespace decorator provides the mutability and instanciation protections of class_only, but also:

  • makes the class iterable, e.g.:

    list(ColourConstants) # returns ['FF0000', '00FF00', '0000FF']
  • adds a special attribute, nameof which returns the name of the class attribute:

    ColourConstants.nameof.RED # returns 'RED'

It also improves the underlying implementation of the class decorators. They no longer modify the class hierarchy.

Add inheritance handling

23 Jul 19:12
505ef66
Compare
Choose a tag to compare
Pre-release

Class only classes can be inherited, and classes that inherit from class only classes are not instantiable.

Alpha

15 Jul 08:46
a9bb0df
Compare
Choose a tag to compare
Alpha Pre-release
Pre-release

Now with correct info and tags!

Alpha

15 Jul 08:13
eef9270
Compare
Choose a tag to compare
Alpha Pre-release
Pre-release
v0.1.0

Update readme