Skip to content

Commit

Permalink
Merge pull request #5 from baking-bad/aux/january-refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout authored Apr 7, 2023
2 parents 166f4ea + 7c0d52d commit 6865ba1
Show file tree
Hide file tree
Showing 19 changed files with 1,278 additions and 1,066 deletions.
45 changes: 31 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ name: Release
on:
push:
tags:
- "*.*.*"
- '*.*.*'

jobs:
release:
name: Release
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Set up Poetry
uses: snok/install-poetry@v1
with:
python-version: "3.8.x"
- uses: snok/[email protected]
version: '1.3.2'

- name: Install project
run: make install
Expand All @@ -24,17 +29,29 @@ jobs:
- name: Run tests
run: make test

- name: Set up enviroment
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/}

- name: Publish package on PyPi
run: |
poetry config http-basic.pypi __token__ ${{secrets.PYPI_TOKEN}}
poetry build
poetry publish
- name: Parse changelog
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ github.ref_name }}

- name: Publish GitHub release
uses: "marvinpinto/action-automatic-releases@latest"
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
tag_name: ${{ github.ref_name }}
release_name: ${{ steps.changelog.outputs.version }}
body: |
## ${{ steps.changelog.outputs.version }} - ${{ steps.changelog.outputs.date }}
${{ steps.changelog.outputs.changes }}
draft: true
prerelease: ${{ steps.changelog.outputs.status == 'prereleased' }}
39 changes: 33 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,43 @@
name: Test
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
paths:
- 'src/**'
- 'tests/**'
- 'pyproject.toml'
- 'poetry.lock'
- '.github/workflows/test.yml'

jobs:
test:
name: Test
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: amd64
- os: ubuntu-latest
arch: arm64
- os: macos-latest
arch: amd64
- os: macos-latest
arch: arm64
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Check out the repo
uses: actions/checkout@v3

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8.x"
- uses: snok/install-poetry@v1.1.7
python-version: '3.11'
cache: 'poetry'

- name: Install project
run: make install
Expand Down
46 changes: 38 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,55 @@
# Changelog

## 0.1.2 - 2022-05-24
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].

## [0.2.0] - 2023-04-07

### Added

- Python 3.11 support.
- macOS and arm64 support.

### Fixed

- Fixed client streaming methods.

### Other

- `websockets` library updated to 10.4.

## [0.1.2] - 2022-05-24

### Improved

* Now `max_size` argument can be None to disable message size limit.
- Now `max_size` argument can be None to disable message size limit.

### Fixed

* Fixed crash with `Cannot connect while not disconnected`.
- Fixed crash with "Cannot connect while not disconnected".

### Other

* `websockets` library updated to `10.3`
- `websockets` library updated to 10.3.

## 0.1.1 - 2022-01-06
## [0.1.1] - 2022-01-06

### Fixed

* Fixed exceptions raised on server error
- Fixed exceptions raised on server error.

## [0.1.0] - 2021-11-22

Initial release.

## 0.1.0 - 2021-11-22
<!-- Links -->
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
[semantic versioning]: https://semver.org/spec/v2.0.0.html

Initial release.
<!-- Versions -->
[Unreleased]: https://github.com/dipdup-io/dipdup/compare/0.2.0...HEAD
[0.2.0]: https://github.com/dipdup-io/dipdup/compare/0.1.2...0.2.0
[0.1.2]: https://github.com/dipdup-io/dipdup/compare/0.1.1...0.1.2
[0.1.1]: https://github.com/dipdup-io/dipdup/compare/0.1.0...0.1.1
[0.1.0]: https://github.com/dipdup-io/dipdup/releases/tag/0.1.0
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Lev Gorodetskiy, Baking Bad
Copyright (c) 2021 Lev Gorodetskii, Baking Bad
Copyright (c) 2019 Andrés Baamonde Lozano

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
75 changes: 41 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,57 @@
.ONESHELL:
.PHONY: docs
.DEFAULT_GOAL: all

.PHONY: $(MAKECMDGOALS)
##
## 🚧 pysignalr developer tools
##
## DEV=1 Install dev dependencies
DEV=1
TAG=latest

all: install lint test cover
lint: isort black flake mypy
##

help: ## Show this help (default)
@grep -F -h "##" $(MAKEFILE_LIST) | grep -F -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

all: ## Run a whole CI pipeline: formatters, linters and tests
make install lint test docs

install: ## Install project dependencies
poetry install \
`if [ "${DEV}" = "0" ]; then echo "--without dev"; fi`

install:
poetry install `if [ "${DEV}" = "0" ]; then echo "--no-dev"; fi`
lint: ## Lint with all tools
make isort black ruff mypy

