https://github.com/luizalabs/ramos
Generic backend pool
https://github.com/luizalabs/ramos
backend django hacktoberfest pool simple-settings
Last synced: 3 months ago
JSON representation
Generic backend pool
- Host: GitHub
- URL: https://github.com/luizalabs/ramos
- Owner: luizalabs
- License: mit
- Created: 2016-07-28T13:31:23.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T18:57:12.000Z (over 3 years ago)
- Last Synced: 2025-08-30T21:37:56.330Z (10 months ago)
- Topics: backend, django, hacktoberfest, pool, simple-settings
- Language: Python
- Homepage: https://ramos.readthedocs.io
- Size: 86.9 KB
- Stars: 28
- Watchers: 20
- Forks: 11
- Open Issues: 7
-
Metadata Files:
- Readme: README.rst
- Changelog: changelog.d/.gitignore
- License: LICENSE
Awesome Lists containing this project
README
Ramos
=====
.. image:: https://readthedocs.org/projects/ramos/badge/?version=latest&style=flat
:target: https://ramos.readthedocs.io/en/latest/
.. image:: https://travis-ci.org/luizalabs/ramos.svg?branch=master
:target: https://travis-ci.org/luizalabs/ramos
.. image:: https://codecov.io/gh/luizalabs/ramos/branch/master/graph/badge.svg
:target: https://codecov.io/gh/luizalabs/ramos
Generic backend pool
Setup
-----
.. code:: bash
pip install ramos
Development setup
-----------------
.. code:: bash
make install
Usage
-----
.. code:: python
import ramos
ramos.configure(pools={
'backend_type': [
'path.to.backend_a',
'path.to.backend_b',
]
})
Integrations
~~~~~~~~~~~~
Ramos can uses `Django`_ or `Simple Settings`_ to get backends
configurations if set settings.POOL_OF_RAMOS:
.. code:: python
POOL_OF_RAMOS = {
'backend_type': [
'path.to.backend_a',
'path.to.backend_b',
]
}
Backend Implementations
~~~~~~~~~~~~~~~~~~~~~~~
.. code:: python
from ramos.mixins import ThreadSafeCreateMixin
class BackendA(ThreadSafeCreateMixin):
id = 'backend_a'
def say(self):
return 'A'
class BackendB(ThreadSafeCreateMixin):
id = 'backend_b'
def say(self):
return 'B'
Backend Pool
~~~~~~~~~~~~
.. code:: python
from ramos.pool import BackendPool
class BackendTypePool(BackendPool)
backend_type = 'backend_type'
backends = BackendTypePool.all()
for backend in backends:
print(backend.say())
# backend_a = BackendTypePool.get('backend_a')
# backend_b = BackendTypePool.get('backend_b')
.. _Django: https://github.com/django/django
.. _Simple Settings: https://github.com/drgarcia1986/simple-settings