release: bump version to 0.3.0
- Refactor Redis backend connection handling and pool management - Update algorithm implementations with improved type annotations - Enhance config loader validation with stricter Pydantic schemas - Improve decorator and middleware error handling - Expand example scripts with better docstrings and usage patterns - Add new 00_basic_usage.py example for quick start - Reorganize examples directory structure - Fix type annotation inconsistencies across core modules - Update dependencies in pyproject.toml
This commit is contained in:
105
docs/getting-started/installation.rst
Normal file
105
docs/getting-started/installation.rst
Normal file
@@ -0,0 +1,105 @@
|
||||
Installation
|
||||
============
|
||||
|
||||
FastAPI Traffic supports Python 3.10 and above. You can install it using pip, uv, or
|
||||
any other Python package manager.
|
||||
|
||||
Basic Installation
|
||||
------------------
|
||||
|
||||
The basic installation includes the memory backend, which is perfect for development
|
||||
and single-process applications:
|
||||
|
||||
.. tab-set::
|
||||
|
||||
.. tab-item:: pip
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install git+https://gitlab.com/zanewalker/fastapi-traffic.git
|
||||
|
||||
.. tab-item:: uv
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
uv add git+https://gitlab.com/zanewalker/fastapi-traffic.git
|
||||
|
||||
.. tab-item:: poetry
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
poetry add git+https://gitlab.com/zanewalker/fastapi-traffic.git
|
||||
|
||||
With Redis Support
|
||||
------------------
|
||||
|
||||
If you're running a distributed system with multiple application instances, you'll
|
||||
want the Redis backend:
|
||||
|
||||
.. tab-set::
|
||||
|
||||
.. tab-item:: pip
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install "git+https://gitlab.com/zanewalker/fastapi-traffic.git[redis]"
|
||||
|
||||
.. tab-item:: uv
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
uv add "git+https://gitlab.com/zanewalker/fastapi-traffic.git[redis]"
|
||||
|
||||
Everything
|
||||
----------
|
||||
|
||||
Want it all? Install with the ``all`` extra:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install "git+https://gitlab.com/zanewalker/fastapi-traffic.git[all]"
|
||||
|
||||
This includes Redis support and ensures FastAPI is installed as well.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
FastAPI Traffic has minimal dependencies:
|
||||
|
||||
- **pydantic** (>=2.0) — For configuration validation
|
||||
- **starlette** (>=0.27.0) — The ASGI framework that FastAPI is built on
|
||||
|
||||
Optional dependencies:
|
||||
|
||||
- **redis** (>=5.0.0) — Required for the Redis backend
|
||||
- **fastapi** (>=0.100.0) — While not strictly required (we work with Starlette directly),
|
||||
you probably want this
|
||||
|
||||
Verifying the Installation
|
||||
--------------------------
|
||||
|
||||
After installation, you can verify everything is working:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import fastapi_traffic
|
||||
print(fastapi_traffic.__version__)
|
||||
# Should print: 0.2.1
|
||||
|
||||
Or check which backends are available:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from fastapi_traffic import MemoryBackend, SQLiteBackend
|
||||
print("Memory and SQLite backends available!")
|
||||
|
||||
try:
|
||||
from fastapi_traffic import RedisBackend
|
||||
print("Redis backend available!")
|
||||
except ImportError:
|
||||
print("Redis backend not installed (install with [redis] extra)")
|
||||
|
||||
What's Next?
|
||||
------------
|
||||
|
||||
Head over to the :doc:`quickstart` guide to start rate limiting your endpoints.
|
||||
Reference in New Issue
Block a user