Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/poetry second try #62

Merged
merged 5 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 49 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,80 @@ name: tests

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
lint:

runs-on: ubuntu-latest

strategy:
matrix:
linter:
- lint
- ruff
- mypy

steps:
- uses: actions/checkout@v2
- name: tox ${{ matrix.linter }}
uses: docker://snakepacker/python:all
env:
TOXENV: ${{ matrix.linter }}
- name: Setup python3.11
uses: actions/setup-python@v2
with:
args: tox
python-version: "3.11"
- name: Cache virtualenv
id: venv-cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}
- run: python -m pip install poetry
- run: poetry install
- run: poetry run ${{ matrix.linter }} wsrpc_aiohttp
env:
FORCE_COLOR: 1

build:
tests:
needs: lint
runs-on: ubuntu-latest

strategy:
fail-fast: false

matrix:
toxenv:
- py37
- py38
- py39
- py310
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"

steps:
- uses: actions/checkout@v2
- name: Setup python${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python }}"
- name: Cache virtualenv
id: venv-cache
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ github.job }}-${{ github.ref }}-${{ matrix.python }}
- run: python -m pip install poetry
- run: poetry install --with=uvloop
- name: pytest
run: >-
poetry run pytest \
-vv \
--cov=wsrpc_aiohttp \
--cov-report=term-missing \
--doctest-modules \
tests
env:
FORCE_COLOR: 1

- name: tox ${{ matrix.toxenv }}
uses: docker://snakepacker/python:all
- run: poetry run coveralls
env:
TOXENV: ${{ matrix.toxenv }}
COVERALLS_PARALLEL: "true"
COVERALLS_SERVICE_NAME: github
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
with:
args: tox
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

7 changes: 3 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from datetime import datetime
from importlib.machinery import SourceFileLoader


sys.path.insert(0, os.path.abspath(os.path.dirname("__file__")))

PROJECT_PATH = os.path.abspath(
Expand Down Expand Up @@ -142,7 +141,7 @@
"""-8-8z"></path></svg>"""
),
"class": "",
},
}
],
}

Expand Down Expand Up @@ -187,7 +186,7 @@
"wsrpc-aiohttp Documentation",
"Dmitry Orlov",
"manual",
),
)
]


Expand All @@ -214,7 +213,7 @@
"wsrpc-aiohttp",
"One line description of project.",
"Miscellaneous",
),
)
]

# -- Options for Epub output ----------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples/main/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import uuid

import aiohttp.web
from wsrpc_aiohttp import STATIC_DIR, WebSocketAsync

from wsrpc_aiohttp import STATIC_DIR, WebSocketAsync

loop = asyncio.get_event_loop()
app = aiohttp.web.Application()
Expand Down
4 changes: 2 additions & 2 deletions docs/source/examples/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from random import choice

import aiohttp.web
from wsrpc_aiohttp import STATIC_DIR, WebSocketAsync, WebSocketRoute

from wsrpc_aiohttp import STATIC_DIR, WebSocketAsync, WebSocketRoute

loop = asyncio.get_event_loop()
log = logging.getLogger(__name__)
Expand Down Expand Up @@ -52,7 +52,7 @@ async def _secure_method(self):
return "WTF???"

async def exc(self):
raise Exception(u"Test Тест テスト 测试")
raise Exception("Test Тест テスト 测试")

async def getJoke(self):
joke = choice(self.JOKES)
Expand Down
1,598 changes: 1,598 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cache-dir = ".cache"

[virtualenvs]
in-project = true
path = ".venv"
6 changes: 0 additions & 6 deletions pylama.ini

This file was deleted.

88 changes: 88 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
[tool.poetry]
name = "wsrpc-aiohttp"
version = "4.0.2"
description = "WSRPC is the RPC over WebSocket for aiohttp"
authors = ["Dmitry Orlov <[email protected]>"]
readme = "README.md"
license = "Apache-2.0"
keywords=[
"wsrpc", "websocket", "rpc", "json-rpc", "js", "typescript", "javascript"
]
homepage = "https://github.com/wsrpc/wsrpc-aiohttp"
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Topic :: Internet",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: POSIX",
"Operating System :: Microsoft",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
]
packages = [{ include = "wsrpc_aiohttp" }]

[tool.poetry.urls]
"Source" = "https://github.com/wsrpc/wsrpc-aiohttp"
"Tracker" = "https://github.com/wsrpc/wsrpc-aiohttp/issues"
"Documentation" = "https://wsrpc.readthedocs.io/en/latest/"

[tool.poetry.dependencies]
python = "^3.8"
aiohttp = "<4"
yarl = [{ version = '*'}]
typing_extensions = [{ version = '*', python = "<3.10" }]

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
mypy = "^1.5.1"
types-setuptools = "^65.6.0.2"
async-timeout = "^4.0.2"
coverage = "!=4.3"
coveralls = "^3.3.1"
nox = "^2022.11.21"
orjson = "^3.8.3"
pytest-aiohttp = "^1.0.4"
pytest-cov = "^4.0.0"
requests = "^2.28.1"
sphinx = "^5.3.0"
ruff = "^0.0.286"
black = "^23.7.0"

[tool.poetry.group.uvloop.dependencies]
uvloop = "^0.17.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 80
target-version = ["py38", "py39", "py310", "py311"]
skip-magic-trailing-comma = true

[tool.ruff]
line-length = 80
target-version = "py38"
fix = true

select = [
"E", # pycodestyle (error)
"F", # pyflakes
"I" # isort
]

ignore = [
"C901" # Function is too complex
]

[tool.ruff.isort]
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[pytest]
asyncio_mode = auto
python_files = test_*
python_functions = test_*
python_classes = TestSuite*
72 changes: 0 additions & 72 deletions setup.py

This file was deleted.

6 changes: 4 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def socket_path():
loads=orjson.loads,
dumps=lambda x, **kw: orjson.dumps(x, **kw).decode(),
),
], ids=["json", "orjson"],
],
ids=["json", "orjson"],
)
def application(request, handler, socket_path):
app = Application()
Expand All @@ -46,7 +47,8 @@ async def session(aiohttp_client, application) -> ClientSession:
loads=orjson.loads,
dumps=lambda x, **kw: orjson.dumps(x, **kw).decode(),
),
], ids=["json", "orjson"],
],
ids=["json", "orjson"],
)
async def client(request, session: ClientSession, socket_path) -> WSRPCClient:
return WSRPCClient(socket_path, session=session, **request.param)
5 changes: 1 addition & 4 deletions tests/test_frames_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@
async def test_frames_are_sent_in_correct_order(client: WSRPCClient):
async with client:
data = "hello, world" * 1024
coros = [
client.call("ping", data=data)
for _ in range(100)
]
coros = [client.call("ping", data=data) for _ in range(100)]
await asyncio.gather(*coros)
Loading
Loading