Version 0.2.0b1
Finally some improvements worth writing notes for. Huzzah!
Highlights
- Rewritten event streaming system
- Documentation was rewritten and significantly expanded upon
- Improved error handling and reconnect behaviour for the REST and ESS endpoints
New event streaming interface
Event payloads are now represented by individual subclasses available in auraxium.event
. These allow attribute and type inferrence, as well as provide some extra validation when used with static type checkers like Mypy or Pylance.
But most importantly, this brings auto complete - typos begone!
Previous versions
@client.trigger(auraxium.EventType.DEATH)
async def track_deaths(event: auraxium.Event) -> None:
# "event" is now a sad, generic object, with most interesting data hidden
# away in its "payload" attribute, an anonymous dictionary.
char_id = int(event.payload['character_id'])
attacker_id = int(event.payload['attacker_character_id'])
...
New version
@client.trigger(auraxium.event.Death)
async def track_deaths(event: auraxium.event.Death) -> None:
# "event" now has native, typed attributes for all fields provided by the
# event type. The values below are already cast and hinted as "int":
char_id = event.character_id
attacker_id = event.attacker_character_id
# Additionally, type checkers will yell at you if the types accepted by
# the decorated function are incompatible with the event subscription.
...
For a more thorough introduction into the new event streaming system, check out the new and improved documentation.
Interface clarifications
A lot of modules that did not have any user-facing functionality have been flagged as internal, i.e. prefixed with an underscore to show that they are not part of the library API.
auraxium._cache
auraxium._client
auraxium._rest
(formerlyauraxium.request
)- `auraxium._support
- All submodules of
auraxium.census
- Most submodules of
auraxium.models
- Most submodules of
auraxium.ps2
Potentially breaking changes
Where possible, legacy interfaces have been left in place and wrapped in DeprecationWarning
s to promote their on-the-chopping-block status. Watch out for these warnings as you run your apps; they will also tell you what to use instead.
However, some things were either completely incompatible with the new implementation, or simply too janky to port over. Here is a list:
- The
EventType
enum is gone and has been superceded by custom subclasses,auraxium.EventType.DEATH
is nowauraxium.event.Death
. - The
Event
class can no longer be imported from the root namespace, import it fromauraxium.event
instead. - The
Ps2Data
base class has been removed. In the off-chance that you do require it as part of your app, you will find a similar base type calledRESTPayload
inauraxium.models.base
. - The orphaned
auraxium.types.optional
helper method has been removed.