This is a massive overhaul to Quiffen.
Not only does it massively reduce the amount of code in the package (from 3167 total lines to 2692!), but it also adds new features, fixes some bugs and greatly improves the overall readability and structure of the code, which should make it much easier to maintain going forwards.
Changelog
New
- Migration to Pydantic for validation
- Uses a custom `BaseModel`
- Added `Security` class (30, 33)
- Added `categories` list to `Class` objects so they can act as a container
- Vastly improved how `Category` tree interaction works with new methods such as `Category.merge`
- `merge()` methods also added to `Account` and `Class` types
- Ability to add custom fields to all Quiffen types for both reading from and writing to QIF files (see 16)
- Added `TransactionLike` as an alias for `Union[Transaction, Investment, Split]`
- Most objects now support the `to_qif` method to get a QIF representation of just that object
Upgrades
- Better type hinting of functions
- Much, much better test coverage (~250 tests!)
- GitHub Actions workflows
- Greatly improved the `quiffen.utils.parse_date` function with the `python-dateutil` package
Breaking Changes
- **Removed support for Python 3.6 and Python 3.7. Quiffen now only supports Python 3.8 and above**
- In most cases, `quiffen.core` modules have been renamed to use the singular noun
- e.g. `quiffen.core.transactions` -> `quiffen.core.transaction`
- `quiffen.core.categories_classes` has been split into `quiffen.core.category` and `quiffen.core.class_type`
- `quiffen.core.transactions` has been split into `quiffen.core.transaction`, `quiffen.core.investment` and `quiffen.core.split`
- Most `__str__` and `__eq__` methods have changed
- `to_dict` methods now return the Pydantic dictionary representation of the object
- Any methods using the `day_first` parameter now have that parameter defaulted to `False` to better support
iso-formatted dates
<details><summary>Click to see module-specific changes</summary>
`quiffen.core.account`
- `VALID_ACCOUNT_TYPES` is now an enum: `AccountType`
- Aliased to `quiffen.AccountType`
- Used for `Account.add_transaction`
- Note: the enum inherits from `str`, so passing string values will still work
- `Account.__eq__` now checks `Account.account_type` as well as `Account.name`
`quiffen.core.category`
- `Category.expense` and `Category.income` booleans have been replaced with `Category.category_type` which
takes a `CategoryType` enum
- `Category.__eq__` now checks the whole object
- `Category.__str__` now returns a proper string representation of the category, not just the `__repr__` result
- `Category.find_category` has been renamed to `Category.find_child`
- `Category.find_child` no longer raises an exception when no child is found, instead returning `None`
`quiffen.core.class_type`
- No breaking changes
`quiffen.core.investment`
- `Investment.__eq__` now checks the whole object
`quiffen.core.qif`
- `Qif.to_dicts` has been removed
- `Qif._read_qif` has been removed
- `Qif._assert_type` has been removed
- Methods that accepted a `data_type` argument (`to_csv`, `to_dataframe`) now taken a `QifDataType` enum
- `Qif.__str__` has been changed
- `Qif.add_*` methods will now merge the objects instead of overwriting them when the object already exists
- The `separator` argument of `Qif.to_csv` has been renamed to `delimiter`
- `Qif.to_csv` no longer takes a `sub_separator` argument and writes UNIX-style CSVs
`quiffen.core.split`
- No breaking changes
`quiffen.core.transaction`
- The `TransactionList` type is now just an alias for `List[TransactionLike]`
- `Transaction.remove_split` has been renamed to `Transaction.remove_splits` and the `multiple` argument has been deprecated
- Additionally, if no filters are provided, all splits are removed
`quiffen.utils`
- `quiffen.utils.create_categories` is now `quiffen.add_categories_to_container`
</details>
Fixes
- 29 and 31
- 23
- 32
- 30
- 28