diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ee4642d1..a3177338b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [0.14.0] - Unreleased +## [0.14.0] - 2023-03-09 ### Changed diff --git a/docs/blog/posts/release0-14.0.md b/docs/blog/posts/release0-14.0.md new file mode 100644 index 000000000..6c9221177 --- /dev/null +++ b/docs/blog/posts/release0-14.0.md @@ -0,0 +1,77 @@ +--- +draft: false +date: 2022-03-09 +categories: + - Release +title: "Textual 0.14.0 shakes up posting messages" +authors: + - willmcgugan +--- + +# Textual 0.14.0 shakes up posting messages + +Textual version 0.14.0 has landed just a week after 0.13.0. + +!!! note + + We like fast releases for Textual. Fast releases means quicker feedback, which means better code. + +What's new? + + + +We did a little shake-up of posting [messages](../../guide/events.md) which will simplify building widgets. But this does mean a few breaking changes. + +There are two methods in Textual to post messages: `post_message` and `post_message_no_wait`. The former was asynchronous (you needed to `await` it), and the latter was a regular method call. These two methods have been replaced with a single `post_message` method. + +To upgrade your project to Textual 0.14.0, you will need to do the following: + +- Remove `await` keywords from any calls to `post_message`. +- Replace any calls to `post_message_no_wait` with `post_message`. + + +Additionally, we've simplified constructing messages classes. Previously all messages required a `sender` argument, which had to be manually set. This was a clear violation of our "no boilerplate" policy, and has been dropped. There is still a `sender` property on messages / events, but it is set automatically. + +So prior to 0.14.0 you might have posted messages like the following: + +```python +async self.post_message(self.Changed(self, item=self.item)) +``` + +You can now replace it with this simpler function call: + +```python +self.post_message(self.Change(item=self.item)) +``` + +This also means that you will need to drop the sender from any custom messages you have created. + +If this was code pre-0.14.0: + +```python +class MyWidget(Widget): + + class Changed(Message): + """My widget change event.""" + def __init__(self, sender:MessageTarget, item_index:int) -> None: + self.item_index = item_index + super().__init__(sender) + +``` + +You would need to make the following change (dropping `sender`). + +```python +class MyWidget(Widget): + + class Changed(Message): + """My widget change event.""" + def __init__(self, item_index:int) -> None: + self.item_index = item_index + super().__init__() + +``` + +If you have any problems upgrading, join our [Discord server](https://discord.gg/Enf6Z3qhVr), we would be happy to help. + +See the [release notes](https://github.com/Textualize/textual/releases/tag/v0.14.0) for the full details on this update. diff --git a/pyproject.toml b/pyproject.toml index 3edcaf7f6..a3291312e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "textual" -version = "0.13.0" +version = "0.14.0" homepage = "https://github.com/Textualize/textual" description = "Modern Text User Interface framework" authors = ["Will McGugan "]