Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] transition to anyio #302

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1a78845
Ignore Debian subdir
smurfix May 21, 2024
5a49d1f
Use a UUID for client testing against the mosquitto server
smurfix May 22, 2024
eca0b61
Use anyio, and tasks instead of threading.
smurfix May 22, 2024
a7f6dad
Test with asyncio *and* trio
smurfix May 23, 2024
dff80a5
Allow using a Unix socket (paho-mqtt 2.1)
smurfix May 23, 2024
c7d66c6
Topic comparison: don't recurse
smurfix May 23, 2024
e545ee9
Topics: pre-split
smurfix May 23, 2024
5a5e64b
Topic: refactor
smurfix May 23, 2024
1666ef5
Add a message subscription method.
smurfix May 23, 2024
1c2d765
Drop the $share/<foo> prefix from the wildcard tuples up front
smurfix May 23, 2024
4e95f24
docstring update
smurfix May 23, 2024
53ec75c
MQTT says not to match $foo with wildcards
smurfix May 23, 2024
08eead0
Test non-matching $foo
smurfix May 23, 2024
fc86cac
Also filter $foo in straight-up topic matches
smurfix May 23, 2024
8cae372
Add tests for $foo topic matches
smurfix May 23, 2024
d72f3a0
Fix test_messages_generator_is_reusable
smurfix May 27, 2024
f66d405
test_client: don't use anyio.wait_all_tasks_blocked
smurfix May 27, 2024
d7363d1
test_client_unsubscribe: fix race condition
smurfix May 27, 2024
db68cbd
Cleanly close queues
smurfix May 27, 2024
e03b730
drop dead code
smurfix May 27, 2024
f86a007
Basic split subscription handling
smurfix May 27, 2024
6ef44ce
Fix unsubscription
smurfix May 27, 2024
9bc237f
stupid logic error
smurfix May 27, 2024
b403430
Prepare for handling errors in SubscriptionTree.attach
smurfix May 27, 2024
e10d7a9
Raise an error if a specific subscription already exists
smurfix May 27, 2024
604ed19
Simplify auto-unsubscribe code
smurfix May 27, 2024
89baab4
Extend subscription test
smurfix May 27, 2024
2c28b7f
Use subscription identifiers, if supported
smurfix May 27, 2024
cb20faf
Always test the fallback dispatch code
smurfix May 27, 2024
ef9868f
Client.subscription: optionally pass a queue in
smurfix May 27, 2024
c643f2d
Typo
smurfix May 28, 2024
ab969bb
Handle asyncio queues
smurfix May 28, 2024
9c6a7f4
Document new features
smurfix May 28, 2024
bc6dad8
Initial ruff-format-ting
smurfix May 28, 2024
170d234
Our queue wrapper depends on outcome
smurfix May 28, 2024
83c43e5
Remove dependency on attrs
smurfix May 28, 2024
b35e957
Merge tag 'v2.3.0'
smurfix Nov 5, 2024
37bffbd
Use non-reimported constants
smurfix Nov 5, 2024
deeb7fc
Event, not Future
smurfix Nov 5, 2024
52457c2
Make test host+port(s) semi-overrideable
smurfix Nov 5, 2024
4aa26c1
no asyncio please
smurfix Nov 5, 2024
5f658d9
Fix the global "messages" iterator
smurfix Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ aiomqtt/_version.py
*.DS_Store
docs/_build
reports

# Debian packaging
/debian/
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ async with Client("test.mosquitto.org") as client:

## Key features

- Based on the time-proven [paho-mqtt](https://github.com/eclipse/paho.mqtt.python) library
with an idiomatic async interface
- No more callbacks! 👍
- No more return codes (welcome to the `MqttError`)
- No more return codes (welcome to `MqttError`)
- Graceful disconnection (forget about `on_unsubscribe`, `on_disconnect`, etc.)
- Supports MQTT versions 5.0, 3.1.1 and 3.1
- Optionally: separate queues per subscription. No more overhead for dispatching.
- Fully type-hinted
- Did we mention no more callbacks?
- Works with asyncio *and* trio! No workarounds required!

## Installation

Expand All @@ -49,19 +53,6 @@ If you can't wait for the latest version, install directly from GitHub with:
pip install git+https://github.com/empicano/aiomqtt
```

### Note for Windows users

Since Python 3.8, the default asyncio event loop is the `ProactorEventLoop`. Said loop [doesn't support the `add_reader` method](https://docs.python.org/3/library/asyncio-platforms.html#windows) that is required by aiomqtt. Please switch to an event loop that supports the `add_reader` method such as the built-in `SelectorEventLoop`:

```python
# Change to the "Selector" event loop if platform is Windows
if sys.platform.lower() == "win32" or os.name.lower() == "nt":
from asyncio import set_event_loop_policy, WindowsSelectorEventLoopPolicy
set_event_loop_policy(WindowsSelectorEventLoopPolicy())
# Run your async application as usual
asyncio.run(main())
```

## License

This project is licensed under the [BSD 3-clause License](https://opensource.org/licenses/BSD-3-Clause).
Expand Down
Loading