-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from ffekirnew/docs
Docs
- Loading branch information
Showing
15 changed files
with
381 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Contributing to RmediatoR | ||
Thank you for your interest in contributing to RmediatoR! We welcome contributions from the community and are excited to see what you can bring to the project. Below are some guidelines to help you get started. | ||
|
||
## How Can You Contribute? | ||
1. Reporting Bugs: If you find a bug, please report it by opening an issue on GitHub. Provide as much detail as possible to help us understand and reproduce the issue. | ||
|
||
2. Feature Requests: Have an idea for a new feature? Open an issue on GitHub to discuss it. We welcome new ideas and improvements. | ||
|
||
3. Code Contributions: We accept pull requests for bug fixes, new features, and documentation improvements. See the guidelines below for more details. | ||
|
||
4. Documentation: Help us improve our documentation. This includes everything from fixing typos to adding new sections and improving existing content. | ||
|
||
## Getting Started | ||
1. Fork the Repository | ||
Start by forking the repository to your own GitHub account. | ||
|
||
2. Clone the Repository | ||
Clone the forked repository to your local machine: | ||
|
||
```sh | ||
git clone https://github.com/your-username/rmediator.git | ||
cd rmediator | ||
``` | ||
3. Install Dependencies | ||
Install the necessary dependencies using pip or poetry: | ||
|
||
```sh | ||
pip install -r requirements.txt | ||
``` | ||
|
||
or | ||
|
||
```sh | ||
poetry install | ||
``` | ||
4. Create a Branch | ||
Create a new branch for your work. Use a descriptive name for the branch: | ||
|
||
```sh | ||
git checkout -b feature/your-feature-name | ||
``` | ||
## Making Changes | ||
### Coding Guidelines | ||
Follow PEP 8 style guidelines for Python code. | ||
Write clear, concise commit messages. | ||
Include docstrings for all public methods and classes. | ||
Add or update tests as needed to cover your changes. | ||
|
||
We are using `isort` and `black` to format our code. Please run them before making your commits. | ||
|
||
### Running Tests | ||
Ensure all tests pass before submitting your pull request. Run the tests with: | ||
|
||
```sh | ||
make test | ||
``` | ||
|
||
or | ||
|
||
```sh | ||
make test-coverage | ||
``` | ||
Which will also display the test coverage statistics achieved by the code at that point. | ||
|
||
### Commit Your Changes | ||
Commit your changes to your branch: | ||
|
||
```sh | ||
git add . | ||
git commit -m "Description of your changes" | ||
``` | ||
### Push to GitHub | ||
Push your changes to your forked repository: | ||
|
||
```sh | ||
git push origin feature/your-feature-name | ||
``` | ||
|
||
### Submitting a Pull Request | ||
1. Navigate to the original repository on GitHub. | ||
2. Click the "New Pull Request" button. | ||
3. Select the branch you created and compare it with the main branch. | ||
4. Fill out the pull request template, providing as much detail as possible. | ||
5. Submit your pull request. | ||
|
||
### Code Review Process | ||
Your pull request will be reviewed by the maintainers. They may request changes or ask for additional information. Please be responsive to feedback and make the requested changes promptly. | ||
|
||
### Community Guidelines | ||
- Be respectful and considerate in your interactions with others. | ||
- Provide constructive feedback and be open to receiving it. | ||
|
||
### Thank You! | ||
Thank you for contributing to RmediatoR! Your efforts help make this project better for everyone. If you have any questions, feel free to reach out by opening an issue on GitHub or contacting us at [email protected]. |
This file contains 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 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,22 +1,88 @@ | ||
# RmediatoR: Request Mediator | ||
# RmediatoR | ||
|
||
<div style="text-align: center;"> | ||
<img src="./docs/images/RmediatoR.png" width="200" height="200"> | ||
<div style="text-align: left; padding: 1rem 0;"> | ||
<img src="./docs/assets/images/logo-dark.png" width="500" aspect-ration="1/1" style="padding: 0.8rem 0;"> | ||
<p align="left"> | ||
<a href="#introduction">Introduction</a> • | ||
<a href="#demonstration">Demonstration</a> • | ||
<a href="#how-to-use">How to Use</a> • | ||
<a href="#how-to-use">Contributing</a> • | ||
<a href="#how-to-use">License</a> | ||
</p> | ||
</div> | ||
|
||
## [Introduction](#introduction) | ||
|
||
RmediatoR is a request mediator that allows you to make requests to multiple APIs at once. It is a simple and easy-to-use tool that allows you to make requests to multiple APIs at once, and then process the responses in a single place. It is a simple and easy-to-use tool that allows you to make requests to multiple APIs at once, and then process the responses in a single place. | ||
RmediatoR is a Python package inspired by the MediatR library available on NuGet. It allows developers to implement the mediator design pattern in their applications, promoting a clean separation of concerns by centralizing request/response logic and eliminating direct dependencies between components. This package simplifies the communication between different parts of your application, making your code more maintainable and scalable. | ||
|
||
## [Demonstration](#demonstration) | ||
|
||
--- Under construction --- | ||
Here's a quick example to demonstrate how RmediatoR works: | ||
|
||
1. Define a Request and Handler: Create a request class and a handler class that processes the request. | ||
```py | ||
from rmediator.decorators import request, request_handler | ||
|
||
# Define a response | ||
class SomeResponse: | ||
def __init__(self, message): | ||
self.message = message | ||
|
||
# Define a request | ||
@request(SomeResponse) | ||
class SomeRequest: | ||
pass | ||
|
||
# Define a handler for the request | ||
@request_handler(SomeRequest, SomeResponse) | ||
class SomeRequestHandler: | ||
def handle(self, request: SomeRequest) -> SomeResponse: | ||
return SomeResponse("Handled!") | ||
``` | ||
2. Initialize the mediator and register the handlers | ||
```py | ||
from rmediator import Mediator | ||
|
||
mediator = Mediator() | ||
|
||
mediator.register_handler(SomeRequest, SomeRequestHandler()) | ||
``` | ||
3. Send a Request: Use the mediator to send a request and get a response. | ||
```py | ||
# Create a request instance | ||
request = SomeRequest() | ||
|
||
# Send the request through the mediator | ||
response = mediator.send(request) | ||
|
||
# Output the response | ||
print(response.message) # Output: Handled! | ||
``` | ||
## [How to Use](#how-to-use) | ||
|
||
--- Under construction --- | ||
To start using RmediatoR, follow these steps: | ||
1. Installation: First, install the package using pip (or use other options like poetry). | ||
```bash | ||
pip install rmediator | ||
``` | ||
2. Creating Requests and Handlers: Define your request and handler classes as shown in the demonstration above. Each request should inherit from the Request class, and each handler should inherit from the Handler class. | ||
|
||
3. Registering Handlers: Register your handlers with the mediator. This tells the mediator which handler to use for each request type. | ||
|
||
```py | ||
mediator.register_handler(YourRequestClass, YourHandlerClass) | ||
``` | ||
4. Sending Requests: Use the mediator to send requests. The mediator will find the appropriate handler and return the response. | ||
|
||
```py | ||
response = mediator.send(your_request_instance) | ||
``` | ||
|
||
## [License](#license) | ||
RmediatoR is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. | ||
|
||
## [Contributing](#contributing) | ||
Contributions are welcome! Please read the [CONTRIBUTING](CONTRIBUTING.md) guidelines for more information on how to get started. | ||
|
||
## [Contact](#contact) | ||
For questions or issues, please open an issue on GitHub or contact me on my channels. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.