Skip to content

Commit

Permalink
deploy: e9a18d8
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 6, 2024
1 parent 220afd6 commit 11990f9
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 35 deletions.
Binary file modified .doctrees/developer-interface.doctree
Binary file not shown.
Binary file modified .doctrees/environment.pickle
Binary file not shown.
Binary file modified .doctrees/index.doctree
Binary file not shown.
7 changes: 1 addition & 6 deletions _sources/index.md.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# The idiomatic asyncio MQTT client

```{include} ../README.md
:start-after: <!-- pitch start -->
:end-before: <!-- pitch end -->
```
# The idiomatic asyncio MQTT client 🙌

```{include} ../README.md
:start-after: <!-- documentation start -->
Expand Down
49 changes: 22 additions & 27 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,21 +213,22 @@
</div>
<article role="main">
<section id="the-idiomatic-asyncio-mqtt-client">
<h1>The idiomatic asyncio MQTT client<a class="headerlink" href="#the-idiomatic-asyncio-mqtt-client" title="Permalink to this heading">#</a></h1>
<p>Write code like this:</p>
<h1>The idiomatic asyncio MQTT client 🙌<a class="headerlink" href="#the-idiomatic-asyncio-mqtt-client" title="Permalink to this heading">#</a></h1>
<p><code class="docutils literal notranslate"><span class="pre">aiomqtt</span></code> is a lightweight and idiomatic MQTT client:</p>
<p><strong>Publish</strong></p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">Client</span><span class="p">(</span><span class="s2">&quot;test.mosquitto.org&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">client</span><span class="p">:</span>
<span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">publish</span><span class="p">(</span><span class="s2">&quot;humidity/outside&quot;</span><span class="p">,</span> <span class="n">payload</span><span class="o">=</span><span class="mf">0.38</span><span class="p">)</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">aiomqtt</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="s2">&quot;test.mosquitto.org&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">client</span><span class="p">:</span>
<span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">publish</span><span class="p">(</span><span class="s2">&quot;temperature/outside&quot;</span><span class="p">,</span> <span class="n">payload</span><span class="o">=</span><span class="mf">28.4</span><span class="p">)</span>
</pre></div>
</div>
<p><strong>Subscribe</strong></p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">Client</span><span class="p">(</span><span class="s2">&quot;test.mosquitto.org&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">client</span><span class="p">:</span>
<span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">subscribe</span><span class="p">(</span><span class="s2">&quot;humidity/#&quot;</span><span class="p">)</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="k">with</span> <span class="n">aiomqtt</span><span class="o">.</span><span class="n">Client</span><span class="p">(</span><span class="s2">&quot;test.mosquitto.org&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">client</span><span class="p">:</span>
<span class="k">await</span> <span class="n">client</span><span class="o">.</span><span class="n">subscribe</span><span class="p">(</span><span class="s2">&quot;temperature/#&quot;</span><span class="p">)</span>
<span class="k">async</span> <span class="k">for</span> <span class="n">message</span> <span class="ow">in</span> <span class="n">client</span><span class="o">.</span><span class="n">messages</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">message</span><span class="o">.</span><span class="n">payload</span><span class="p">)</span>
</pre></div>
</div>
<p>aiomqtt combines the stability of the time-proven <a class="reference external" href="https://github.com/eclipse/paho.mqtt.python">paho-mqtt</a> library with an idiomatic asyncio interface:</p>
<section id="key-features">
<h2>Key features<a class="headerlink" href="#key-features" title="Permalink to this heading">#</a></h2>
<ul class="simple">
<li><p>No more callbacks! 👍</p></li>
<li><p>No more return codes (welcome to the <code class="docutils literal notranslate"><span class="pre">MqttError</span></code>)</p></li>
Expand All @@ -236,14 +237,20 @@ <h1>The idiomatic asyncio MQTT client<a class="headerlink" href="#the-idiomatic-
<li><p>Fully type-hinted</p></li>
<li><p>Did we mention no more callbacks?</p></li>
</ul>
</section>
<section id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this heading">#</a></h2>
<p>aiomqtt can be installed via <code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">aiomqtt</span></code>. The only dependency is <a class="reference external" href="https://github.com/eclipse/paho.mqtt.python">paho-mqtt</a>.</p>
<p>If you can’t wait for the latest version, you can install aiomqtt directly from GitHub with:</p>
<p><code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span> <span class="pre">git+https://github.com/sbtinstruments/aiomqtt</span></code></p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">aiomqtt</span>
</pre></div>
</div>
<p>The only dependency is <a class="reference external" href="https://github.com/eclipse/paho.mqtt.python">paho-mqtt</a>.</p>
<p>If you can’t wait for the latest version, install directly from GitHub with:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">pip</span> <span class="n">install</span> <span class="n">git</span><span class="o">+</span><span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">github</span><span class="o">.</span><span class="n">com</span><span class="o">/</span><span class="n">sbtinstruments</span><span class="o">/</span><span class="n">aiomqtt</span>
</pre></div>
</div>
<section id="note-for-windows-users">
<h3>Note for Windows users<a class="headerlink" href="#note-for-windows-users" title="Permalink to this heading">#</a></h3>
<p>Since Python <code class="docutils literal notranslate"><span class="pre">3.8</span></code>, the default asyncio event loop is the <code class="docutils literal notranslate"><span class="pre">ProactorEventLoop</span></code>. Said loop <a class="reference external" href="https://docs.python.org/3/library/asyncio-platforms.html#windows">doesn’t support the <code class="docutils literal notranslate"><span class="pre">add_reader</span></code> method</a> that is required by aiomqtt. Please switch to an event loop that supports the <code class="docutils literal notranslate"><span class="pre">add_reader</span></code> method such as the built-in <code class="docutils literal notranslate"><span class="pre">SelectorEventLoop</span></code>:</p>
<p>Since Python 3.8, the default asyncio event loop is the <code class="docutils literal notranslate"><span class="pre">ProactorEventLoop</span></code>. Said loop <a class="reference external" href="https://docs.python.org/3/library/asyncio-platforms.html#windows">doesn’t support the <code class="docutils literal notranslate"><span class="pre">add_reader</span></code> method</a> that is required by aiomqtt. Please switch to an event loop that supports the <code class="docutils literal notranslate"><span class="pre">add_reader</span></code> method such as the built-in <code class="docutils literal notranslate"><span class="pre">SelectorEventLoop</span></code>:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Change to the &quot;Selector&quot; event loop if platform is Windows</span>
<span class="k">if</span> <span class="n">sys</span><span class="o">.</span><span class="n">platform</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s2">&quot;win32&quot;</span> <span class="ow">or</span> <span class="n">os</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s2">&quot;nt&quot;</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">asyncio</span> <span class="kn">import</span> <span class="n">set_event_loop_policy</span><span class="p">,</span> <span class="n">WindowsSelectorEventLoopPolicy</span>
Expand Down Expand Up @@ -273,19 +280,7 @@ <h2>Versioning<a class="headerlink" href="#versioning" title="Permalink to this
</section>
<section id="changelog">
<h2>Changelog<a class="headerlink" href="#changelog" title="Permalink to this heading">#</a></h2>
<p>The changelog lives in <a class="reference external" href="https://github.com/sbtinstruments/aiomqtt/blob/main/CHANGELOG.md">CHANGELOG.md</a>. It follows the principles of <a class="reference external" href="https://keepachangelog.com/en/1.0.0/">Keep a Changelog</a>.</p>
</section>
<section id="related-projects">
<h2>Related projects<a class="headerlink" href="#related-projects" title="Permalink to this heading">#</a></h2>
<p>Is aiomqtt not what you’re looking for? There are a few other clients you can try:</p>
<ul class="simple">
<li><p><a class="reference external" href="https://github.com/eclipse/paho.mqtt.python">paho-mqtt</a>: Synchronous client</p></li>
<li><p><a class="reference external" href="https://github.com/peterhinch/micropython-mqtt">micropython-mqtt</a>: Asynchronous client for microcontrollers in MicroPython</p></li>
<li><p><a class="reference external" href="https://github.com/wialon/gmqtt">gmqtt</a>: Asynchronous client</p></li>
<li><p><a class="reference external" href="https://github.com/sabuhish/fastapi-mqtt">fastapi-mqtt</a>: Asynchronous wrapper around gmqtt; Simplifies integration with FastAPI</p></li>
<li><p><a class="reference external" href="https://github.com/Yakifo/amqtt">amqtt</a>: Asynchronous client; Includes a broker</p></li>
<li><p><a class="reference external" href="https://github.com/bkanuka/trio-paho-mqtt">trio-paho-mqtt</a>: Asynchronous wrapper around paho-mqtt; Based on trio instead of asyncio</p></li>
</ul>
<p>See <a class="reference external" href="https://github.com/sbtinstruments/aiomqtt/blob/main/CHANGELOG.md">CHANGELOG.md</a>, which follows the principles of <a class="reference external" href="https://keepachangelog.com/en/1.0.0/">Keep a Changelog</a>.</p>
<div class="toctree-wrapper compound">
</div>
<div class="toctree-wrapper compound">
Expand Down Expand Up @@ -349,16 +344,16 @@ <h2>Related projects<a class="headerlink" href="#related-projects" title="Permal
<div class="toc-tree-container">
<div class="toc-tree">
<ul>
<li><a class="reference internal" href="#">The idiomatic asyncio MQTT client</a><ul>
<li><a class="reference internal" href="#">The idiomatic asyncio MQTT client 🙌</a><ul>
<li><a class="reference internal" href="#key-features">Key features</a></li>
<li><a class="reference internal" href="#installation">Installation</a><ul>
<li><a class="reference internal" href="#note-for-windows-users">Note for Windows users</a></li>
</ul>
</li>
<li><a class="reference internal" href="#license">License</a></li>
<li><a class="reference internal" href="#contributing">Contributing</a></li>
<li><a class="reference internal" href="#versioning">Versioning</a></li>
<li><a class="reference internal" href="#changelog">Changelog</a></li>
<li><a class="reference internal" href="#related-projects">Related projects</a><ul>
<li><a class="reference internal" href="#changelog">Changelog</a><ul>
</ul>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head><meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="color-scheme" content="light dark"><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="next" title="Connecting to the broker" href="connecting-to-the-broker.html" /><link rel="prev" title="The idiomatic asyncio MQTT client" href="index.html" />
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="next" title="Connecting to the broker" href="connecting-to-the-broker.html" /><link rel="prev" title="The idiomatic asyncio MQTT client 🙌" href="index.html" />

<!-- Generated with Sphinx 5.3.0 and Furo 2023.03.27 -->
<title>Introduction - aiomqtt</title>
Expand Down
Binary file modified objects.inv
Binary file not shown.
Loading

0 comments on commit 11990f9

Please sign in to comment.