isort:
poetry run isort src tests
test: ## Run test suite
poetry run pytest --cov-report=term-missing --cov=pysignalr --cov-report=xml -s -v tests

black:
poetry run black src tests
##

flake:
poetry run flakehell lint src tests
isort: ## Format with isort
poetry run isort src tests example.py

mypy:
# poetry run mypy src tests --strict --implicit-reexport
poetry run mypy src tests
black: ## Format with black
poetry run black src tests example.py

test:
poetry run pytest --cov-report=term-missing --cov=pysignalr --cov-report=xml -v tests
ruff: ## Lint with ruff
poetry run ruff check src tests example.py

cover:
poetry run diff-cover coverage.xml
mypy: ## Lint with mypy
poetry run mypy --strict src tests example.py

build:
cover: ## Print coverage for the current branch
poetry run diff-cover --compare-branch `git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'` coverage.xml

build: ## Build Python wheel package
poetry build

release-patch:
bumpversion patch
git push --tags
git push
##

clean: ## Remove all files from .gitignore except for `.venv`
git clean -xdf --exclude=".venv"
rm -r ~/.cache/flakeheaven

release-minor:
bumpversion minor
git push --tags
git push
update: ## Update dependencies, export requirements.txt
rm requirements.* poetry.lock
make install
poetry export --without-hashes -o requirements.txt

release-major:
bumpversion major
git push --tags
git push
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
# pysignalr
[![Pypi](https://img.shields.io/pypi/v/pysignalr.svg)](https://pypi.org/project/pysignalr/)

**pysignalr** is a modern, reliable and async-ready client for [SignalR protocol](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-5.0). This project started as an asyncio fork of mandrewcito's [signalrcore](https://github.com/mandrewcito/signalrcore) library.
[![GitHub stars](https://img.shields.io/github/stars/baking-bad/pysignalr?color=2c2c2c)](https://github.com/baking-bad/pysignalr)
[![Latest stable release](https://img.shields.io/github/v/release/baking-bad/pysignalr?label=stable%20release&color=2c2c2c)](https://github.com/baking-bad/pysignalr/releases)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pysignalr?color=2c2c2c)](https://www.python.org)
[![License: MIT](https://img.shields.io/github/license/baking-bad/pysignalr?color=2c2c2c)](https://github.com/baking-bad/pysignalr/blob/master/LICENSE)
<br>
[![PyPI monthly downloads](https://img.shields.io/pypi/dm/pysignalr?color=2c2c2c)](https://pypi.org/project/pysignalr/)
[![GitHub issues](https://img.shields.io/github/issues/baking-bad/pysignalr?color=2c2c2c)](https://github.com/baking-bad/pysignalr/issues)
[![GitHub pull requests](https://img.shields.io/github/issues-pr/baking-bad/pysignalr?color=2c2c2c)](https://github.com/baking-bad/pysignalr/pulls)

**pysignalr** is a modern, reliable, and async-ready client for [SignalR protocol](https://docs.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-5.0). This project started as an asyncio fork of mandrewcito's [signalrcore](https://github.com/mandrewcito/signalrcore) library and ended up as a complete rewrite.

## Usage

Let's connect to [TzKT](https://tzkt.io/), indexer and explorer of Tezos blockchain, and subscribe to all operations:
Let's connect to [TzKT](https://tzkt.io/), an API and block explorer of Tezos blockchain, and subscribe to all operations:

```python
import asyncio
from contextlib import suppress
from typing import Any, Dict, List
from typing import Any
from typing import Dict
from typing import List

from pysignalr.client import SignalRClient
from pysignalr.messages import CompletionMessage

Expand All @@ -31,8 +42,8 @@ async def on_error(message: CompletionMessage) -> None:
print(f'Received error: {message.error}')


async def main():
client = SignalRClient('https://api.tzkt.io/v1/events')
async def main() -> None:
client = SignalRClient('https://api.tzkt.io/v1/ws')

client.on_open(on_open)
client.on_close(on_close)
Expand Down
9 changes: 6 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import asyncio
from contextlib import suppress
from typing import Any, Dict, List
from typing import Any
from typing import Dict
from typing import List

from pysignalr.client import SignalRClient
from pysignalr.messages import CompletionMessage

Expand All @@ -21,8 +24,8 @@ async def on_error(message: CompletionMessage) -> None:
print(f'Received error: {message.error}')


async def main():
client = SignalRClient('https://api.tzkt.io/v1/events')
async def main() -> None:
client = SignalRClient('https://api.tzkt.io/v1/ws')

client.on_open(on_open)
client.on_close(on_close)
Expand Down
5 changes: 0 additions & 5 deletions mypy.ini

This file was deleted.

Loading

0 comments on commit 6865ba1

Please sign in to comment.