diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index e73c8cd..eb6a746 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -38,18 +38,18 @@ issues - you can also filter for specific `labels`. ### Make Changes -1. Fork the repository +1. Fork the repository and clone your fork locally. ```bash -git clone https://github.com/btschwertfeger/python-kraken-sdk.git +git clone https://github.com//python-kraken-sdk.git ``` 2. Install the provided [pre-commit](https://pre-commit.com/) hooks within the repository and make sure that all hooks run through, before pushing changes. ```bash +cd python-kraken-sdk python-kraken-sdk~$: pre-commit install -python-kraken-sdk~$: pre-commit run -a ``` 3. Create a new branch and start implementing your changes. diff --git a/.github/workflows/_build.yaml b/.github/workflows/_build.yaml index 7f3db51..c2e582a 100644 --- a/.github/workflows/_build.yaml +++ b/.github/workflows/_build.yaml @@ -33,6 +33,7 @@ jobs: allowed-endpoints: > files.pythonhosted.org:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 - name: Checkout repository @@ -45,10 +46,8 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Install dependencies - run: | - python -m pip install --user --upgrade pip - python -m pip install --user build + - name: Install uv + uses: astral-sh/setup-uv@v4 - name: Check git status (not Windows) if: runner.os != 'Windows' @@ -74,36 +73,35 @@ jobs: - name: Build Linux if: runner.os == 'linux' - run: python -m build - - - name: Store the distribution packages - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 - # upload artifacts with the oldest supported version - if: runner.os == 'linux' && inputs.python-version == '3.11' - with: - name: python-package-distributions - path: dist/ + run: | + uv build . + uv tool install dist/python_kraken_sdk*.whl + uv run kraken --version - name: Build macOS if: runner.os == 'macOS' - run: python -m build + run: | + uv build . + uv tool install dist/python_kraken_sdk*.whl + uv run kraken --version - name: Build Windows - if: runner.os == 'Windows' - # put it here to avoid more filtering - run: python -m build -o . - - - name: Install the package on Linux or MacOS - if: runner.os != 'Windows' - run: python -m pip install --user dist/python_kraken_sdk*.whl - - - name: Install the package on Windows if: runner.os == 'Windows' run: | + uv build . try { - $WHEEL = Get-ChildItem -Path . -Filter "python_kraken_sdk*.whl" -ErrorAction Stop - python -m pip install --user $WHEEL + $WHEEL = Get-ChildItem -Path ./dist -Filter "python_kraken_sdk*.whl" -ErrorAction Stop + uv tool install $WHEEL# + uv run kraken --version } catch { - Write-Error "Error: .whl file not found in the current directory." + Write-Error "Error: .whl file not found in .\dist." exit 1 } + + - name: Store the distribution packages + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + # upload artifacts with the oldest supported version + if: runner.os == 'linux' && inputs.python-version == '3.11' + with: + name: python-package-distributions + path: dist/ diff --git a/.github/workflows/_build_doc.yaml b/.github/workflows/_build_doc.yaml index 0670681..24753d2 100644 --- a/.github/workflows/_build_doc.yaml +++ b/.github/workflows/_build_doc.yaml @@ -37,13 +37,18 @@ jobs: with: python-version: ${{ inputs.python-version }} + - name: Install uv + uses: astral-sh/setup-uv@v4 + - name: Install dependencies run: | sudo apt update DEBIAN_FRONTEND=noninteractive sudo apt install -y pandoc - python -m pip install --user -r doc/requirements.txt - python -m pip install --user --upgrade pip - python -m pip install --user . + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install -r doc/requirements.txt + uv pip install . - name: Build the documentation run: make doc diff --git a/.github/workflows/_codecov.yaml b/.github/workflows/_codecov.yaml index cd4b6cc..288c5b3 100644 --- a/.github/workflows/_codecov.yaml +++ b/.github/workflows/_codecov.yaml @@ -59,6 +59,7 @@ jobs: files.pythonhosted.org:443 futures.kraken.com:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 storage.googleapis.com:443 ws-auth.kraken.com:443 @@ -72,11 +73,15 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Install dependencies - run: python -m pip install --upgrade pip + - name: Install uv + uses: astral-sh/setup-uv@v4 - name: Install package - run: python -m pip install ".[dev,test]" + run: | + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install ".[test,dev]" - name: Generate coverage report env: diff --git a/.github/workflows/_codeql.yaml b/.github/workflows/_codeql.yaml index 2636132..3e86249 100644 --- a/.github/workflows/_codeql.yaml +++ b/.github/workflows/_codeql.yaml @@ -22,10 +22,10 @@ jobs: contents: read security-events: write - # strategy: - # fail-fast: false - # matrix: - # language: ["python"] + strategy: + fail-fast: false + matrix: + language: ["python"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support @@ -33,12 +33,13 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: - egress-policy: audit - # disable-sudo: true - # egress-policy: block - # allowed-endpoints: > - # api.github.com:443 - # github.com:443 + # egress-policy: audit + disable-sudo: true + egress-policy: block + allowed-endpoints: > + api.github.com:443 + github.com:443 + uploads.github.com:443 - name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -57,7 +58,7 @@ jobs: # Prefix the list here with "+" to use these queries and those in the config file. # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + queries: security-extended,security-and-quality # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). # If this step fails, then you should remove it and run the build manually (see below) diff --git a/.github/workflows/_pypi_publish.yaml b/.github/workflows/_pypi_publish.yaml index b6d3208..bc6fc8d 100644 --- a/.github/workflows/_pypi_publish.yaml +++ b/.github/workflows/_pypi_publish.yaml @@ -29,7 +29,17 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: - egress-policy: audit + disable-sudo: true + egress-policy: block + allowed-endpoints: > + ghcr.io + test.pypi.org + tuf-repo-cdn.sigstore.dev + fulcio.sigstore.dev + rekor.sigstore.dev + github.com:443 + uploads.github.com:443 + pkg-containers.githubusercontent.com:443 - name: Download all the distributions uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 @@ -37,7 +47,7 @@ jobs: name: python-package-distributions path: dist/ - - name: Publish package distributions to PyPI (optional - testpypi) + - name: Publish package distributions to PyPI uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # release/v1 with: password: ${{ secrets.API_TOKEN }} diff --git a/.github/workflows/_pypi_test_publish.yaml b/.github/workflows/_pypi_test_publish.yaml index 47395b3..144e312 100644 --- a/.github/workflows/_pypi_test_publish.yaml +++ b/.github/workflows/_pypi_test_publish.yaml @@ -29,7 +29,17 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: - egress-policy: audit + disable-sudo: true + egress-policy: block + allowed-endpoints: > + ghcr.io + test.pypi.org + tuf-repo-cdn.sigstore.dev + fulcio.sigstore.dev + rekor.sigstore.dev + github.com:443 + uploads.github.com:443 + pkg-containers.githubusercontent.com:443 - name: Download all the distributions uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 @@ -37,7 +47,7 @@ jobs: name: python-package-distributions path: dist/ - - name: Publish package distributions to PyPI (optional - testpypi) + - name: Publish package distributions to Test PyPI uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # release/v1 with: password: ${{ secrets.API_TOKEN }} diff --git a/.github/workflows/_test_futures_private.yaml b/.github/workflows/_test_futures_private.yaml index 0435e83..0725feb 100644 --- a/.github/workflows/_test_futures_private.yaml +++ b/.github/workflows/_test_futures_private.yaml @@ -38,6 +38,9 @@ jobs: name: Test ${{ inputs.os }} ${{ inputs.python-version }} runs-on: ${{ inputs.os }} timeout-minutes: 7 + concurrency: + group: test_futures_private + cancel-in-progress: true steps: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 @@ -49,6 +52,7 @@ jobs: files.pythonhosted.org:443 futures.kraken.com:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 - name: Checkout repository @@ -59,15 +63,25 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Update Pip + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Install package (Linux or macOS) + if: runner.os != 'Windows' run: | - python -m pip install --user --upgrade pip + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install ".[test]" - - name: Install package - run: python -m pip install --user ".[test]" + - name: Install package (Windows) + if: runner.os == 'Windows' + run: | + uv venv + .venv\Scripts\activate.ps1 + echo "$env:GITHUB_WORKSPACE\.venv\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + uv pip install ".[test]" - ## Unit tests of the private Futures REST clients and endpoints - ## - name: Testing Futures REST endpoints env: FUTURES_API_KEY: ${{ secrets.FUTURES_API_KEY }} @@ -76,8 +90,6 @@ jobs: FUTURES_SANDBOX_SECRET: ${{ secrets.FUTURES_SANDBOX_SECRET }} run: pytest -vv -m "futures_auth and not futures_websocket and not flaky" tests - ## Unit tests of the Futures websocket client - ## - name: Testing Futures websocket client env: FUTURES_API_KEY: ${{ secrets.FUTURES_API_KEY }} diff --git a/.github/workflows/_test_futures_public.yaml b/.github/workflows/_test_futures_public.yaml index ce4297d..36d4a3e 100644 --- a/.github/workflows/_test_futures_public.yaml +++ b/.github/workflows/_test_futures_public.yaml @@ -38,6 +38,7 @@ jobs: files.pythonhosted.org:443 futures.kraken.com:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 - name: Checkout repository @@ -48,14 +49,24 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Update Pip + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Install package (Linux or macOS) + if: runner.os != 'Windows' run: | - python -m pip install --user --upgrade pip + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install ".[test]" - - name: Install package - run: python -m pip install --user ".[test]" + - name: Install package (Windows) + if: runner.os == 'Windows' + run: | + uv venv + .venv\Scripts\activate.ps1 + echo "$env:GITHUB_WORKSPACE\.venv\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + uv pip install ".[test]" - ## 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 diff --git a/.github/workflows/_test_nft_private.yaml b/.github/workflows/_test_nft_private.yaml index f916a2a..fbab961 100644 --- a/.github/workflows/_test_nft_private.yaml +++ b/.github/workflows/_test_nft_private.yaml @@ -30,6 +30,9 @@ jobs: name: Test ${{ inputs.os }} ${{ inputs.python-version }} runs-on: ${{ inputs.os }} timeout-minutes: 10 + concurrency: + group: test_spot_private + cancel-in-progress: true steps: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 @@ -40,6 +43,7 @@ jobs: api.kraken.com:443 files.pythonhosted.org:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 - name: Checkout repository @@ -50,17 +54,27 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Update Pip + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Install package (Linux or macOS) + if: runner.os != 'Windows' run: | - python -m pip install --user --upgrade pip + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install ".[test]" - - name: Install package - run: python -m pip install --user ".[test]" + - name: Install package (Windows) + if: runner.os == 'Windows' + run: | + uv venv + .venv\Scripts\activate.ps1 + echo "$env:GITHUB_WORKSPACE\.venv\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + uv pip install ".[test]" - ## Unit tests of private Spot NFT clients and endpoints - ## - name: Testing NFT REST endpoints env: SPOT_API_KEY: ${{ secrets.SPOT_API_KEY }} SPOT_SECRET_KEY: ${{ secrets.SPOT_SECRET_KEY }} - run: pytest -vv -m "nft_auth" tests + run: pytest -vv -m nft_auth tests diff --git a/.github/workflows/_test_nft_public.yaml b/.github/workflows/_test_nft_public.yaml index 6c9f5eb..d4c404f 100644 --- a/.github/workflows/_test_nft_public.yaml +++ b/.github/workflows/_test_nft_public.yaml @@ -36,6 +36,7 @@ jobs: api.kraken.com:443 files.pythonhosted.org:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 - name: Checkout repository @@ -46,14 +47,24 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Update Pip + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Install package (Linux or macOS) + if: runner.os != 'Windows' run: | - python -m pip install --user --upgrade pip + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install ".[test]" - - name: Install package - run: python -m pip install --user ".[test]" + - name: Install package (Windows) + if: runner.os == 'Windows' + run: | + uv venv + .venv\Scripts\activate.ps1 + echo "$env:GITHUB_WORKSPACE\.venv\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + uv pip install ".[test]" - ## Unit tests of the public Spot NFT clients and endpoints - ## - name: Testing Spot NFT endpoints run: pytest -vv -m "nft and not nft_auth" tests diff --git a/.github/workflows/_test_spot_private.yaml b/.github/workflows/_test_spot_private.yaml index e483dc4..4ce820f 100644 --- a/.github/workflows/_test_spot_private.yaml +++ b/.github/workflows/_test_spot_private.yaml @@ -35,6 +35,9 @@ jobs: name: Test ${{ inputs.os }} ${{ inputs.python-version }} runs-on: ${{ inputs.os }} timeout-minutes: 10 + concurrency: + group: test_spot_private + cancel-in-progress: true steps: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 @@ -45,6 +48,7 @@ jobs: api.kraken.com:443 files.pythonhosted.org:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 ws-auth.kraken.com:443 ws.kraken.com:443 @@ -57,23 +61,25 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Update Pip - run: | - python -m pip install --user --upgrade pip + - name: Install uv + uses: astral-sh/setup-uv@v4 - - name: Install package - run: python -m pip install --user ".[test]" + - name: Install package (Linux or macOS) + if: runner.os != 'Windows' + run: | + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install ".[test]" - ## Unit tests of private Spot REST clients and endpoints - ## - - name: Testing Spot REST endpoints - 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 + - name: Install package (Windows) + if: runner.os == 'Windows' + run: | + uv venv + .venv\Scripts\activate.ps1 + echo "$env:GITHUB_WORKSPACE\.venv\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + uv pip install ".[test]" - ## Unit tests of Spot websocket clients - ## - name: Testing Spot websocket client env: SPOT_API_KEY: ${{ secrets.SPOT_API_KEY }} diff --git a/.github/workflows/_test_spot_public.yaml b/.github/workflows/_test_spot_public.yaml index c666b3a..ae50d0f 100644 --- a/.github/workflows/_test_spot_public.yaml +++ b/.github/workflows/_test_spot_public.yaml @@ -38,6 +38,7 @@ jobs: api.kraken.com:443 files.pythonhosted.org:443 github.com:443 + objects.githubusercontent.com:443 pypi.org:443 - name: Checkout repository @@ -48,14 +49,24 @@ jobs: with: python-version: ${{ inputs.python-version }} - - name: Update Pip + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Install package (Linux or macOS) + if: runner.os != 'Windows' run: | - python -m pip install --user --upgrade pip + uv venv + source .venv/bin/activate + echo ${GITHUB_WORKSPACE}/.venv/bin >> $GITHUB_PATH + uv pip install ".[test]" - - name: Install package - run: python -m pip install --user ".[test]" + - name: Install package (Windows) + if: runner.os == 'Windows' + run: | + uv venv + .venv\Scripts\activate.ps1 + echo "$env:GITHUB_WORKSPACE\.venv\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + uv pip install ".[test]" - ## 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 diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 901361f..02baed4 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- Copyright (C) -# 2023 Benjamin Thomas Schwertfeger GitHub: -# https://github.com/btschwertfeger +# 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. @@ -57,7 +57,7 @@ on: # only run once due to API rate limits concurrency: - group: CICD + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: @@ -117,7 +117,6 @@ jobs: ## ## (private endpoints) Test-Spot-Private: - if: success() && github.actor == 'btschwertfeger' needs: [Pre-Commit] uses: ./.github/workflows/_test_spot_private.yaml strategy: @@ -150,7 +149,6 @@ jobs: ## ## (private endpoints) Test-NFT-Private: - if: success() && github.actor == 'btschwertfeger' needs: [Test-Spot-Private] uses: ./.github/workflows/_test_nft_private.yaml strategy: @@ -182,7 +180,6 @@ jobs: ## ## (private endpoints) Test-Futures-Private: - if: success() && github.actor == 'btschwertfeger' needs: [Pre-Commit] uses: ./.github/workflows/_test_futures_private.yaml strategy: @@ -222,11 +219,7 @@ jobs: ## UploadTestPyPI: if: | - ( - success() - && github.actor == 'btschwertfeger' - && github.ref == 'refs/heads/master' - ) + (success() && github.ref == 'refs/heads/master') && (github.event_name == 'push' || github.event_name == 'release') needs: - Build @@ -243,9 +236,9 @@ jobs: ## UploadPyPI: if: | - success() && - github.actor == 'btschwertfeger' && - github.event_name == 'release' + success() + && github.actor == 'btschwertfeger' + && github.event_name == 'release' needs: - Build - Build-Doc diff --git a/.github/workflows/dependabot_auto_merge.yaml b/.github/workflows/dependabot_auto_merge.yaml index 8205de4..57e007f 100644 --- a/.github/workflows/dependabot_auto_merge.yaml +++ b/.github/workflows/dependabot_auto_merge.yaml @@ -5,7 +5,7 @@ # Workflow that approves and merges all pull requests from the dependabot[bot] # author. # -# Source (May, 2024): +# Original source (May, 2024): # - https://blog.somewhatabstract.com/2021/10/11/setting-up-dependabot-with-github-actions-to-approve-and-merge/ name: Dependabot auto-merge @@ -23,7 +23,11 @@ jobs: - name: Harden Runner uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 with: - egress-policy: audit + disable-sudo: true + egress-policy: block + allowed-endpoints: > + api.github.com:443 + github.com:443 - name: Dependabot metadata id: dependabot-metadata diff --git a/CHANGELOG.md b/CHANGELOG.md index 92e9d92..e9d308e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,44 @@ # Changelog +## [Unreleased](https://github.com/btschwertfeger/python-kraken-sdk/tree/HEAD) + +[Full Changelog](https://github.com/btschwertfeger/python-kraken-sdk/compare/v3.1.1...HEAD) + +**Fixed bugs:** + +- Resolve "Spot websocket clients broken due to new websockets release" [\#309](https://github.com/btschwertfeger/python-kraken-sdk/pull/309) ([btschwertfeger](https://github.com/btschwertfeger)) + +Uncategorized merged pull requests: + +- Resolve "Trusted publishing not working with reusable workflows" [\#312](https://github.com/btschwertfeger/python-kraken-sdk/pull/312) ([btschwertfeger](https://github.com/btschwertfeger)) +- Add timeout to CI jobs [\#306](https://github.com/btschwertfeger/python-kraken-sdk/pull/306) ([btschwertfeger](https://github.com/btschwertfeger)) +- Bump codecov/codecov-action from 4.6.0 to 5.0.2 [\#305](https://github.com/btschwertfeger/python-kraken-sdk/pull/305) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump github/codeql-action from 3.27.1 to 3.27.4 [\#304](https://github.com/btschwertfeger/python-kraken-sdk/pull/304) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump github/codeql-action from 3.27.0 to 3.27.1 [\#302](https://github.com/btschwertfeger/python-kraken-sdk/pull/302) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump pypa/gh-action-pypi-publish from 1.11.0 to 1.12.2 [\#301](https://github.com/btschwertfeger/python-kraken-sdk/pull/301) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Fix test [\#300](https://github.com/btschwertfeger/python-kraken-sdk/pull/300) ([btschwertfeger](https://github.com/btschwertfeger)) +- Bump pypa/gh-action-pypi-publish from 1.10.3 to 1.11.0 [\#299](https://github.com/btschwertfeger/python-kraken-sdk/pull/299) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump actions/dependency-review-action from 4.3.4 to 4.4.0 [\#298](https://github.com/btschwertfeger/python-kraken-sdk/pull/298) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump actions/setup-python from 5.2.0 to 5.3.0 [\#297](https://github.com/btschwertfeger/python-kraken-sdk/pull/297) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump github/codeql-action from 3.26.13 to 3.27.0 [\#296](https://github.com/btschwertfeger/python-kraken-sdk/pull/296) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump actions/checkout from 4.2.1 to 4.2.2 [\#295](https://github.com/btschwertfeger/python-kraken-sdk/pull/295) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump github/codeql-action from 3.26.11 to 3.26.13 [\#293](https://github.com/btschwertfeger/python-kraken-sdk/pull/293) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump actions/checkout from 4.2.0 to 4.2.1 [\#291](https://github.com/btschwertfeger/python-kraken-sdk/pull/291) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump github/codeql-action from 3.26.9 to 3.26.11 [\#289](https://github.com/btschwertfeger/python-kraken-sdk/pull/289) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump codecov/codecov-action from 4.5.0 to 4.6.0 [\#288](https://github.com/btschwertfeger/python-kraken-sdk/pull/288) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump pypa/gh-action-pypi-publish from 1.10.2 to 1.10.3 [\#287](https://github.com/btschwertfeger/python-kraken-sdk/pull/287) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump github/codeql-action from 3.26.8 to 3.26.9 [\#286](https://github.com/btschwertfeger/python-kraken-sdk/pull/286) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump actions/checkout from 4.1.7 to 4.2.0 [\#285](https://github.com/btschwertfeger/python-kraken-sdk/pull/285) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Add CITATION file [\#284](https://github.com/btschwertfeger/python-kraken-sdk/pull/284) ([btschwertfeger](https://github.com/btschwertfeger)) +- Update project settings [\#283](https://github.com/btschwertfeger/python-kraken-sdk/pull/283) ([btschwertfeger](https://github.com/btschwertfeger)) +- Skip NFT auction unit tests [\#282](https://github.com/btschwertfeger/python-kraken-sdk/pull/282) ([btschwertfeger](https://github.com/btschwertfeger)) +- Bump github/codeql-action from 3.26.7 to 3.26.8 [\#281](https://github.com/btschwertfeger/python-kraken-sdk/pull/281) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump pypa/gh-action-pypi-publish from 1.10.1 to 1.10.2 [\#280](https://github.com/btschwertfeger/python-kraken-sdk/pull/280) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump github/codeql-action from 3.26.6 to 3.26.7 [\#278](https://github.com/btschwertfeger/python-kraken-sdk/pull/278) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump step-security/harden-runner from 2.9.1 to 2.10.1 [\#277](https://github.com/btschwertfeger/python-kraken-sdk/pull/277) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Rename CODEOWNERS file [\#276](https://github.com/btschwertfeger/python-kraken-sdk/pull/276) ([btschwertfeger](https://github.com/btschwertfeger)) +- Upgrade QA settings [\#275](https://github.com/btschwertfeger/python-kraken-sdk/pull/275) ([btschwertfeger](https://github.com/btschwertfeger)) + ## [v3.1.1](https://github.com/btschwertfeger/python-kraken-sdk/tree/v3.1.1) (2024-09-13) [Full Changelog](https://github.com/btschwertfeger/python-kraken-sdk/compare/v3.1.0...v3.1.1) diff --git a/CITATION b/CITATION index 194532c..6777bdc 100644 --- a/CITATION +++ b/CITATION @@ -7,3 +7,4 @@ authors: title: "python-kraken-sdk" doi: 10.5281/zenodo.7653259 url: "https://github.com/btschwertfeger/python-kraken-sdk" +keywords: ["Python", "Kraken", "cryptocurrency", "exchange", "API", "SDK"] diff --git a/pyproject.toml b/pyproject.toml index 9463edf..28c4600 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ requires-python = ">=3.11" dependencies = [ "asyncio>=3.4", "requests", - "websockets", + "websockets>=14", "click", "cloup", "orjson", @@ -75,7 +75,14 @@ dev = [ # linting "ruff", ] -test = ["pytest", "pytest-cov", "pytest-mock", "pytest-asyncio", "proxy.py"] +test = [ + "pytest", + "pytest-cov", + "pytest-mock", + "pytest-asyncio", + "pytest-timeout", + "proxy.py", +] examples = ["matplotlib", "pandas", "numpy"] jupyter = ["ipykernel"] # python3 -m ipykernel install --user --name=kraken @@ -102,7 +109,9 @@ testpaths = ["tests"] # filterwarnings = [ # "ignore:The Kraken websocket API v1 is marked as deprecated*:DeprecationWarning", # ] +asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" +timeout = 60 # seconds cache_dir = ".cache/pytest" markers = [ @@ -262,12 +271,12 @@ select = [ "T20", # flake8-print "TCH", # flake8-type-checking "TID", # flake8-tidy-imports - # "W", # pylint warning - # "D", # pydocstyle | sphinx format not supported - # "ERA", # eradicate - commented-out code - # "FIX", # flake8-fixme - # "TD", # flake8-todos - # "TRY", # tryceratops # specify exception messages in class; not important + # "W", # pylint warning + # "D", # pydocstyle | sphinx format not supported + # "ERA", # eradicate - commented-out code + # "FIX", # flake8-fixme + # "TD", # flake8-todos + # "TRY", # tryceratops # specify exception messages in class; not important ] fixable = ["ALL"] diff --git a/tests/spot/helper.py b/tests/spot/helper.py index 5f0caac..83d1ee5 100644 --- a/tests/spot/helper.py +++ b/tests/spot/helper.py @@ -107,7 +107,7 @@ def ensure_log(cls, content: dict | list) -> None: pass with Path(CACHE_DIR / "spot_orderbook.log").open( - mode="w", + mode="a", encoding="utf-8", ) as logfile: logfile.write(f"{log}\n{json.dumps(content)}") diff --git a/tests/spot/test_spot_orderbook.py b/tests/spot/test_spot_orderbook.py index 1c241cd..063b4e1 100644 --- a/tests/spot/test_spot_orderbook.py +++ b/tests/spot/test_spot_orderbook.py @@ -131,26 +131,25 @@ def test_add_book(caplog: pytest.LogCaptureFixture) -> None: """ async def execute_add_book() -> None: - orderbook = SpotOrderBookClientWrapper() - await orderbook.start() + async with SpotOrderBookClientWrapper() as orderbook: - await orderbook.add_book(pairs=["BTC/USD"]) - await async_sleep(2) + await orderbook.add_book(pairs=["BTC/USD"]) + await async_sleep(2) - book: dict | None = orderbook.get(pair="BTC/USD") - assert isinstance(book, dict) + book: dict | None = orderbook.get(pair="BTC/USD") + assert isinstance(book, dict) - assert all( - key in book - for key in ("ask", "bid", "valid", "price_decimals", "qty_decimals") - ), book + assert all( + key in book + for key in ("ask", "bid", "valid", "price_decimals", "qty_decimals") + ), book - assert isinstance(book["ask"], OrderedDict) - assert isinstance(book["bid"], OrderedDict) + assert isinstance(book["ask"], OrderedDict) + assert isinstance(book["bid"], OrderedDict) - for ask, bid in zip(book["ask"], book["bid"], strict=True): - assert isinstance(ask, str) - assert isinstance(bid, str) + for ask, bid in zip(book["ask"], book["bid"], strict=True): + assert isinstance(ask, str) + assert isinstance(bid, str) asyncio.run(execute_add_book())