-
Notifications
You must be signed in to change notification settings - Fork 9
docs: Improve README and intro #189
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,81 @@ | ||
| --8<-- "README.md" | ||
| # Frequenz Channels for Python | ||
|
|
||
| ## Introduction | ||
|
|
||
| Frequenz Channels is a *channels* implementation for Python. | ||
|
|
||
| According to [Wikipedia](https://en.wikipedia.org/wiki/Channel_(programming)): | ||
|
|
||
| > A channel is a model for interprocess communication and synchronization via | ||
| > message passing. A message may be sent over a channel, and another process or | ||
| > thread is able to receive messages sent over a channel it has a reference to, | ||
| > as a stream. Different implementations of channels may be buffered or not, | ||
| > and either synchronous or asynchronous. | ||
|
|
||
| Frequenz Channels are mostly designed after [Go | ||
| channels](https://tour.golang.org/concurrency/2) but it also borrows ideas from | ||
| [Rust channels](https://doc.rust-lang.org/book/ch16-02-message-passing.html). | ||
|
|
||
| ## Installation | ||
|
|
||
| First, you need to make sure you have Python installed (at least version 3.11): | ||
|
|
||
| ```console | ||
| $ python3 --version | ||
| Python 3.11.4 | ||
| ``` | ||
|
|
||
| !!! note | ||
|
|
||
| These instructions assume you are using a [POSIX compatible | ||
| `sh`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html) | ||
| shell. | ||
|
|
||
| If that command doesn't print a version newer than 3.11.0, you'll need to | ||
| [download and install Python](https://www.python.org/downloads/) first. | ||
|
|
||
| To install Frequenz Channels, you probably want to create a new virtual | ||
| environment first: | ||
|
|
||
| ```sh | ||
| mkdir my-channels-project | ||
| cd my-channels-project | ||
| python3 -m venv .venv | ||
| . .venv/bin/activate | ||
| ``` | ||
|
|
||
| !!! tip | ||
|
|
||
| Using [`direnv`](https://direnv.net/) can greatly simplify this process as | ||
| it automates the creation, activation, and deactivation of the virtual | ||
| environment. The first time you enable `direnv`, the virtual environment | ||
| will be created, and each time you enter or leave a subdirectory, it will be | ||
| activated and deactivated, respectively. | ||
|
|
||
| ```sh | ||
| sudo apt install direnv # if you use Debian/Ubuntu | ||
| mkdir my-channels-project | ||
| cd my-channels-project | ||
| echo "layout python python3" > .envrc | ||
| direnv allow | ||
| ``` | ||
|
|
||
| This will create the virtual environment and activate it automatically for you. | ||
|
|
||
| Now you can install Frequenz Channels by using `pip` (if you don't have `pip` installed | ||
| you can follow [the official instructions](https://pip.pypa.io/en/stable/installation/)): | ||
|
|
||
| ```sh | ||
| python3 -m pip install frequenz-channels | ||
| ``` | ||
|
|
||
| To verify that the installation worked, you can invoke the Python interpreter and | ||
| import the `frequenz.channels` module: | ||
|
|
||
| ```console | ||
| $ python3 | ||
| Python 3.11.4 (main, Jun 7 2023, 10:13:09) [GCC 12.2.0] on linux | ||
| Type "help", "copyright", "credits" or "license" for more information. | ||
| >>> import frequenz.channels | ||
| >>> | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,5 +112,4 @@ plugins: | |
| # Preview controls | ||
| watch: | ||
| - "src" | ||
| - README.md | ||
| - CONTRIBUTING.md | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.