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

Pin all the things #196

Merged
merged 117 commits into from Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
2abc387
Pin all the things
Dreamsorcerer Oct 30, 2022
5adef8d
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
9945024
Update requirements.txt
Dreamsorcerer Oct 30, 2022
642a8b8
Create requirements.txt
Dreamsorcerer Oct 30, 2022
0f0453f
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
48e99aa
Create requirements.txt
Dreamsorcerer Oct 30, 2022
470c328
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
03b493d
Create requirements.txt
Dreamsorcerer Oct 30, 2022
9f3ae55
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
b4918a0
Create requirements.txt
Dreamsorcerer Oct 30, 2022
993032c
Update setup.py
Dreamsorcerer Oct 30, 2022
6b9a940
Update setup.py
Dreamsorcerer Oct 30, 2022
f5f8e92
Update setup.py
Dreamsorcerer Oct 30, 2022
fbc9e0c
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
88112a7
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
7e62fdb
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
f2d2787
Delete setup.cfg
Dreamsorcerer Oct 30, 2022
114069b
Create .flake8
Dreamsorcerer Oct 30, 2022
aa85a57
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
332e0e1
Update requirements.txt
Dreamsorcerer Oct 30, 2022
902dd0c
Update .flake8
Dreamsorcerer Oct 30, 2022
64b8730
Update prepare_database.py
Dreamsorcerer Oct 30, 2022
30f768d
Update app.py
Dreamsorcerer Oct 30, 2022
59d89f5
Update conftest.py
Dreamsorcerer Oct 30, 2022
cced244
Update dataloaders.py
Dreamsorcerer Oct 30, 2022
74ffa35
Update views.py
Dreamsorcerer Oct 30, 2022
dd8ecf3
Update contrib.py
Dreamsorcerer Oct 30, 2022
0cbc5c6
Update messages.py
Dreamsorcerer Oct 30, 2022
5d190c3
Update __init__.py
Dreamsorcerer Oct 30, 2022
6cf94d0
Update __init__.py
Dreamsorcerer Oct 30, 2022
47f659f
Update user.py
Dreamsorcerer Oct 30, 2022
6a6666d
Update room.py
Dreamsorcerer Oct 30, 2022
e30ac51
Update test_messages_mutations.py
Dreamsorcerer Oct 30, 2022
57f9378
Update test_messages.py
Dreamsorcerer Oct 30, 2022
1caeef0
Update test_rooms.py
Dreamsorcerer Oct 30, 2022
0ae2c11
Update messages.py
Dreamsorcerer Oct 30, 2022
4353650
Update __init__.py
Dreamsorcerer Oct 30, 2022
890d3d4
Update generate_data.py
Dreamsorcerer Oct 30, 2022
8f60c6d
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
1bca8f8
Update app.py
Dreamsorcerer Oct 30, 2022
75b124e
Update dataloaders.py
Dreamsorcerer Oct 30, 2022
19c5b86
Update views.py
Dreamsorcerer Oct 30, 2022
6eab99c
Update pytest.ini
Dreamsorcerer Oct 30, 2022
f7b5ced
Update pytest.ini
Dreamsorcerer Oct 30, 2022
531b12b
Update pytest.ini
Dreamsorcerer Oct 30, 2022
b55c353
Update pytest.ini
Dreamsorcerer Oct 30, 2022
a16c525
Create pytest.ini
Dreamsorcerer Oct 30, 2022
b2b91cb
Merge branch 'master' into Dreamsorcerer-patch-1
Dreamsorcerer Oct 30, 2022
36bebef
Update pytest.ini
Dreamsorcerer Oct 30, 2022
cb2b1e3
Update pytest.ini
Dreamsorcerer Oct 30, 2022
6e75af5
Update pytest.ini
Dreamsorcerer Oct 30, 2022
a367a6b
Update pytest.ini
Dreamsorcerer Oct 30, 2022
54ac836
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
3fef7df
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
c37f935
Update conftest.py
Dreamsorcerer Oct 30, 2022
1f6bd38
Update conftest.py
Dreamsorcerer Oct 30, 2022
05981fe
Update conftest.py
Dreamsorcerer Oct 30, 2022
2a3ad86
Create __init__.py
Dreamsorcerer Oct 30, 2022
27ead69
Update requirements.txt
Dreamsorcerer Oct 30, 2022
c196020
Update requirements.txt
Dreamsorcerer Oct 30, 2022
88e49d4
Update __init__.py
Dreamsorcerer Oct 30, 2022
dd3a5d3
Fix
Dreamsorcerer Oct 30, 2022
9228da8
Update worker.py
Dreamsorcerer Oct 30, 2022
30b050f
Update requirements.txt
Dreamsorcerer Oct 30, 2022
f638077
Update test_views.py
Dreamsorcerer Oct 30, 2022
2f0078c
Update ci.yml
Dreamsorcerer Oct 30, 2022
1c3c53e
Update worker.py
Dreamsorcerer Oct 30, 2022
af9e5d0
Update pytest.ini
Dreamsorcerer Oct 30, 2022
fe63815
Fix
Dreamsorcerer Oct 30, 2022
22c0b0e
Merge branch 'Dreamsorcerer-patch-1' of github.com:aio-libs/aiohttp-d…
Dreamsorcerer Oct 30, 2022
dd541b1
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
e110732
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
95702d2
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
0d914bf
Update requirements-dev.txt
Dreamsorcerer Oct 30, 2022
ab38d12
Update requirements-dev.txt
Dreamsorcerer Oct 31, 2022
1433974
Update requirements-dev.txt
Dreamsorcerer Oct 31, 2022
9796947
Update requirements-dev.txt
Dreamsorcerer Oct 31, 2022
3705913
Update requirements-dev.txt
Dreamsorcerer Oct 31, 2022
2c78e8c
Update requirements-dev.txt
Dreamsorcerer Oct 31, 2022
54cdb2e
Update requirements-dev.txt
Dreamsorcerer Oct 31, 2022
21e97b0
Update requirements-dev.txt
Dreamsorcerer Oct 31, 2022
8d68ba5
Update pytest.ini
Dreamsorcerer Oct 31, 2022
9bd75e9
Update worker.py
Dreamsorcerer Oct 31, 2022
5cce0f8
Update pytest.ini
Dreamsorcerer Oct 31, 2022
69a946e
Update utils.py
Dreamsorcerer Oct 31, 2022
730a0cf
Update conftest.py
Dreamsorcerer Nov 2, 2022
b286412
Update test_pipeline.py
Dreamsorcerer Nov 2, 2022
8840207
Update pytest.ini
Dreamsorcerer Nov 2, 2022
68e7023
Update pytest.ini
Dreamsorcerer Nov 2, 2022
e76e45d
Update requirements-dev.txt
Dreamsorcerer Nov 2, 2022
99be9b4
Update requirements-dev.txt
Dreamsorcerer Nov 2, 2022
1f0724a
Update pytest.ini
Dreamsorcerer Nov 2, 2022
4bc02ac
Update requirements-dev.txt
Dreamsorcerer Nov 2, 2022
83d1317
Update requirements-dev.txt
Dreamsorcerer Nov 2, 2022
ce4dc40
Update pytest.ini
Dreamsorcerer Nov 2, 2022
8225234
Update pytest.ini
Dreamsorcerer Nov 2, 2022
27a6791
Update test_basic.py
Dreamsorcerer Nov 2, 2022
54db7b9
Update pytest.ini
Dreamsorcerer Nov 2, 2022
e1860f7
Update pytest.ini
Dreamsorcerer Nov 2, 2022
a306ae1
Update views.py
Dreamsorcerer Nov 2, 2022
bb2cb01
Update pytest.ini
Dreamsorcerer Nov 3, 2022
3aa31aa
Update conftest.py
Dreamsorcerer Nov 3, 2022
f45dcc1
Update server.py
Dreamsorcerer Nov 3, 2022
916efd9
Update giphy.py
Dreamsorcerer Nov 3, 2022
63a7a39
Update handlers.py
Dreamsorcerer Nov 3, 2022
a5e0b94
Update utils.py
Dreamsorcerer Nov 3, 2022
10ae75a
Update server.py
Dreamsorcerer Nov 3, 2022
a213577
Update handlers.py
Dreamsorcerer Nov 3, 2022
b20fb40
Update pytest.ini
Dreamsorcerer Nov 3, 2022
2162c14
Update handlers.py
Dreamsorcerer Nov 3, 2022
bc638d6
Update pytest.ini
Dreamsorcerer Nov 3, 2022
171699b
Create test_motortwit.py
Dreamsorcerer Nov 3, 2022
12a0c3c
Update app.py
Dreamsorcerer Nov 3, 2022
2d9be90
Update conftest.py
Dreamsorcerer Nov 3, 2022
222e521
Create test_shortify.py
Dreamsorcerer Nov 7, 2022
42f82a1
Update app.py
Dreamsorcerer Nov 7, 2022
3ec1105
Update conftest.py
Dreamsorcerer Nov 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions .flake8
@@ -0,0 +1,17 @@
[flake8]
enable-extensions = G
max-doc-length = 90
max-line-length = 90
select = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,B901,B902,B903,B950
# E226: Missing whitespace around arithmetic operators can help group things together.
# E501: Superseeded by B950 (from Bugbear)
# E722: Superseeded by B001 (from Bugbear)
# W503: Mutually exclusive with W504.
# Q000: TODO: Code needs reformatting.
ignore = E226,E501,E722,W503,Q000
per-file-ignores =
# S101: Pytest uses assert
tests/*:S101

# flake8-quotes
inline-quotes = "
23 changes: 6 additions & 17 deletions .github/workflows/ci.yml
Expand Up @@ -18,14 +18,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v2.1.6
with:
path: ~/.cache/pip
key: ${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements*.txt') }}
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: |
make install
Expand Down Expand Up @@ -68,14 +65,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v2.1.6
with:
path: ~/.cache/pip
key: ${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements*.txt') }}
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: |
make install
Expand All @@ -89,11 +83,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache pip
uses: actions/cache@v2.1.6
with:
path: ~/.cache/pip
key: ${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements*.txt') }}
- name: Install sphinx
run: pip install sphinx
- name: Documentation
Expand Down
28 changes: 18 additions & 10 deletions Makefile
Expand Up @@ -6,11 +6,15 @@ lint:
@flake8 demos

test:
@pytest -q demos/polls/tests
@pytest -q demos/chat/tests
@pytest -q demos/blog/tests
@pytest -q demos/graphql-demo
@SLACK_BOT_TOKEN=xxx GIPHY_API_KEY=xxx pytest -q demos/moderator_bot/tests
@pytest demos/blog
@pytest demos/chat
@pytest demos/graphql-demo
@pytest demos/imagetagger
@pytest demos/moderator
@SLACK_BOT_TOKEN=xxx GIPHY_API_KEY=xxx pytest demos/moderator_bot/tests
@pytest demos/motortwit
@pytest demos/polls
@pytest demos/shortify

ci: lint test doc-spelling

Expand All @@ -23,11 +27,15 @@ doc-spelling:

install:
@pip install -U pip setuptools cython
@pip install -Ur requirements-dev.txt
@pip install demos/polls
@pip install demos/chat
@pip install demos/blog
@pip install demos/graphql-demo
@pip install -r requirements-dev.txt
@pip install -r demos/blog/requirements.txt
@pip install -r demos/chat/requirements.txt
@pip install -r demos/graphql-demo/requirements-dev.txt
@pip install -r demos/imagetagger/requirements.txt
@pip install -r demos/moderator/requirements-dev.txt
@pip install -r demos/moderator_bot/requirements-dev.txt
@pip install -r demos/motortwit/requirements.txt
@pip install -r demos/polls/requirements-dev.txt
@pip install -r demos/shortify/requirements.txt

.PHONY: clean doc
3 changes: 2 additions & 1 deletion demos/blog/pytest.ini
@@ -1,4 +1,4 @@
[tool:pytest]
[pytest]
addopts =
# show 10 slowest invocations:
--durations=10
Expand All @@ -11,6 +11,7 @@ addopts =

# show values of the local vars in errors:
--showlocals
asyncio_mode = auto
filterwarnings =
error
testpaths = tests/
Expand Down
17 changes: 13 additions & 4 deletions demos/blog/requirements.txt
@@ -1,6 +1,15 @@
-e .
aiohttp==3.8.3
aiohttp-jinja2==1.5
aiohttp_security[session]==0.4.0
asyncpg==0.27.0
asyncpgsa==0.27.1
bcrypt==4.0.1
pytoml==0.1.21
redis==4.3.4
sqlalchemy==1.4.42

# testing
pytest
pytest-aiohttp
flake8
pytest==7.2.0
pytest-aiohttp==1.0.4
pytest-asyncio==0.20.1
flake8==3.9.2
17 changes: 0 additions & 17 deletions demos/blog/setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion demos/blog/setup.py
Expand Up @@ -7,7 +7,7 @@
'bcrypt',
'pytoml',
'aiohttp_security[session]',
'redis==4.3.4',
'redis>=4.2',
'sqlalchemy',
'asyncpg',
'asyncpgsa',
Expand Down
1 change: 1 addition & 0 deletions demos/chat/pytest.ini
Expand Up @@ -11,6 +11,7 @@ addopts =

# show values of the local vars in errors:
--showlocals
asyncio_mode = auto
filterwarnings =
error
testpaths = tests/
Expand Down
3 changes: 3 additions & 0 deletions demos/chat/requirements.txt
@@ -0,0 +1,3 @@
aiohttp==3.8.3
aiohttp-jinja2==1.5
faker==15.1.1
4 changes: 2 additions & 2 deletions demos/graphql-demo/graph/api/contrib.py
Expand Up @@ -7,7 +7,7 @@
)


GQPHIQL_TEMPLATE = '''
GQPHIQL_TEMPLATE = """
<!DOCTYPE html>
<html>
<head>
Expand Down Expand Up @@ -140,7 +140,7 @@
</script>
</body>
</html>
'''
"""


def simple_renderer(template, **values):
Expand Down
21 changes: 9 additions & 12 deletions demos/graphql-demo/graph/api/dataloaders.py
Expand Up @@ -10,21 +10,18 @@


class BaseAIODataLoader(DataLoader):
'''
The base data loader for aiohttp. It need create when application
initialization with current db engine.
'''
"""The base data loader for aiohttp.

It need create when application initialization with current db engine.
"""
engine: Any = None

def __init__(self, engine, *args, **kwargs):
super().__init__(*args, **kwargs)
self.engine = engine

def sorted_by_keys(self, items: RowsProxy, keys: List[int]) -> RowsProxy:
'''
In `aiodataloader` ordering of returning items is very inportant and
this function halp to do it.
'''
"""Help ordering of returned items In `aiodataloader`."""
items_dict = {
key: value for key, value in zip(sorted(set(keys)), items)
}
Expand All @@ -33,10 +30,10 @@ def sorted_by_keys(self, items: RowsProxy, keys: List[int]) -> RowsProxy:


class UserDataLoader(BaseAIODataLoader):
'''
A simple user data loader. U should use it everywhere, when you think that
it is possible problem N + 1 requests.
'''
"""Simple user data loader.

Should be used everywhere, when it is possible problem N + 1 requests.
"""
async def batch_load_fn(self, keys: List[int]) -> RowsProxy:
async with self.engine.acquire() as conn:
response = await select_users(conn, keys)
Expand Down
8 changes: 2 additions & 6 deletions demos/graphql-demo/graph/api/models/room.py
Expand Up @@ -12,9 +12,7 @@


class Message(graphene.ObjectType):
'''
A messages is main object that representation data of user message.
'''
"""Main object that representation data of user message."""
id = graphene.Int(
description="An id of message, it's unique for all message",
)
Expand All @@ -37,9 +35,7 @@ async def resolve_owner(self, info: ResolveInfo) -> List[RowProxy]:


class Room(graphene.ObjectType):
'''
A room is point where users can have conversations.
'''
"""Point where users can have conversations."""
id = graphene.Int(
description="An id of room, it's unique for all rooms",
)
Expand Down
5 changes: 1 addition & 4 deletions demos/graphql-demo/graph/api/models/user.py
Expand Up @@ -5,10 +5,7 @@


class User(graphene.ObjectType):
'''
A user is an individual's account on current api that can have
conversations.
'''
"""Individual's account on current api that can have conversations."""
id = graphene.Int(
description='A id of user',
)
Expand Down
4 changes: 1 addition & 3 deletions demos/graphql-demo/graph/api/mutations/__init__.py
Expand Up @@ -8,9 +8,7 @@


class Mutation(graphene.ObjectType):
'''
The main GraphQL mutation point.
'''
"""Main GraphQL mutation point."""

add_message = AddMessageMutation.Field()
remove_message = RemoveMessageMutation.Field()
Expand Down
12 changes: 3 additions & 9 deletions demos/graphql-demo/graph/api/mutations/messages.py
Expand Up @@ -15,9 +15,7 @@


class AddMessageMutation(graphene.Mutation):
'''
Gives interface for create new messages.
'''
"""Provide interface for create new messages."""

class Arguments:
room_id = graphene.Int()
Expand Down Expand Up @@ -46,9 +44,7 @@ async def mutate(self, info, room_id: int, owner_id: int, body: str):


class RemoveMessageMutation(graphene.Mutation):
'''
Gives interface for create new message by id.
'''
"""Provide interface for create new message by id."""

class Arguments:
id = graphene.Int()
Expand All @@ -65,9 +61,7 @@ async def mutate(self, info, id: int):


class StartTypingMessageMutation(graphene.Mutation):
'''
Gives interface for set info about start typing new message.
'''
"""Provide interface for set info about start typing new message."""

class Arguments:
room_id = graphene.Int()
Expand Down
4 changes: 1 addition & 3 deletions demos/graphql-demo/graph/api/queries/__init__.py
Expand Up @@ -3,6 +3,4 @@


class Query(UserQuery, RoomsQuery):
'''
The main GraphQL query point.
'''
"""Main GraphQL query point."""
4 changes: 1 addition & 3 deletions demos/graphql-demo/graph/api/subscriptions/__init__.py
Expand Up @@ -2,6 +2,4 @@


class Subscription(MessageSubscription):
'''
The main GraphQL subscription point.
'''
"""Main GraphQL subscription point."""
17 changes: 5 additions & 12 deletions demos/graphql-demo/graph/api/subscriptions/messages.py
Expand Up @@ -8,17 +8,13 @@


class RandomType(graphene.ObjectType):
'''
Random type. Need for test.
'''
"""Random type. Need for test."""
seconds = graphene.Int()
random_int = graphene.Int()


class MessageAdded(graphene.ObjectType):
'''
The simple type for representation message response in subscription.
'''
"""The simple type for representation message response in subscription."""
id = graphene.Int(
description='The id of message'
)
Expand All @@ -32,10 +28,9 @@ class MessageAdded(graphene.ObjectType):


class StartTyping(graphene.ObjectType):
'''
The simple type for representation info connected with starting of typing
"""Simple type for representing info connected with starting of typing
new message by some user.
'''
"""

user = graphene.Field(
User,
Expand All @@ -44,9 +39,7 @@ class StartTyping(graphene.ObjectType):


class MessageSubscription(graphene.ObjectType):
'''
Subscriptions for all actions connected with messages.
'''
"""Subscriptions for all actions connected with messages."""
random_int = graphene.Field(RandomType)
typing_start = graphene.Field(
StartTyping,
Expand Down