Spec-classes

Latest version: v1.5.7

Safety actively analyzes 723144 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 5 of 6

1.1.4

Not secure
This release fixes a bug whereby the do-not-copy flag on attributes were not properly respected in the constructor.

1.1.3

Not secure
This a minor release that improves support for deep-copying attribute values that contain `module` types.

1.1.2

Not secure
This is a minor release that:

- avoids mutating items within a container inplace even after deepcopying the entire container, since that can affect indexing.
- consolidates deepcopying logic of attribute values, and adds support for values that are instances of `ModuleType`.

1.1.1

Not secure
This is a minor bugix release that fixes pickling of `KeyedSet` and `KeyedList`.

1.1.0

Not secure
This is a major release with several new features, and many bugfixes, largely motivated by the porting process of existing code from 0.3.4 core to 1.0.x.

**New features and enhancements:**
- Add top-level `.update()`, `.transform()` and `.reset()` mutation methods to spec-classes.
- Added `.update_<attr>` and `.update_<attr_singular>` methods for mutation of existing values (cf. overwriting them using `.with*()).
- `.transform*()` methods now work on attributes that have not been set (`MISSING` will be passed through instead to the transforms).
- `spec_property` gained an option `allow_attribute_error`, which can be set to `False` if you want to reduce the risk of errors being swallowed by `__getattr__` when something goes wrong (`AttributeError`s will then be recast into `NestedAttributeError`s).
- The `prepare` and `item_prepare` methods for attributes are now called *before* fallback construction (as in 0.3.x), allowing classes to do their own default imputation.
- Items in a `KeyedSet` container can now be looked up by instance/value (not just key). This brings it inline with `KeyedList`.
- If attribute namespaces clash (i.e. a collection's singular name collides with an existing attribute name), the singular name falls back to `<attr>_item`, and if that collides also a `RuntimeError` is raised rather than silently resulting in ambiguous behaviour.
- Removed the requirement that custom `__init__` methods *must* accept all attribute names as keyword arguments. This is still recommended.
- Documentation improvements and cleanups.

**Bugfixes and cleanups:**
- Improved the way in which the default constructor calls super-constructors (i.e. only once).
- During bootstrapping, the `__new__` fallback was incorrectly following subclass (rather than local) MROs.
- Fix regression in looking up attribute default overrides from downstream non-spec-class subclasses.
- Fix regression where invalidation maps were no longer generated for inherited unmanaged attributes/methods.
- `spec_property` now properly respects the updated `1.x` value preparation flow.
- Split up the unit tests into smaller chunks for increased maintainability.

1.0.1

Not secure
This is a minor release that:

- fixes package metadata to reflect the new non-beta status.
- improves the performance of simple cases by a factor of ~2.
- removes a vestigial (undocumented) feature to set the attribute defaults using a class method.

Page 5 of 6

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.