Skip to content

Commit 808908c

Browse files
[STYLE] Documentation style fixes for the FAQ updates (- WIP PR #429 -)
Changes in file docs/FAQ.md: * style fixes * multiple minor rewordings * added list of some key project policies for contributors Changes in file docs/USAGE.md: * style fixes * simplified some code examples even more
1 parent 749a53e commit 808908c

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

docs/FAQ.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,30 @@
44

55
```{toctree}
66
:maxdepth: 3
7-
:Name: Frequently Asked Questions
8-
9-
[Code of Conduct](https://github.com/reactive-firewall/multicast/tree/HEAD/.github/CODE_OF_CONDUCT.md)
10-
[Contributing](https://github.com/reactive-firewall/multicast/tree/HEAD/.github/CONTRIBUTING.md)
7+
:caption: Frequently Asked Questions
118
```
129

10+
### Where can I find project policies and conventions?
11+
12+
* [LICENSE](https://github.com/reactive-firewall/multicast/tree/HEAD/LICENSE.md)
13+
* [Code of Conduct](https://github.com/reactive-firewall/multicast/tree/HEAD/.github/CODE_OF_CONDUCT.md)
14+
* [Contributing](https://github.com/reactive-firewall/multicast/tree/HEAD/.github/CONTRIBUTING.md)
15+
* [AI Usage Policy](https://github.com/reactive-firewall/multicast/tree/HEAD/.github/AI_USAGE_POLICY.md)
16+
* [Convention Enhancement Proposal No. 4](https://gist.github.com/reactive-firewall/cc041f10aad1d43a5ef15f50a6bbd5a5)
17+
* [Convention Enhancement Proposal No. 7](https://gist.github.com/reactive-firewall/123b8a45f1bdeb064079e0524a29ec20)
18+
* [Convention Enhancement Proposal No. 8](https://gist.github.com/reactive-firewall/b7ee98df9e636a51806e62ef9c4ab161)
19+
* [Convention Enhancement Proposal No. 9](https://gist.github.com/reactive-firewall/d840ee9990e65f302ce2a8d78ebe73f6)
20+
* [Security](./SECURITY.md)
21+
1322
### How do I get this running?
1423

1524
To configure your environment for developing with the multicast library, follow the steps in the
1625
[Install Guide](./INSTALL.md).
1726
Key steps include:
1827

1928
1. Ensuring you have a supported version of Python installed.
20-
2. use pip to install
21-
3.
29+
2. Use pip to install (e.g., `pip install multicast`)
30+
3. Verify the installation works:
2231

2332
| _in `Python`_ | _in `bash`_ |
2433
|---------------|-------------|
@@ -39,15 +48,17 @@ can then proceed to implement a more advanced solution in Python as necessary.
3948
python3 -m multicast --daemon --use-std HEAR --port 59595 --group 224.0.0.1
4049
```
4150

42-
| Explanation of the Command-Line Options | |
43-
|---------------------|---------------------|
51+
**Explanation of the Command-Line Options** <!-- Not a header due to repeated usage -->
52+
53+
| Option | Description |
54+
|--------|-------------|
4455
| `--daemon` | This option runs the multicast listener as a background daemon. |
4556
| `--use-std` | This specifies the action to take when any output is produced. In this case, it uses the standard output to print received messages instead of the default to just log messages. |
4657
| `HEAR` | This specifies the action to take. In this case, it will _receive_ multicast. |
4758
| `--port 59595` | This sets the UDP port number to `59595`, which is used to identify/filter the multicast messages that will be accepted. |
4859
| `--group 224.0.0.1` | This specifies the multicast group address to join. You can replace `224.0.0.1` with your desired multicast group address. |
4960

50-
##### Steps to Run
61+
**Steps to Run** <!-- Not a header due to repeated usage -->
5162

5263
1. Open your terminal.
5364
2. Ensure you have the multicast module installed and accessible.
@@ -99,15 +110,17 @@ sender(group='224.0.0.1', port=59595, ttl=1, data='Hello, Multicast!')
99110
python3 -m multicast SAY --group 224.0.0.1 --port 59595 --message "Hello World!"
100111
```
101112

102-
| Explanation of the Command-Line Options | |
103-
|---------------------|---------------------|
113+
**Explanation of the Command-Line Options** <!-- Not a header due to repeated usage -->
114+
115+
| Option | Description |
116+
|--------|-------------|
104117
| `SAY` | This specifies the action to take. In this case, it will _transmit_ multicast. |
105118
| `--group 224.0.0.1` | This specifies the multicast group address to transmit messages to. You can replace `224.0.0.1` with your desired multicast group address. |
106119
| `--port 59595` | This sets the UDP port number to `59595`, which is used by other members of the multicast group to help identify/filter the multicast messages to accept. |
107120
| `--message` | This specifies the rest of the input is to be the message to transmit. |
108121
| `"Hello World!"` | This specifies the multicast message content to _transmit_. In this case, it is the greeting "Hello World!" |
109122

110-
##### Step-by-step
123+
**Steps to Run** <!-- Not a header due to repeated usage -->
111124

112125
1. Open your terminal.
113126
2. Ensure you have the multicast module installed and accessible.
@@ -127,7 +140,6 @@ functionality to ensure that messages are being transmitted and received correct
127140
# Optional setup console logging
128141
import logging
129142
multicast_logging_sink = logging.getLogger()
130-
handler = logging.StreamHandler()
131143
multicast_logging_sink.setLevel(logging.INFO) # increase default logging from multicast module
132144
handler = logging.StreamHandler() # example trivial log handler
133145
multicast_logging_sink.addHandler(handler)

docs/USAGE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22

33
## Basic Library Usage
44

5-
The API is in a continuous state of improvement, so version pinning is recommended for now.
5+
> [!NOTE]
6+
> The API is in a continuous state of improvement, so version pinning is recommended for now.
67
78
### Listening to Multicast
89

910
The preferred way to receive multicast messages is to allow the `multicast.hear.McastServer`
10-
template class handle the ephemeral multicast receivers as a kind of multicast server, allowing
11+
template class to handle the ephemeral multicast receivers as a kind of multicast server, allowing
1112
a handler to focus on processing the data.
1213

1314
Here is an example of multicast socket server usage (circa v2.1)
1415

1516
```python3
1617
# imports
1718
import multicast
18-
from multiprocessing import Process as Process
19+
from multiprocessing import Process
1920
import random # for random port
2021

2122
# Multicast group address and port
@@ -62,7 +63,6 @@ p.start()
6263
> # setup console logging as example
6364
> import logging
6465
> multicast_logging_sink = logging.getLogger()
65-
> handler = logging.StreamHandler()
6666
> multicast_logging_sink.setLevel(logging.INFO) # increase default logging from multicast module
6767
> handler = logging.StreamHandler() # example trivial log handler
6868
> multicast_logging_sink.addHandler(handler)
@@ -74,19 +74,19 @@ p.start()
7474
> listener = hear.McastHEAR()
7575
>
7676
> # Listen for messages indefinitely (use control+C to stop)
77-
> listener(group='224.0.0.1', port=59259, ttl=1)
77+
> listener(group='224.0.0.1', port=59595, ttl=1)
7878
> ```
7979
8080
### Sending Multicast Transmissions
8181
8282
```python3
8383
# imports
84-
from multiprocessing import Process as Process
84+
from multiprocessing import Process
8585
import multicast
8686
8787
# Multicast group address and port
8888
MCAST_GRP = "224.0.0.1" # Replace with your multicast group address (use IPv4 dotted notation)
89-
MCAST_PORT = int(59595) # Replace with your multicast port (use the same port as the listeners)
89+
MCAST_PORT = 59595 # Replace with your multicast port (use the same port as the listeners)
9090
9191
# Other important settings (Non-Multicast)
9292
# Multicast does not care about the host IP, but the UDP protocol layer of the Python socket does
@@ -129,7 +129,7 @@ finally:
129129
### Custom handlers
130130

131131
> [!TIP]
132-
> The API for custom handlers currently requires implementing a sub-class
132+
> The API for custom handlers currently requires implementing a subclass
133133
> `multicast.hear.HearUDPHandler` and handling the listener's `multicast.hear.McastServer` server
134134
> directly with something like this:
135135
>

0 commit comments

Comments
 (0)