Skip to content

Commit

Permalink
Fix documentation links and improve 404 page (#22)
Browse files Browse the repository at this point in the history
* Fix all documentation links to be relative to the current file path

* Update 404 text alignment and message
  • Loading branch information
mdapena authored Oct 18, 2024
1 parent b678733 commit ba37a19
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 44 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please read the [Contributing](https://mdapena.github.io/pyventus/contributing/) guidelines in the documentation site.
Please read the [Contributing](https://mdapena.github.io/pyventus/latest/contributing/) guidelines in the documentation site.
18 changes: 8 additions & 10 deletions docs/.overrides/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,22 @@
function get_path() {
const urlParams = new URLSearchParams(window.location.search);
const pathValue = urlParams.get('path');
return pathValue ? decodeURIComponent(pathValue) : "/unknown-path"
return pathValue ? decodeURIComponent(pathValue) : "/unknown"
}

document.getElementById("path").textContent = get_path();
});
</script>

<div align="center">
<h1>404 - Page Not Found</h1>
<h1>404 - Page Not Found</h1>

<p style="opacity: .75;">
We're sorry, but we couldn't find a page at the path <strong><span id="path"></span></strong>.
</p>
<p style="opacity: .75;">
We're sorry, but the page at the path <strong><span id="path"></span></strong> could not be found.
</p>

<p style="opacity: .75;">
Try searching or go to <a href="{{ base_url }}">Pyventus' homepage</a>.
</p>
</div>
<p style="opacity: .75;">
Try searching or go to <a href="{{ base_url }}">Pyventus' homepage</a>.
</p>

<svg id="clouds" xmlns="http://www.w3.org/2000/svg" width="2611.084" height="485.677" viewBox="0 0 2611.084 485.677">
<title>Gray Clouds Background</title>
Expand Down
3 changes: 1 addition & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ hide:

<li markdown>Fork the repository and create a new branch.</li>
<li markdown>Implement your changes in the branch.</li>
<li markdown>Ensure that [formatting, linting, and tests pass](/pyventus/contributing/#pre-submission-testing-and-validation).</li>
<li markdown>Ensure that [formatting, linting, and tests pass](#pre-submission-testing-and-validation).</li>
<li markdown>Whenever possible, include tests to cover the lines of code you added or modified.</li>
<li markdown>Commit your changes and submit a pull request with a clear, detailed message.</li>

Expand Down Expand Up @@ -284,7 +284,6 @@ hatch run tests:all
```console
hatch run +py=3.12 tests:all
```
```

!!! warning "Troubleshooting Hatch Environment Errors"

Expand Down
10 changes: 5 additions & 5 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ hide:
<p style='text-align: justify;' markdown>
&emsp;&emsp;Welcome to the Getting Started section! This guide will help you install and configure Pyventus in
your project. For more detailed information on how to use this package, you can refer to the Pyventus
[Tutorials](/pyventus/tutorials) or [API Reference](/pyventus/api).
[Tutorials](tutorials/index.md) or [API Reference](api/index.md).
</p>

## Requirements

<p style='text-align: justify;' markdown>
&emsp;&emsp;By default, Pyventus' core functionalities and default event emitter implementations, such as the
[AsyncIO Event Emitter](/pyventus/tutorials/emitters/asyncio), and the [Executor Event Emitter](/pyventus/tutorials/emitters/executor),
[AsyncIO Event Emitter](tutorials/emitters/asyncio/index.md), and the [Executor Event Emitter](tutorials/emitters/executor/index.md),
**only require Python 3.10+** with no additional dependencies. However, these requirements may expand if you opt to
use alternative [*built-in*](#optional-dependencies) event emitter implementations.
</p>
Expand Down Expand Up @@ -51,7 +51,7 @@ pip install pyventus

<li class="annotate" markdown>
<a href="https://docs.celeryq.dev/en/stable/getting-started/introduction.html" target="_blank">**Celery**</a> ─
Pyventus integrates with Celery using the [`CeleryEventEmitter`](/pyventus/tutorials/emitters/celery), enabling
Pyventus integrates with Celery using the [`CeleryEventEmitter`](tutorials/emitters/celery/index.md), enabling
event emissions to be executed on Celery worker nodes to improve task processing. To install Pyventus with Celery
support, use the following command:

Expand All @@ -72,7 +72,7 @@ pip install pyventus[celery] (1)
---
<li markdown>
<a href="https://python-rq.org/" target="_blank">**Redis Queue (RQ)**</a> ─
Pyventus integrates with Redis Queue (RQ) using the [`RQEventEmitter`](/pyventus/tutorials/emitters/rq/), allowing
Pyventus integrates with Redis Queue (RQ) using the [`RQEventEmitter`](tutorials/emitters/rq/index.md), allowing
event emissions to run as background jobs through RQ's asynchronous workers. To install Pyventus with RQ support,
use the following command:

Expand All @@ -90,7 +90,7 @@ pip install pyventus[rq]

<li class="annotate" markdown>
<a href="https://fastapi.tiangolo.com/" target="_blank">**FastAPI**</a> ─
Pyventus integrates with the FastAPI framework using the [`FastAPIEventEmitter`](/pyventus/tutorials/emitters/fastapi),
Pyventus integrates with the FastAPI framework using the [`FastAPIEventEmitter`](tutorials/emitters/fastapi/index.md),
enabling event-driven architectures to be built directly into FastAPI applications. The emitter leverages FastAPI's
background tasks to asynchronously process event emissions without blocking responses. To install Pyventus with
FastAPI integration, use the following command:
Expand Down
30 changes: 15 additions & 15 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ hide:


<p align="center">
<img src="./images/logo/pyventus-logo-name-slogan.svg" alt="Pyventus" width="900px">
<img src="images/logo/pyventus-logo-name-slogan.svg" alt="Pyventus" width="900px">
</p>

<br>
Expand Down Expand Up @@ -131,11 +131,11 @@ pip install pyventus
```
</div>

<p style='text-align: justify;'>
<p style='text-align: justify;' markdown>
&emsp;&emsp;Pyventus by default relies on the Python standard library and <b>requires Python 3.10 or higher</b> with no
additional dependencies. However, this package also includes alternative integrations to access additional features
such as Redis Queue, Celery, and FastAPI. For more information on this matter, please refer to the
<a href="/getting-started/#optional-dependencies" target="_blank">Optional Dependencies</a>
[Optional Dependencies](getting-started.md/#optional-dependencies)
section.
</p>

Expand Down Expand Up @@ -185,7 +185,7 @@ event_emitter.emit("GreetEvent")
workflow for defining and emitting events. Let's recap the essential steps involved:
</p>

<ol style='text-align: justify;'>
<ol style='text-align: justify;' markdown>

<li>
<b>Importing Necessary Modules:</b>
Expand All @@ -200,10 +200,10 @@ to the function <code>handle_greet_event()</code>, which will print <i>'Hello, W
<code>GreetEvent</code> is emitted.
</li>

<li>
<li markdown>
<b>Instantiating an Event Emitter:</b>
After that, and in order to trigger our event, we needed to create an instance of the event emitter class. While
<code>AsyncIOEventEmitter</code> was utilized, any <a href="/getting-started/#optional-dependencies"><i>built-in</i></a>
<code>AsyncIOEventEmitter</code> was utilized, any [*built-in*](getting-started.md/#optional-dependencies)
or custom implementation could be employed.
</li>

Expand All @@ -215,11 +215,11 @@ Finally, by using the <code>emit()</code> method of the event emitter instance,

</ol>

<p style='text-align: justify;'>
<p style='text-align: justify;' markdown>
&emsp;&emsp;Having gained a clear understanding of the workflow showcased in the <code>Hello, World!</code> example,
you are now well-equipped to explore more intricate event-driven scenarios and fully harness the capabilities of
Pyventus in your own projects. For a deep dive into the package's functionalities, you can refer to the
Pyventus <a href="/0.5/tutorials" target="_blank">Tutorials</a> or <a href="/0.5/api" target="_blank">API</a>.
Pyventus [Tutorials](tutorials/index.md) or [API](api/index.md).
</p>

[//]: # (--------------------------------------------------------------------------------------------------------------)
Expand All @@ -238,7 +238,7 @@ Finally, by using the <code>emit()</code> method of the event emitter instance,
<summary>Example ─ Monitoring Voltage Levels Across Devices (Context)</summary>

<a style="text-align: center" href="https://unsplash.com/photos/macro-photography-of-black-circuit-board-FO7JIlwjOtU?utm_content=creditShareLink&utm_medium=referral&utm_source=unsplash" target="_blank">
<img src="./images/examples/practical-example-index.jpg" alt="Macro photography of black circuit board">
<img src="images/examples/practical-example-index.jpg" alt="Macro photography of black circuit board">
</a>

<p style='text-align: justify;'>
Expand Down Expand Up @@ -406,9 +406,9 @@ async def async_function(event_emitter: EventEmitter):

## Runtime Flexibility and Customization

<p style='text-align: justify;'>
<p style='text-align: justify;' markdown>
&emsp;&emsp;At its core, Pyventus utilizes a modular event emitter design that allows you to switch seamlessly
between different <a href="/getting-started/#optional-dependencies"><i>built-in</i></a> or custom event emitter
between different [*built-in*](getting-started.md/#optional-dependencies) or custom event emitter
implementations on the fly. Whether you opt for official emitters or decide to create your custom ones, Pyventus
allows you to tailor the behavior and capabilities of the event emitters to perfectly align with your unique
requirements.
Expand Down Expand Up @@ -469,9 +469,9 @@ class FastAPIEventEmitter(EventEmitter):
<details markdown="1" class="tip">
<summary>Official <code>FastAPIEventEmitter</code> Integration.</summary>

<p style='text-align: justify;'>
<p style='text-align: justify;' markdown>
In case you're interested in integrating Pyventus with FastAPI, you can refer to the official Pyventus
<a href="/tutorials/emitters/fastapi/"><i>FastAPI Event Emitter</i></a> implementation.
[*FastAPI Event Emitter*](tutorials/emitters/fastapi/index.md) implementation.
</p>

</details>
Expand Down Expand Up @@ -584,9 +584,9 @@ event_emitter.emit("DivisionEvent", a=1, b=2) # Example: Valid division
<details markdown="1" class="info" open>
<summary>Driving Innovation Through Collaboration</summary>

<p style='text-align: justify;'>
<p style='text-align: justify;' markdown>
&emsp;&emsp;Pyventus is an open source project that welcomes community involvement. If you wish to contribute
additional event emitters, improvements, or bug fixes, please check the <a href="/pyventus/contributing/">Contributing</a>
additional event emitters, improvements, or bug fixes, please check the [Contributing](contributing.md)
section for guidelines on collaborating. Together, we can further the possibilities of event-driven development.
</p>

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/emitters/celery/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<ol style='text-align: justify;' markdown>

<li style='text-align: justify;' markdown>**Event emission:**
When an event is triggered, an object is created and submitted as a task to the Celery [queue](/pyventus/api/emitters/celery/#pyventus.emitters.celery.CeleryEventEmitter.Queue).
When an event is triggered, an object is created and submitted as a task to the Celery [queue](../../../api/emitters/celery/index.md/#pyventus.emitters.celery.CeleryEventEmitter.Queue).
</li>

<li style='text-align: justify;' markdown>**Task queue:**
Expand All @@ -46,7 +46,7 @@ Idle Celery workers pull tasks from the queue and execute the event emissions as
<ol style='text-align: justify;' markdown>

<li style='text-align: justify;' markdown>**Install Celery:**
Before proceeding, make sure you have installed the [Celery optional dependency](/pyventus/getting-started/#optional-dependencies).
Before proceeding, make sure you have installed the [Celery optional dependency](../../../getting-started.md/#optional-dependencies).
</li>

<li style='text-align: justify;' markdown>**Define event handlers:**
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/emitters/fastapi/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</p>

1. **Install Dependencies:**
Ensure [FastAPI](https://fastapi.tiangolo.com/#installation) and [Pyventus](/pyventus/getting-started/#optional-dependencies)
Ensure [FastAPI](https://fastapi.tiangolo.com/#installation) and [Pyventus](../../../getting-started.md/#optional-dependencies)
are installed.

2. **Dependency injection and usage:**
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/emitters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
### Built-in Event Emitters

<p style='text-align: justify;' markdown>
&emsp;&emsp;Pyventus includes several [*built-in*](/pyventus/getting-started/#optional-dependencies) event emitters
&emsp;&emsp;Pyventus includes several [*built-in*](../../getting-started.md/#optional-dependencies) event emitters
by default. For instance, the `AsyncIOEventEmitter` leverages the `AsyncIO` framework to handle the execution of
event emissions, while the `RQEventEmitter` utilizes Redis Queue pub/sub system with workers to manage the
execution of event emissions.
Expand All @@ -61,7 +61,7 @@

<p style='text-align: justify;' markdown>
Pyventus is an open source project that welcomes community involvement. If you wish to contribute additional
event emitters, improvements, or bug fixes, please check the [Contributing](/pyventus/contributing) section for
event emitters, improvements, or bug fixes, please check the [Contributing](../../contributing.md) section for
guidelines on collaborating. Together, we can further the possibilities of event-driven development.
</p>

Expand Down Expand Up @@ -176,9 +176,9 @@ async def console_print_endpoint(background_tasks: BackgroundTasks):

!!! tip "Official `FastAPIEventEmitter` Integration"

<p style='text-align: justify;'>
<p style='text-align: justify;' markdown>
In case you're interested in integrating Pyventus with FastAPI, you can refer to the official Pyventus
[*FastAPI Event Emitter*](/pyventus/tutorials/emitters/fastapi/) implementation.
[*FastAPI Event Emitter*](../../tutorials/emitters/fastapi/index.md) implementation.
</p>

## Runtime Flexibility
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/emitters/rq/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<ol style='text-align: justify;' markdown>

<li style='text-align: justify;' markdown>**Event emission:**
When an event is emitted, all associated event handlers are bundled into an [EventEmission](/pyventus/api/emitters/#pyventus.EventEmitter.EventEmission)
When an event is emitted, all associated event handlers are bundled into an [EventEmission](../../../api/emitters/index.md/#pyventus.EventEmitter.EventEmission)
object, which is then enqueued into the Redis Queue system.
</li>

Expand All @@ -49,7 +49,7 @@ parallel execution.
<ol style='text-align: justify;' markdown>

<li style='text-align: justify;' markdown>**Install Python RQ:**
Before proceeding, make sure you have installed the [Redis Queue (RQ) optional dependency](/pyventus/getting-started/#optional-dependencies).
Before proceeding, make sure you have installed the [Redis Queue (RQ) optional dependency](../../../getting-started.md/#optional-dependencies).
</li>

<li style='text-align: justify;' markdown>**Python RQ worker configuration:**
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/event.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Event objects benefit from autocompletion integration provided by code editors a
<p style='text-align: justify;' markdown>
&emsp;&emsp;In addition to normal events, Pyventus allows exceptions to be treated as first-class events. This enables
propagating and handling errors in an event-driven manner. If you're interested in incorporating error handling
in event emission, you can check out [Success and Error Handling](/pyventus/tutorials/event-linker/#success-and-error-handling).
in event emission, you can check out [Success and Error Handling](../tutorials/event-linker.md/#success-and-error-handling).
</p>

### Usage
Expand Down Expand Up @@ -291,7 +291,7 @@ event_emitter.emit("GreetEvent", name="Pyventus")

<p style='text-align: justify;' markdown>
The `EventEmitter` and `EventLinker` used in the code examples can be easily replaced with any custom or
[*built-in*](/pyventus/getting-started/#optional-dependencies) Pyventus implementation of your choice.
[*built-in*](../getting-started.md/#optional-dependencies) Pyventus implementation of your choice.
For more information on available options, consult the official documentation.
</p>

Expand Down

0 comments on commit ba37a19

Please sign in to comment.