2.3.0 - New `collections` module + refactoring
This is the final version of 2.3.0 (as published to PyPi) - merged from develop branch.
Includes the following extra commits since original release:
-
(commit 600cccd) Rename test_tuple to test_collections + add TestDictObject
-
(commit fa1f4db) Re-factored dictable_namedtuple and related functions for py3.6 / 3.7 compat
Minor updates
-
docs/source/conf.pynow setsPYTHON_PATHwhich helps reduce issues with Sphinx
finding the privex package folder -
Fleshed out
docs/source/examples.rstwithDictObjectanddictable_namedtupleexamples. -
Added documentation for
privex.helpers.collectionsandtests.test_collections -
Added
PipfileandPipfile.lockfor use withpipenvduring development
Major changes
-
Created module
privex.helpers.collections-
DictObject- Adictsub-class which allows keys to be read/written via
attributes (x.something) as well as standard item/key notation (x['something']) -
MockDictObj- Same asDictObject, but masquerades as the builtindict, potentially
allowing it to be used with certain code that expects the builtin dict type -
is_namedtuple- Boolean function which returnsTrueif all passed objects are named tuples -
dictable_namedtuple- An improved version of the nativecollections.namedtuple, which adds additional functionality
such as dict-like key/item access to fields, ability to cast directly to a dict, and ability to add new fields
dynamically to an existing instance. -
convert_dictable_namedtuple- Converts anamedtupletype class instance into adictable_namedtupleinstance -
subclass_dictable_namedtuple- Converts anamedtupletype/class into adictable_namedtupletype/class
-
-
Created unit tests for
is_namedtupleanddictable_namedtupleintests/test_collections.py
BREAKING CHANGES
-
Mockerhas been moved fromprivex.helpers.commonintoprivex.helpers.collections.
Code which imports viafrom privex.helpers.common import Mockerwill no longer work.
Code which importsMockerfrom the sharedprivex.helpersmodule (i.e.from privex.helpers import Mocker)
should be unaffected. -
Dictablehas been moved fromprivex.helpers.commonintoprivex.helpers.collections.
Code which imports viafrom privex.helpers.common import Dictablewill no longer work.
Code which importsDictablefrom the sharedprivex.helpersmodule (i.e.from privex.helpers import Dictable)
should be unaffected.