Skip to content

Commit aae3fe5

Browse files
Apply hints suggested by the ruff linter (#165)
1 parent 21170d9 commit aae3fe5

46 files changed

Lines changed: 322 additions & 223 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/cicd.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
max-parallel: 1 # to avoid failing tests because of API Rate limits
116116
fail-fast: false
117117
matrix:
118-
os: [ubuntu-latest] # only ubuntu since this takes to much time ATM
118+
os: [ubuntu-latest, windows-latest]
119119
python-version: ["3.11"]
120120
with:
121121
os: ${{ matrix.os }}

.pre-commit-config.yaml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,24 @@ repos:
4040
rev: 23.7.0
4141
hooks:
4242
- id: black
43+
- repo: https://github.com/pre-commit/mirrors-prettier
44+
rev: v3.0.2
45+
hooks:
46+
- id: prettier
4347
- repo: https://github.com/PyCQA/isort
4448
rev: 5.12.0
4549
hooks:
4650
- id: isort
4751
args:
4852
- --profile=black
53+
- repo: https://github.com/astral-sh/ruff-pre-commit
54+
rev: v0.1.1
55+
hooks:
56+
- id: ruff
57+
args:
58+
- --preview
59+
- --fix
60+
- --exit-non-zero-on-fix
4961
- repo: https://github.com/pycqa/flake8
5062
rev: 6.1.0
5163
hooks:
@@ -64,13 +76,6 @@ repos:
6476
args:
6577
- --rcfile=pyproject.toml
6678
- -d=R0801 # ignore duplicate code
67-
- repo: https://github.com/astral-sh/ruff-pre-commit
68-
rev: v0.0.287
69-
hooks:
70-
- id: ruff
71-
args:
72-
- --fix
73-
- --exit-non-zero-on-fix
7479
- repo: https://github.com/pre-commit/mirrors-mypy
7580
rev: v1.5.1
7681
hooks:
@@ -81,7 +86,3 @@ repos:
8186
args:
8287
- --config-file=pyproject.toml
8388
- kraken
84-
- repo: https://github.com/pre-commit/mirrors-prettier
85-
rev: v3.0.2
86-
hooks:
87-
- id: prettier

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ pre-commit:
8383
## ruff Run ruff without fix
8484
.PHONY: ruff
8585
ruff:
86-
ruff check .
86+
ruff check --preview .
8787

8888
## ruff-fix Run ruff with fix
8989
##
9090
.PHONY: ruff-fix
9191
ruff-fix:
92-
ruff check . --fix
92+
ruff check --fix --preview .
9393

9494
## changelog Generate the changelog
9595
##

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[![GitHub](https://badgen.net/badge/icon/github?icon=github&label)](https://github.com/btschwertfeger/python-kraken-sdk)
66
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-orange.svg)](https://www.gnu.org/licenses/gpl-3.0)
7-
[![Generic badge](https://img.shields.io/badge/python-3.11-blue.svg)](https://shields.io/)
7+
[![Generic badge](https://img.shields.io/badge/python-3.11+-blue.svg)](https://shields.io/)
88
[![Downloads](https://static.pepy.tech/personalized-badge/python-kraken-sdk?period=total&units=abbreviation&left_color=grey&right_color=orange&left_text=downloads)](https://pepy.tech/project/python-kraken-sdk)
99

1010
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
@@ -22,18 +22,21 @@
2222

2323
> ⚠️ This is an unofficial collection of REST and websocket clients for Spot and
2424
> Futures trading on the Kraken cryptocurrency exchange using Python. Payward
25-
> Ltd. and Kraken are in no way associated with the authors of this module and
25+
> Ltd. and Kraken are in no way associated with the authors of this package and
2626
> documentation.
27-
28-
---
27+
>
28+
> Please note that this project is independent and not endorsed by Kraken or
29+
> Payward Ltd. Users should be aware that they are using third-party software,
30+
> and the authors of this project are not responsible for any issues, losses, or
31+
> risks associated with its usage.
2932
3033
## 📌 Disclaimer
3134

3235
There is no guarantee that this software will work flawlessly at this or later
3336
times. Of course, no responsibility is taken for possible profits or losses.
3437
This software probably has some errors in it, so use it at your own risk. Also
3538
no one should be motivated or tempted to invest assets in speculative forms of
36-
investment. By using this software you release the authors from any liability
39+
investment. By using this software you release the author(s) from any liability
3740
regarding the use of this software.
3841

3942
---
@@ -44,7 +47,7 @@ Available Clients:
4447

4548
- Spot REST Clients
4649
- Spot Websocket Clients (Websocket API v1 and v2)
47-
- Spot Orderbook Client (Websocket API v1 and v2)
50+
- Spot Orderbook Clients (Websocket API v1 and v2)
4851
- Futures REST Clients
4952
- Futures Websocket Client
5053

docs/conf.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
# https://www.sphinx-doc.org/en/master/usage/configuration.html
99
# pylint: disable=invalid-name
1010

11-
"""This module is the configuration for the Sphinx documentation building process"""
11+
"""
12+
This module is the configuration for the Sphinx documentation building process.
13+
"""
1214

13-
import os
1415
import sys
16+
from pathlib import Path
1517

1618
# -- Project information -----------------------------------------------------
1719
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
@@ -21,11 +23,12 @@
2123
author = "Benjamin Thomas Schwertfeger"
2224

2325
# to import the package
24-
sys.path.insert(0, os.path.abspath(".."))
26+
parent_directory: Path = Path("..").resolve()
27+
sys.path.insert(0, str(parent_directory))
2528

2629
rst_epilog = ""
2730
# Read link all targets from file
28-
with open("links.rst", encoding="utf-8") as f:
31+
with Path("links.rst").open(encoding="utf-8") as f:
2932
rst_epilog += f.read()
3033

3134
# -- General configuration ---------------------------------------------------

docs/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ Welcome to Python Kraken SDK's documentation!
2121

2222
src/introduction.rst
2323
src/getting_started/getting_started.rst
24+
src/examples/rest_example_usage.rst
2425
src/examples/trading_bot_templates.rst
25-
src/issues.rst
2626
src/spot/rest.rst
2727
src/spot/websockets.rst
2828
src/futures/rest.rst
2929
src/futures/websockets.rst
3030
src/base_api/base_api.rst
31-
src/krakenexceptions/krakenexceptions.rst
31+
src/exceptions/exceptions.rst
32+
src/issues.rst
3233
src/about/license.rst
3334

3435
Indices and tables

docs/links.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. -*- coding: utf-8 -*-
22
.. Copyright (C) 2023 Benjamin Thomas Schwertfeger
33
.. GitHub: https://github.com/btschwertfeger
4-
4+
..
55
.. LINKS
66
77
.. _Kraken: https://kraken.com
@@ -17,7 +17,7 @@
1717
.. |License badge| image:: https://img.shields.io/badge/License-GPLv3-orange.svg
1818
:target: https://www.gnu.org/licenses/gpl-3.0
1919
:alt: License
20-
.. |PyVersions badge| image:: https://img.shields.io/badge/python-3.11-blue.svg
20+
.. |PyVersions badge| image:: https://img.shields.io/badge/python-3.11+-blue.svg
2121
:target: https://github.com/btschwertfeger/python-kraken-sdk
2222
:alt: Supported Python Versions
2323
.. |Downloads badge| image:: https://static.pepy.tech/personalized-badge/python-kraken-sdk?period=total&units=abbreviation&left_color=grey&right_color=orange&left_text=downloads

docs/src/base_api/base_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Base Clients and Internals
66
==============================
77

88
The following classes and data structures are listed for completeness. Please
9-
avoid using them, since these are internals and may change without any warning.
9+
avoid using them since these are internals and may change without any warning.
1010

1111
They are the base classes for Spot and Futures REST and websocket clients.
1212

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. -*- coding: utf-8 -*-
2+
.. Copyright (C) 2023 Benjamin Thomas Schwertfeger
3+
.. GitHub: https://github.com/btschwertfeger
4+
5+
.. _section-examples:
6+
7+
Usage Examples
8+
==============
9+
10+
The repository of the `python-kraken-sdk`_ provides some example scripts that
11+
demonstrate some of the implemented methods. Please see the sections listed
12+
below.
13+
14+
.. toctree::
15+
:maxdepth: 2
16+
17+
rest_ws_samples/spot_rest_examples.rst
18+
rest_ws_samples/spot_ws_examples.rst
19+
rest_ws_samples/futures_ws_examples.rst
20+
rest_ws_samples/futures_rest_examples.rst
21+
22+
Third-party projects that use the SDK are listed below.
23+
24+
* https://github.com/btschwertfeger/kraken-rebalance-bot
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
.. -*- coding: utf-8 -*-
3+
.. Copyright (C) 2023 Benjamin Thomas Schwertfeger
4+
.. GitHub: https://github.com/btschwertfeger
5+
6+
Futures Rest
7+
------------
8+
9+
The examples presented below serve to demonstrate the usage of the Futures
10+
REST clients provided by `python-kraken-sdk`_ to access `Kraken`_'s REST API.
11+
12+
For questions, feedback, additions, suggestions for improvement or problems
13+
`python-kraken-sdk/discussions`_ or `python-kraken-sdk/issues`_ may be helpful.
14+
15+
These examples are not maintained on a regular basis. They serve only for
16+
demonstration purposes - make sure to checkout the documentation of the
17+
individual functions.
18+
19+
.. literalinclude:: ../../../../examples/futures_examples.py
20+
:language: python
21+
:linenos:
22+
:caption: Example usages of the REST clients

0 commit comments

Comments
 (0)