From 4e9570104e7e72efaae8a83ae07a75e51a062915 Mon Sep 17 00:00:00 2001 From: "bj00rn@users.noreply.github.com" Date: Sat, 11 Feb 2023 21:28:39 +0100 Subject: [PATCH] fix docs --- CONTRIBUTING.rst | 67 ++---------------------------------------------- README.rst | 32 +++++++++++++++++++++-- 2 files changed, 32 insertions(+), 67 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index d4fc1ca..4ca9b1c 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,28 +1,3 @@ -.. todo:: THIS IS SUPPOSED TO BE AN EXAMPLE. MODIFY IT ACCORDING TO YOUR NEEDS! - - The document assumes you are using a source repository service that promotes a - contribution model similar to `GitHub's fork and pull request workflow`_. - While this is true for the majority of services (like GitHub, GitLab, - BitBucket), it might not be the case for private repositories (e.g., when - using Gerrit). - - Also notice that the code examples might refer to GitHub URLs or the text - might use GitHub specific terminology (e.g., *Pull Request* instead of *Merge - Request*). - - Please make sure to check the document having these assumptions in mind - and update things accordingly. - -.. todo:: Provide the correct links/replacements at the bottom of the document. - -.. todo:: You might want to have a look on `PyScaffold's contributor's guide`_, - - especially if your project is open source. The text should be very similar to - this template, but there are a few extra contents that you might decide to - also include, like mentioning labels of your issue tracker or automated - releases. - - ============ Contributing ============ @@ -72,26 +47,6 @@ by adding missing information and correcting mistakes. This means that the docs are kept in the same repository as the project code, and that any documentation update is done in the same way was a code contribution. -.. todo:: Don't forget to mention which markup language you are using. - - e.g., reStructuredText_ or CommonMark_ with MyST_ extensions. - -.. todo:: If your project is hosted on GitHub, you can also mention the following tip: - - .. tip:: - Please notice that the `GitHub web interface`_ provides a quick way of - propose changes in ``pysaleryd``'s files. While this mechanism can - be tricky for normal code contributions, it works perfectly fine for - contributing to the docs, and can be quite handy. - - If you are interested in trying this method out, please navigate to - the ``docs`` folder in the source repository_, find which file you - would like to propose changes and click in the little pencil icon at the - top, to open `GitHub's code editor`_. Once you finish editing the file, - please write a message in the form at the bottom of the page describing - which changes have you made and what are the motivations behind them and - submit your proposal. - When working on documentation changes in your local machine, you can compile them using |tox|_:: @@ -106,12 +61,6 @@ and use Python's built-in web server for a preview in your web browser Code Contributions ================== -.. todo:: Please include a reference or explanation about the internals of the project. - - An architecture description, design principles or at least a summary of the - main concepts will make it easy for potential contributors to get started - quickly. - Submit an issue --------------- @@ -151,8 +100,6 @@ Clone the repository to be able to import the package under development in the Python REPL. - .. todo:: if you are not using pre-commit, please remove the following item: - #. Install |pre-commit|_:: pip install pre-commit @@ -182,8 +129,6 @@ Implement your changes to record your changes in git_. - .. todo:: if you are not using pre-commit, please remove the following item: - Please make sure to see the validation messages from |pre-commit|_ and fix any eventual issues. This should automatically use flake8_/black_ to check/fix the code style @@ -218,8 +163,6 @@ Submit your contribution #. Go to the web page of your fork and click |contribute button| to send your changes for review. - .. todo:: if you are using GitHub, you can uncomment the following paragraph - Find more detailed information in `creating a PR`_. You might also want to open the PR as a draft first and mark it as ready for review after the feedbacks from the continuous integration (CI) system or any required fixes. @@ -278,11 +221,6 @@ Maintainer tasks Releases -------- -.. todo:: This section assumes you are using PyPI to publicly release your package. - - If instead you are using a different/private package index, please update - the instructions accordingly. - If you are part of the group of maintainers and have correct user permissions on PyPI_, the following steps can be used to release a new version for ``pysaleryd``: @@ -309,13 +247,12 @@ on PyPI_, the following steps can be used to release a new version for .. <-- start --> -.. todo:: Please review and change the following definitions: .. |the repository service| replace:: GitHub .. |contribute button| replace:: "Create pull request" -.. _repository: https://github.com//pysaleryd -.. _issue tracker: https://github.com//pysaleryd/issues +.. _repository: https://github.com/bj00rn/pysaleryd +.. _issue tracker: https://github.com/bj00rn/pysaleryd/issues .. <-- end --> diff --git a/README.rst b/README.rst index 033786d..f5f64e1 100644 --- a/README.rst +++ b/README.rst @@ -43,13 +43,41 @@ Usage with asyncio as library ============================= +Read data +--------- + +.. code-block:: python3 + + from pysaleryd.client import Client + client = Client(WEBSOCKET_URL, WEBSOCKET_PORT) + await client.connect() + await asyncio.sleep(2) # wait a bit for some data + await print(client.data) + +Read data using callback +------------------------ + +.. code-block:: python3 + + from pysaleryd.client import Client + client = Client(WEBSOCKET_URL, WEBSOCKET_PORT) + + def handle_messge(raw_message: str): + print(msg) + + client.add_handler(handle_message) + await client.connect() + await asyncio.sleep(10) # wait around a bit + +Send control command +-------------------- + .. code-block:: python3 from pysaleryd.client import Client client = Client(WEBSOCKET_URL, WEBSOCKET_PORT) await client.connect() - await asyncio.sleep(2) - print(data) # prints buffered data from system + await client.send_command("MF", 0) # send command to set fan mode CLI usage =========