Skip to content

Commit

Permalink
Merge pull request #69 from dapper91/dev
Browse files Browse the repository at this point in the history
- python 3.10 support added
- pipenv replaced by poetry
- mypy type checker added
- kombu client hanging bug fixed
- openapi json-rpc versions reordered so that version 2.0 will be the default example version
- set_default_content_type function exposed
- documentation fixed
  • Loading branch information
dapper91 committed May 22, 2022
2 parents 74455c7 + 68d17db commit dc5cb36
Show file tree
Hide file tree
Showing 98 changed files with 1,688 additions and 998 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ jobs:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python -m pip install --upgrade pip poetry
poetry install
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
python setup.py sdist
twine upload dist/*
poetry build
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
13 changes: 7 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -24,12 +24,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv --upgrade
pipenv install --python ${{ matrix.python-version }} --dev
- name: Run linter
run: pipenv run flake8 .
pip install poetry
poetry install --no-root -E aiohttp -E flask -E httpx -E jsonschema -E pydantic -E requests \
-E docstring-parser -E werkzeug -E openapi-ui-bundles
- name: Run pre-commit hooks
run: poetry run pre-commit run --hook-stage merge-commit --all-files
- name: Run tests
run: PYTHONPATH="$(pwd):$PYTHONPATH" pipenv run py.test --cov=pjrpc --cov-report=xml tests
run: PYTHONPATH="$(pwd):$PYTHONPATH" poetry run py.test --cov=pjrpc --cov-report=xml tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ venv.bak/
.mypy_cache/

.idea

poetry.lock
71 changes: 46 additions & 25 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,73 @@
default_stages:
- commit
- merge-commit

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-docstring-first
stages:
- commit
- push
- id: check-merge-conflict
stages:
- push
- id: check-yaml
- id: check-toml
- id: trailing-whitespace
stages:
- commit
- push
- id: end-of-file-fixer
stages:
- commit
- push
- id: mixed-line-ending
name: fix line ending
stages:
- commit
- push
args:
- --fix=lf
- id: no-commit-to-branch
- id: mixed-line-ending
name: check line ending
stages:
- merge-commit
args:
- --fix=no
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.1
hooks:
- id: add-trailing-comma
stages:
- commit
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.5.7
rev: v1.6.0
hooks:
- id: autopep8
stages:
- commit
- push
args:
- --max-line-length=120
- --diff
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.1.0
hooks:
- id: add-trailing-comma
stages:
- commit
- push
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: fix import order
stages:
- commit
args:
- --line-length=120
- --multi-line=9
- --project=pjrpc
- id: isort
name: check import order
stages:
- merge-commit
args:
- --check-only
- --line-length=120
- --multi-line=9
- --project=pjrpc
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
hooks:
- id: mypy
stages:
- commit
- push
name: mypy
pass_filenames: false
args: ["--package", "pjrpc"]
18 changes: 18 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-20.04
tools:
python: "3.9"

sphinx:
configuration: docs/source/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- docgen
12 changes: 12 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Changelog
=========


1.5.0 (2022-05-22)
------------------

- python 3.10 support added
- pipenv replaced by poetry
- mypy type checker added
- kombu client hanging bug fixed
- openapi json-rpc versions reordered so that version 2.0 will be the default example version
- set_default_content_type function exposed
- documentation fixed

1.4.1 (2022-03-06)
------------------

Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

14 changes: 4 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@

init:
pip install pipenv --upgrade
pipenv install --dev
pip install poetry --upgrade
poetry install --no-root

test:
pipenv run py.test
poetry run py.test

coverage:
pipenv run py.test --verbose --cov-report term --cov=pjrpc tests

publish:
pip install twine
python setup.py sdist
twine upload dist/*
rm -fr build dist .egg requests.egg-info
poetry run py.test --verbose --cov-report term --cov=pjrpc tests

check-code:
pre-commit run --all-file
Expand Down
31 changes: 0 additions & 31 deletions Pipfile

This file was deleted.

8 changes: 0 additions & 8 deletions docs/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion docs/source/_static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
padding: 1.5em 0em 1.5em;
}

.py.method, .py.property, .py.exception, .py.function {
.py.data, .py.method, .py.property, .py.exception, .py.function {
padding: 0.5em 0em 0.5em;
}
20 changes: 16 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.

import enum
import os
import sys
from pathlib import Path

sys.path.insert(0, os.path.abspath('..'))

import pjrpc # noqa
THIS_PATH = Path(__file__).parent
sys.path.insert(0, str(THIS_PATH.parent.parent))

import pjrpc.common.typedefs # noqa
import pjrpc.server.typedefs # noqa

# -- Project information -----------------------------------------------------

Expand Down Expand Up @@ -81,7 +82,18 @@

autodoc_mock_imports = ['attrs']
autodoc_typehints = 'description'
autodoc_typehints_format = 'short'
autodoc_member_order = 'bysource'
autodoc_default_options = {
'show-inheritance': True,
}
autodoc_type_aliases = {
type_name: f'{pjrpc.common.typedefs.__name__}.{type_name}'
for type_name in pjrpc.common.typedefs.__all__
} | {
type_name: f'{pjrpc.server.typedefs.__name__}.{type_name}'
for type_name in pjrpc.server.typedefs.__all__
}


def maybe_skip_member(app, what, name, obj, skip, options):
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The API Documentation
.. toctree::
:maxdepth: 3

pjrpc/api
pjrpc/api/index


Development
Expand Down
36 changes: 36 additions & 0 deletions docs/source/pjrpc/api/client.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. _api_client:

Client
------


.. automodule:: pjrpc.client
:members:

Backends
~~~~~~~~

.. automodule:: pjrpc.client.backend.requests
:members:

.. automodule:: pjrpc.client.backend.aiohttp
:members:

.. automodule:: pjrpc.client.backend.kombu
:members:

.. automodule:: pjrpc.client.backend.aio_pika
:members:

Tracer
~~~~~~

.. automodule:: pjrpc.client.tracer
:members:


Integrations
~~~~~~~~~~~~

.. automodule:: pjrpc.client.integrations.pytest
:members:
28 changes: 28 additions & 0 deletions docs/source/pjrpc/api/common.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. _api_common:

Common
------


.. automodule:: pjrpc.common
:members:


Types
~~~~~

.. automodule:: pjrpc.common.typedefs
:members:


Exceptions
~~~~~~~~~~

.. automodule:: pjrpc.common.exceptions
:members:

Identifier generators
~~~~~~~~~~~~~~~~~~~~~

.. automodule:: pjrpc.common.generators
:members:
Loading

0 comments on commit dc5cb36

Please sign in to comment.