Skip to content

Commit

Permalink
Merge pull request #10 from baking-bad/aux/1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout authored Mar 7, 2024
2 parents 1b99e31 + 00649b5 commit 24edac7
Show file tree
Hide file tree
Showing 18 changed files with 818 additions and 832 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,25 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Set up Poetry
uses: snok/install-poetry@v1
with:
version: '1.3.2'

- name: Install project
run: make install
run: poetry install
- name: Run lint
run: make lint
run: poetry run make lint
- name: Run tests
run: make test
run: poetry run make test

- name: Publish package on PyPi
run: |
poetry config http-basic.pypi __token__ ${{secrets.PYPI_TOKEN}}
poetry build
poetry publish
# FIXME: Fails on prereleases; https://github.com/mindsers/changelog-reader-action/pull/39
- name: Parse changelog
id: changelog
uses: mindsers/changelog-reader-action@v2
Expand All @@ -53,5 +52,5 @@ jobs:
## ${{ steps.changelog.outputs.version }} - ${{ steps.changelog.outputs.date }}
${{ steps.changelog.outputs.changes }}
draft: true
draft: false
prerelease: ${{ steps.changelog.outputs.status == 'prereleased' }}
26 changes: 22 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,32 @@ jobs:
strategy:
matrix:
include:
# Architectures
- os: ubuntu-latest
arch: amd64
python-version: '3.12'
- os: ubuntu-latest
arch: arm64
python-version: '3.12'
- os: macos-latest
arch: amd64
python-version: '3.12'
- os: macos-latest
arch: arm64
python-version: '3.12'
# Python versions
- os: ubuntu-latest
arch: amd64
python-version: '3.8'
- os: ubuntu-latest
arch: amd64
python-version: '3.9'
- os: ubuntu-latest
arch: amd64
python-version: '3.10'
- os: ubuntu-latest
arch: amd64
python-version: '3.11'
steps:
- name: Check out the repo
uses: actions/checkout@v3
Expand All @@ -36,12 +54,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: ${{ matrix.python-version }}
cache: 'poetry'

- name: Install project
run: make install
run: poetry install
- name: Run lint
run: make lint
run: poetry run make lint
- name: Run tests
run: make test
run: poetry run make test
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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].

## [Unreleased]
## [1.0.0] - 2024-03-07

### Added

Expand Down
33 changes: 7 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,55 +3,36 @@
##
## 🚧 pysignalr developer tools
##
## DEV=1 Install dev dependencies
DEV=1

##

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`
make lint test docs

lint: ## Lint with all tools
make isort black ruff mypy
make black ruff mypy

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

##

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

black: ## Format with black
poetry run black src tests example.py
black src tests example.py

ruff: ## Lint with ruff
poetry run ruff check src tests example.py
ruff check --fix --unsafe-fixes src tests example.py

mypy: ## Lint with mypy
poetry run mypy --strict src tests example.py
mypy --strict src tests example.py

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
diff-cover --compare-branch `git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'` coverage.xml

##

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

update: ## Update dependencies, export requirements.txt
rm requirements.* poetry.lock
make install
poetry export --without-hashes -o requirements.txt

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# pysignalr

[![GitHub stars](https://img.shields.io/github/stars/baking-bad/pysignalr?color=2c2c2c)](https://github.com/baking-bad/pysignalr)
[![GitHub stars](https://img.shields.io/github/stars/baking-bad/pysignalr?color=2c2c2c&style=plain)](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)
Expand Down Expand Up @@ -60,7 +60,7 @@ with suppress(KeyboardInterrupt, asyncio.CancelledError):
asyncio.run(main())
```

## Roadmap to the stable release
## Roadmap

- [ ] More documentation, both internal and user.
- [ ] Integration tests with containerized ASP hello-world server.
Expand Down
6 changes: 3 additions & 3 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

import asyncio
from contextlib import suppress
from typing import Any
from typing import Dict
from typing import List

from pysignalr.client import SignalRClient
from pysignalr.messages import CompletionMessage
Expand All @@ -16,7 +16,7 @@ async def on_close() -> None:
print('Disconnected from the server')


async def on_message(message: List[Dict[str, Any]]) -> None:
async def on_message(message: list[dict[str, Any]]) -> None:
print(f'Received message: {message}')


Expand Down
Loading

0 comments on commit 24edac7

Please sign in to comment.