Skip to content

Commit

Permalink
Bump Pre-Commit hook versions and adjust typing (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
btschwertfeger committed Aug 24, 2023
1 parent 445ee5d commit 99f6092
Show file tree
Hide file tree
Showing 35 changed files with 312 additions and 201 deletions.
10 changes: 8 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

A clear and concise description of what the problem is. Ex. I'm always
frustrated when [...]

**Describe the solution you'd like**

A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

A clear and concise description of any alternative solutions or features you've
considered.

**Additional context**

Add any other context or screenshots about the feature request here.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ labels: "Question"
assignees: ""
---

There is no stupid question.
There are no stupid questions.
11 changes: 8 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ A short summary into the pull request including the reason for that change.

## Changes / Features

What has being changed - provide code snippets, examples, screenshots, lists - any kind of information hat helps to understand the update.
What has being changed - provide code snippets, examples, screenshots, lists -
any kind of information hat helps to understand the update.

**Make sure to address all topics of the [self-review checklist](https://github.com/github/docs/blob/main/contributing/self-review.md#self-review).**
**Make sure to address all topics of the [self-review
checklist](https://github.com/github/docs/blob/main/contributing/self-review.md#self-review).**

Closes: Don't forget to link an existing issue for your change. If there is no open issue for your change - create one to make it more likely that his update will be accepted: [python-kraken-sdk/issues/new/choose](https://github.com/btschwertfeger/python-kraken-sdk/issues/new/choose).
Closes: Don't forget to link an existing issue for your change. If there is no
open issue for your change - create one to make it more likely that his update
will be accepted:
[python-kraken-sdk/issues/new/choose](https://github.com/btschwertfeger/python-kraken-sdk/issues/new/choose).
39 changes: 28 additions & 11 deletions .github/self-review.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
# Self review checklist ✅

Before creating a pull request you should check the following requirements that must be addressed before a PR will be accepted.
Before creating a pull request you should check the following requirements that
must be addressed before a PR will be accepted.

- [ ] **All** pre-commit hooks must run through - successfully.
- [ ] Make sure that the changes confirm the coding style of the [python-kraken-sdk](https://github.com/btschwertfeger/python-kraken-sdk). Most issues will be resolve through the pre-commit hooks.
- [ ] Also take care to follow the community guidelines and the [Code of Conduct](./CODE_OF_CONDUCT.md).
- [ ] Self-review your changes to detect typos, syntax errors and any kind of unwanted behavior.
- [ ] If you changed the source code you have to **ensure that all unit tests run through**. If you added a new function you also have to **write a test** for that. Also make sure to **follow the doc string style** of the package and **provide at least one working example** within a function doc string. This is important since doc strings will be reflected within the documentation.
- [ ] Take your time to prepare your code before creating a PR. A good PR will save a lot of time for everyone.
- [ ] There are several workflows/actions within this repository. Any relevant workflow must be run successfully within your fork. In the following these workflows are listed, but **please also read the respective workflow files to get further information**.
- PR Manual Pre-Commit (`manual_pre_commit.yaml`): This workflow must be green in any case.
- [ ] Make sure that the changes confirm the coding style of the
[python-kraken-sdk](https://github.com/btschwertfeger/python-kraken-sdk). Most
issues will be resolve through the pre-commit hooks.
- [ ] Also take care to follow the community guidelines and the [Code of
Conduct](./CODE_OF_CONDUCT.md).
- [ ] Self-review your changes to detect typos, syntax errors and any kind of
unwanted behavior.
- [ ] If you changed the source code you have to **ensure that all unit tests
run through**. If you added a new function you also have to **write a test**
for that. Also make sure to **follow the doc string style** of the package and
**provide at least one working example** within a function doc string. This is
important since doc strings will be reflected within the documentation.
- [ ] Take your time to prepare your code before creating a PR. A good PR will
save a lot of time for everyone.
- [ ] There are several workflows/actions within this repository. Any relevant
workflow must be run successfully within your fork. In the following these
workflows are listed, but **please also read the respective workflow files to
get further information**.
- PR Manual Pre-Commit (`manual_pre_commit.yaml`): This workflow must be green
in any case.
- PR Manual Build (`manual_build.yaml`): Must be green in any case.
- PR Manual CodeQL (`manual_codeql.yaml`): same here
- PR Manual Test Spot (`manual_test_spot.yaml`): If any Spot related change happened
- PR Manual Test Futures (`manual_test_futures.yaml`): For any Futures related changes
- CI/CD (`cicd.yaml`): Can be used to run all actions at once - but requires having API keys for Spot, Futures and the Futures demo environment.
- PR Manual Test Spot (`manual_test_spot.yaml`): If any Spot related change
happened
- PR Manual Test Futures (`manual_test_futures.yaml`): For any Futures related
changes
- CI/CD (`cicd.yaml`): Can be used to run all actions at once - but requires
having API keys for Spot, Futures and the Futures demo environment.
6 changes: 2 additions & 4 deletions .github/workflows/_codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ jobs:
python-version: ${{ inputs.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
run: python -m pip install --upgrade pip

- name: Install package
run: python -m pip install ".[dev]"
Expand All @@ -65,8 +64,7 @@ jobs:
FUTURES_SECRET_KEY: ${{ secrets.FUTURES_SECRET_KEY }}
FUTURES_SANDBOX_KEY: ${{ secrets.FUTURES_SANDBOX_KEY }}
FUTURES_SANDBOX_SECRET: ${{ secrets.FUTURES_SANDBOX_SECRET }}
run: |
pytest -vv -s --cov --cov-report=xml:coverage.xml tests
run: pytest -vv -s --cov --cov-report=xml:coverage.xml tests

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/_codeql.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#

name: CodeQL

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/_pre_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
Pre-Commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
6 changes: 2 additions & 4 deletions .github/workflows/_test_futures_private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ jobs:
FUTURES_SECRET_KEY: ${{ secrets.FUTURES_SECRET_KEY }}
FUTURES_SANDBOX_KEY: ${{ secrets.FUTURES_SANDBOX_KEY }}
FUTURES_SANDBOX_SECRET: ${{ secrets.FUTURES_SANDBOX_SECRET }}
run: |
pytest -vv -m "futures_auth and not futures_websocket" tests
run: pytest -vv -m "futures_auth and not futures_websocket" tests

## Unit tests of the Futures websocket client
##
Expand All @@ -70,5 +69,4 @@ jobs:
FUTURES_SECRET_KEY: ${{ secrets.FUTURES_SECRET_KEY }}
FUTURES_SANDBOX_KEY: ${{ secrets.FUTURES_SANDBOX_KEY }}
FUTURES_SANDBOX_SECRET: ${{ secrets.FUTURES_SANDBOX_SECRET }}
run: |
pytest -vv -m futures_websocket tests
run: pytest -vv -m futures_websocket tests
3 changes: 1 addition & 2 deletions .github/workflows/_test_futures_public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ jobs:
## Unit tests of the public Futures REST clients and endpoints
##
- name: Testing Futures REST endpoints
run: |
pytest -vv -m "futures and not futures_auth and not futures_websocket" tests
run: pytest -vv -m "futures and not futures_auth and not futures_websocket" tests
6 changes: 2 additions & 4 deletions .github/workflows/_test_spot_private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ jobs:
env:
SPOT_API_KEY: ${{ secrets.SPOT_API_KEY }}
SPOT_SECRET_KEY: ${{ secrets.SPOT_SECRET_KEY }}
run: |
pytest -vv -m "spot_auth and not spot_websocket" tests
run: pytest -vv -m "spot_auth and not spot_websocket" tests

## Unit tests of Spot websocket clients
##
- name: Testing Spot websocket client
env:
SPOT_API_KEY: ${{ secrets.SPOT_API_KEY }}
SPOT_SECRET_KEY: ${{ secrets.SPOT_SECRET_KEY }}
run: |
pytest -vv -m spot_websocket tests
run: pytest -vv -m spot_websocket tests
3 changes: 1 addition & 2 deletions .github/workflows/_test_spot_public.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,4 @@ jobs:
## Unit tests of the public Spot REST clients and endpoints
##
- name: Testing Spot REST endpoints
run: |
pytest -vv -m "spot and not spot_auth and not spot_websocket" tests
run: pytest -vv -m "spot and not spot_auth and not spot_websocket" tests
44 changes: 22 additions & 22 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2023 Benjamin Thomas Schwertfeger
# GitHub: https://github.com/btschwertfeger
# -*- coding: utf-8 -*- Copyright (C) 2023 Benjamin Thomas Schwertfeger GitHub:
# https://github.com/btschwertfeger
#
# Workflow to apply pre-commit, build, test and upload the package
# to the test index of PyPI.
# Workflow to apply pre-commit, build, test and upload the package to the test
# index of PyPI.
#
# This workflow runs the whole CI of the python-kraken-sdk and serves
# to run the following checks:
# This workflow runs the whole CI of the python-kraken-sdk and serves to run the
# following checks:
# * pre-commit: checks the code style, syntax, formatting, etc.
# * CodeQL: checks security issues
# * Build: builds the python-kraken-sdk for multiple versions and os
Expand All @@ -26,19 +25,20 @@
# * Query ledger entries
# * Export data
# * Access WebSockets API
# Disable all other permissions since we don't want to create or cancel
# real orders or withdraw funds during testing. These tests are disabled
# by default but having the permissions disabled is the safest way of
# testing.
# Disable all other permissions since we don't want to create or
# cancel real orders or withdraw funds during testing. These tests
# are disabled by default but having the permissions disabled is the
# safest way of testing.
#
# for Futures:
# * FUTURES_API_KEY
# * FUTURES_SECRET_KEY
# * FUTURES_SANDBOX_KEY
# * FUTURES_SANDBOX_SECRET
# Please also make sure to set the "Read Only" permission
# for the live account to not risk any funds during testing!
# The demo/sandbox account requires full permissions.
#
# Please also make sure to set the "Read Only" permission for the
# live account to not risk any funds during testing! The
# demo/sandbox account requires full permissions.
#

name: CI/CD
Expand All @@ -53,19 +53,19 @@ concurrency:
cancel-in-progress: true

jobs:
## ==========================================================================
## ===========================================================================
## Checks the code logic, style and more
##
Pre-Commit:
uses: ./.github/workflows/_pre_commit.yaml

## ==========================================================================
## ===========================================================================
## Discover vulnerabilities
##
CodeQL:
uses: ./.github/workflows/_codeql.yaml

## ==========================================================================
## ===========================================================================
## Builds the package on multiple OS for multiple
## Python versions
##
Expand All @@ -81,7 +81,7 @@ jobs:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

## ==========================================================================
## ===========================================================================
## Build the documentation
##
Build-Doc:
Expand All @@ -91,7 +91,7 @@ jobs:
os: "ubuntu-latest"
python-version: "3.11"

## ==========================================================================
## ===========================================================================
## Run the Spot tests for Python 3.7 until 3.11
##
## (public endpoints)
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
python-version: ${{ matrix.python-version }}
secrets: inherit

## ==========================================================================
## ===========================================================================
## Run the Futures tests for Python 3.7 until 3.11
##
## (public endpoints)
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
python-version: ${{ matrix.python-version }}
secrets: inherit

## ==========================================================================
## ===========================================================================
## Uploads the package to test.pypi.org on master if triggered by
## a regular commit/push.
##
Expand All @@ -172,7 +172,7 @@ jobs:
secrets:
API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}

## ==========================================================================
## ===========================================================================
## Generates and uploads the coverage statistics to codecov
##
CodeCov:
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ on:
types: [created]

jobs:
## ==========================================================================
## ===========================================================================
## Run pre-commit - just to make sure that the code is still
## in the proper format
##
Pre-Commit:
uses: ./.github/workflows/_pre_commit.yaml

## ==========================================================================
## ===========================================================================
## Discover vulnerabilities
##
CodeQL:
uses: ./.github/workflows/_codeql.yaml

## ==========================================================================
## ===========================================================================
## Build the package - for all Python versions
##
Build:
Expand All @@ -42,7 +42,7 @@ jobs:
os: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

## ==========================================================================
## ===========================================================================
## Build the documentation
##
Build-Doc:
Expand All @@ -52,7 +52,7 @@ jobs:
os: "ubuntu-latest"
python-version: "3.11"

## ==========================================================================
## ===========================================================================
## Run the Spot tests for Python 3.7 until 3.11
##
## (public endpoints)
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
python-version: ${{ matrix.python-version }}
secrets: inherit

## ==========================================================================
## ===========================================================================
## Run the Futures tests for Python 3.7 until 3.11
##
## (public endpoints)
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
python-version: ${{ matrix.python-version }}
secrets: inherit

## ==========================================================================
## ===========================================================================
## Upload the python-kraken-sdk to Test PyPI
##
UploadTestPyPI:
Expand All @@ -131,7 +131,7 @@ jobs:
secrets:
API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}

## ==========================================================================
## ===========================================================================
## Upload the python-kraken-sdk to Production PyPI
##
UploadPyPI:
Expand Down
Loading

0 comments on commit 99f6092

Please sign in to comment.