-
Notifications
You must be signed in to change notification settings - Fork 4
feat: enhance README.md with Quick Start section and improved installation instructions #221
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
Open
Marenz
wants to merge
1
commit into
frequenz-floss:v0.x.x
Choose a base branch
from
Marenz:improve-readme-182
base: v0.x.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,31 +12,58 @@ If you're a developer who needs direct access to the [Dispatch API](https://gith | |
|
||
## 📦 Installation | ||
|
||
### Using pip | ||
|
||
Install the library via pip: | ||
|
||
```bash | ||
pip install frequenz-client-dispatch | ||
``` | ||
|
||
## 🛠️ Usage | ||
### Using Poetry | ||
|
||
If you're using Poetry for dependency management: | ||
|
||
```bash | ||
poetry add frequenz-client-dispatch | ||
``` | ||
|
||
### From Source | ||
|
||
To install from source: | ||
|
||
```bash | ||
git clone https://github.com/frequenz-floss/frequenz-client-dispatch-python.git | ||
cd frequenz-client-dispatch-python | ||
pip install -e . | ||
``` | ||
Comment on lines
+31
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also overlaps with the contributing guide, installing in editable mode just to install for use also feels wrong. |
||
|
||
## 🚀 Quick Start | ||
|
||
Here's a quick example to get you started: | ||
Get up and running in minutes with this simple example: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bumping up the marketing? 😆 |
||
|
||
```python | ||
from frequenz.client.dispatch import DispatchApiClient | ||
import asyncio | ||
|
||
async def print_dispatches(): | ||
# Initialize the client | ||
client = DispatchApiClient(key="your_api_key", server_url="grpc://dispatch.url.goes.here.example.com") | ||
async def main(): | ||
# Initialize the client with your API credentials | ||
client = DispatchApiClient( | ||
auth_key="your_auth_key_here", | ||
sign_secret="your_sign_secret_here", | ||
server_url="grpc://dispatch.url.goes.here.example.com" | ||
) | ||
|
||
# List all dispatches for a specific microgrid | ||
# List all dispatches for microgrid ID 1 | ||
async for page in client.list(microgrid_id=1): | ||
for dispatch in page: | ||
print(dispatch) | ||
print(f"Dispatch ID: {dispatch.id}") | ||
print(f"Type: {dispatch.type}") | ||
print(f"Start Time: {dispatch.start_time}") | ||
print("---") | ||
|
||
# Run the Example | ||
asyncio.run(print_dispatches()) | ||
# Run the example | ||
asyncio.run(main()) | ||
``` | ||
|
||
For detailed usage and advanced features, check out the [client documentation](https://frequenz-floss.github.io/frequenz-client-dispatch-python/latest/reference/frequenz/client/dispatch/#frequenz.client.dispatch.ApiDispatchClient). | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would skip this, otherwise we need to include also
uv
,conda
,pipenv
,pdm
, etc.