Skip to content

Commit

Permalink
Merge pull request #94 from MtkN1/develop
Browse files Browse the repository at this point in the history
✨v0.8.0リリース

## Issues
✅ Bybitの型問題の抜本的な解決方法について #82
✅ バイナリのWebSocketデータのハンドリングに対応する #87
✅ GMOコインのデータストアにタイムスタンプを追加する #88
## Pull requests
✅ Remove default empty list #92
✅ add API Reference #93
  • Loading branch information
MtkN1 committed Nov 11, 2021
2 parents f90a05b + 1dca568 commit ec08e33
Show file tree
Hide file tree
Showing 23 changed files with 1,030 additions and 372 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,7 @@ dmypy.json

# Visual Studio Code
.vscode/

# sphinx.ext.autosummary

generated
29 changes: 29 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{ fullname | escape | underline}}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:

{% block methods %}

{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
{% for item in methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
61 changes: 61 additions & 0 deletions docs/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{ fullname | escape | underline}}

.. automodule:: {{ fullname }}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}
{% if classes %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:toctree:
{% for item in classes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block modules %}
{% if modules %}
.. rubric:: Modules

.. autosummary::
:toctree:
:recursive:
{% for item in modules %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
9 changes: 8 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from pathlib import Path
import sys

sys.path.insert(0, str(Path(__file__).parent.parent.resolve()))

# -- Project information -----------------------------------------------------

Expand All @@ -27,7 +30,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
extensions = ["sphinx.ext.autodoc", 'sphinx.ext.autosummary']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -58,3 +61,7 @@
html_static_path = ['_static']

source_suffix = [".rst"]

autoclass_content = 'both'

templates_path = ['_templates']
9 changes: 9 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Welcome to pybotters's documentation!
Exchanges
Contributing

API Reference
-------------

.. autosummary::
:toctree: generated
:recursive:

pybotters

Indices and tables
==================

Expand Down
4 changes: 3 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Sphinx
sphinx-rtd-theme
sphinx-rtd-theme
aiohttp
rich
33 changes: 22 additions & 11 deletions pybotters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import asyncio
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from typing import Any, Mapping, Optional, Tuple, Union

import aiohttp
from aiohttp import hdrs
Expand All @@ -9,8 +11,10 @@
from .models import experimental
from .models.binance import BinanceDataStore
from .models.bitbank import bitbankDataStore
from .models.bitflyer import bitFlyerDataStore
from .models.bitmex import BitMEXDataStore
from .models.bybit import BybitDataStore
from .models.experimental.bybit import BybitInverseDataStore, BybitUSDTDataStore
from .models.ftx import FTXDataStore
from .models.gmocoin import GMOCoinDataStore
from .typedefs import WsJsonHandler, WsStrHandler
Expand All @@ -23,9 +27,12 @@
'put',
'delete',
'BybitDataStore',
'BybitInverseDataStore',
'BybitUSDTDataStore',
'FTXDataStore',
'BinanceDataStore',
'bitbankDataStore',
'bitFlyerDataStore',
'BitMEXDataStore',
'GMOCoinDataStore',
'experimental',
Expand All @@ -52,9 +59,11 @@ async def _request(
*,
params: Optional[Mapping[str, str]] = None,
data: Any = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> SyncClientResponse:
if apis is None:
apis = {}
async with Client(apis=apis, response_class=SyncClientResponse) as client:
async with client.request(
method, url, params=params, data=data, **kwargs
Expand All @@ -69,7 +78,7 @@ def request(
*,
params: Optional[Mapping[str, str]] = None,
data: Any = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> SyncClientResponse:
loop = asyncio.get_event_loop()
Expand All @@ -82,7 +91,7 @@ def get(
url: str,
*,
params: Optional[Mapping[str, str]] = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> SyncClientResponse:
loop = asyncio.get_event_loop()
Expand All @@ -95,7 +104,7 @@ def post(
url: str,
*,
data: Any = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> SyncClientResponse:
loop = asyncio.get_event_loop()
Expand All @@ -108,7 +117,7 @@ def put(
url: str,
*,
data: Any = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> SyncClientResponse:
loop = asyncio.get_event_loop()
Expand All @@ -121,7 +130,7 @@ def delete(
url: str,
*,
data: Any = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> SyncClientResponse:
loop = asyncio.get_event_loop()
Expand All @@ -133,13 +142,15 @@ def delete(
async def _ws_connect(
url: str,
*,
send_str: Optional[Union[str, List[str]]] = None,
send_str: Optional[Union[str, list[str]]] = None,
send_json: Any = None,
hdlr_str: Optional[WsStrHandler] = None,
hdlr_json: Optional[WsJsonHandler] = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> None:
if apis is None:
apis = {}
async with Client(apis=apis) as client:
wstask = await client.ws_connect(
url,
Expand All @@ -155,11 +166,11 @@ async def _ws_connect(
def ws_connect(
url: str,
*,
send_str: Optional[Union[str, List[str]]] = None,
send_str: Optional[Union[str, list[str]]] = None,
send_json: Any = None,
hdlr_str: Optional[WsStrHandler] = None,
hdlr_json: Optional[WsJsonHandler] = None,
apis: Union[Dict[str, List[str]], str] = {},
apis: Optional[Union[dict[str, list[str]], str]] = None,
**kwargs: Any,
) -> None:
loop = asyncio.get_event_loop()
Expand Down

0 comments on commit ec08e33

Please sign in to comment.