diff --git a/CHANGELOG.md b/CHANGELOG.md index ec39db5..cafec24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe Historic and pre-release versions aren't necessarily included. -## [UNRELEASED] - TBC +## [0.8.1] - 2024-05-03 ### Added @@ -16,6 +16,8 @@ Historic and pre-release versions aren't necessarily included. ### Changed +- Refactors; test improvements + - Use `ruff format` instead of `isort` + `black` in CI/pre-commit - Update dev/test dependencies: mypy, pre-commit-hooks, pytest, ruff, types-python-dateutil @@ -68,6 +70,7 @@ Historic and pre-release versions aren't necessarily included. - Update dev/test dependencies: ruff +[0.8.1]: https://github.com/elliot-100/Spond-classes/compare/v0.8.0...v0.8.1 [0.8.0]: https://github.com/elliot-100/Spond-classes/compare/v0.7.3...v0.8.0 [0.7.3]: https://github.com/elliot-100/Spond-classes/compare/v0.7.2...v0.7.3 [0.7.2]: https://github.com/elliot-100/Spond-classes/compare/v0.7.1...v0.7.2 diff --git a/README.md b/README.md index cf5b3f4..e5d76a0 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,36 @@ Or if you're using Poetry: poetry add spond-classes ` +## Example code + +Adapting the example code in [`Spond`](https://github.com/Olen/Spond/) README: + +``` +import asyncio +from spond import spond +import spond_classes + +username = 'my@mail.invalid' +password = 'Pa55worD' +group_id = 'C9DC791FFE63D7914D6952BE10D97B46' # fake + +async def main(): + s = spond.Spond(username=username, password=password) + group_data = await s.get_group(group_id) + await s.clientsession.close() + + # Now we can create a class instance ... + group = spond_classes.Group.from_dict(group_data) + + # ... use class properties instead of dict keys ... + print(group.name) + + # ... and access child instances and their properties + for member in group.members: + print(member.full_name) + +asyncio.run(main()) +``` ## Key features * Create `Group` class instance from the dict returned by the corresponding `spond` @@ -89,34 +119,3 @@ Event.unconfirmed_uids: list It's also possible to create `Member.from_dict()`, `Role.from_dict()`, `Subgroup.from_dict()`. - -## Example code - -Adapting the example code in [`Spond`](https://github.com/Olen/Spond/) README: - -``` -import asyncio -from spond import spond -import spond_classes - -username = 'my@mail.invalid' -password = 'Pa55worD' -group_id = 'C9DC791FFE63D7914D6952BE10D97B46' # fake - -async def main(): - s = spond.Spond(username=username, password=password) - group_data = await s.get_group(group_id) - await s.clientsession.close() - - # Now we can create a class instance ... - group = spond_classes.Group.from_dict(group_data) - - # ... use class properties instead of dict keys ... - print(group.name) - - # ... and access child instances and their properties - for member in group.members: - print(member.full_name) - -asyncio.run(main()) -``` diff --git a/pyproject.toml b/pyproject.toml index fb49b88..78c7ea2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "spond-classes" -version = "0.8.0" +version = "0.8.1" description = "Experimental Python class abstraction layer for `spond` package." authors = ["elliot-100 <3186037+elliot-100@users.noreply.github.com>"] readme = "README.md"