Skip to content

Commit cba3e18

Browse files
authored
docs: Improve README and intro (#189)
- Add an intro and install instructions - Improve the README introduction - Add a quick start section to the README - Add a documentation section to the README
2 parents a97e9f7 + d9961e2 commit cba3e18

File tree

3 files changed

+119
-3
lines changed

3 files changed

+119
-3
lines changed

README.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,44 @@
66

77
## Introduction
88

9-
Channel implementations for Python
9+
Frequenz Channels is a *channels* implementation for Python.
10+
11+
According to [Wikipedia](https://en.wikipedia.org/wiki/Channel_(programming)):
12+
13+
> A channel is a model for interprocess communication and synchronization via
14+
> message passing. A message may be sent over a channel, and another process or
15+
> thread is able to receive messages sent over a channel it has a reference to,
16+
> as a stream. Different implementations of channels may be buffered or not,
17+
> and either synchronous or asynchronous.
18+
19+
Frequenz Channels are mostly designed after [Go
20+
channels](https://tour.golang.org/concurrency/2) but it also borrows ideas from
21+
[Rust channels](https://doc.rust-lang.org/book/ch16-02-message-passing.html).
22+
23+
## Quick Start
24+
25+
We assume you are on a system with Python available. If that is not the case,
26+
please [download and install Python](https://www.python.org/downloads/) first.
27+
28+
To install Frequenz Channels, you probably want to create a new virtual
29+
environment first. For example, if you use a `sh` compatible shell, you can do
30+
this:
31+
32+
```sh
33+
python3 -m venv .venv
34+
. .venv/bin/activate
35+
```
36+
37+
Then, just install using `pip`:
38+
39+
```sh
40+
python3 -m pip install frequenz-channels
41+
```
42+
43+
## Documentation
44+
45+
For more information, please visit the [documentation
46+
website](https://frequenz-floss.github.io/frequenz-channels-python/).
1047

1148
## Contributing
1249

docs/index.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,81 @@
1-
--8<-- "README.md"
1+
# Frequenz Channels for Python
2+
3+
## Introduction
4+
5+
Frequenz Channels is a *channels* implementation for Python.
6+
7+
According to [Wikipedia](https://en.wikipedia.org/wiki/Channel_(programming)):
8+
9+
> A channel is a model for interprocess communication and synchronization via
10+
> message passing. A message may be sent over a channel, and another process or
11+
> thread is able to receive messages sent over a channel it has a reference to,
12+
> as a stream. Different implementations of channels may be buffered or not,
13+
> and either synchronous or asynchronous.
14+
15+
Frequenz Channels are mostly designed after [Go
16+
channels](https://tour.golang.org/concurrency/2) but it also borrows ideas from
17+
[Rust channels](https://doc.rust-lang.org/book/ch16-02-message-passing.html).
18+
19+
## Installation
20+
21+
First, you need to make sure you have Python installed (at least version 3.11):
22+
23+
```console
24+
$ python3 --version
25+
Python 3.11.4
26+
```
27+
28+
!!! note
29+
30+
These instructions assume you are using a [POSIX compatible
31+
`sh`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html)
32+
shell.
33+
34+
If that command doesn't print a version newer than 3.11.0, you'll need to
35+
[download and install Python](https://www.python.org/downloads/) first.
36+
37+
To install Frequenz Channels, you probably want to create a new virtual
38+
environment first:
39+
40+
```sh
41+
mkdir my-channels-project
42+
cd my-channels-project
43+
python3 -m venv .venv
44+
. .venv/bin/activate
45+
```
46+
47+
!!! tip
48+
49+
Using [`direnv`](https://direnv.net/) can greatly simplify this process as
50+
it automates the creation, activation, and deactivation of the virtual
51+
environment. The first time you enable `direnv`, the virtual environment
52+
will be created, and each time you enter or leave a subdirectory, it will be
53+
activated and deactivated, respectively.
54+
55+
```sh
56+
sudo apt install direnv # if you use Debian/Ubuntu
57+
mkdir my-channels-project
58+
cd my-channels-project
59+
echo "layout python python3" > .envrc
60+
direnv allow
61+
```
62+
63+
This will create the virtual environment and activate it automatically for you.
64+
65+
Now you can install Frequenz Channels by using `pip` (if you don't have `pip` installed
66+
you can follow [the official instructions](https://pip.pypa.io/en/stable/installation/)):
67+
68+
```sh
69+
python3 -m pip install frequenz-channels
70+
```
71+
72+
To verify that the installation worked, you can invoke the Python interpreter and
73+
import the `frequenz.channels` module:
74+
75+
```console
76+
$ python3
77+
Python 3.11.4 (main, Jun 7 2023, 10:13:09) [GCC 12.2.0] on linux
78+
Type "help", "copyright", "credits" or "license" for more information.
79+
>>> import frequenz.channels
80+
>>>
81+
```

mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,4 @@ plugins:
112112
# Preview controls
113113
watch:
114114
- "src"
115-
- README.md
116115
- CONTRIBUTING.md

0 commit comments

Comments
 (0)