Giter VIP home page Giter VIP logo

aiohttp-demos's People

Contributors

arfey avatar asvetlov avatar bigboynaruto avatar cactuuus avatar daaawx avatar davinellulinvega avatar davitovmasyan avatar dependabot[bot] avatar dreamsorcerer avatar gyermolenko avatar hzlmn avatar imgbot[bot] avatar jettify avatar k0te avatar magomedov-magomed avatar moden-py avatar nikitakolesov avatar saket13 avatar snjypl avatar snyk-bot avatar thijstriemstra avatar vlcinsky avatar webknjaz avatar willingc avatar xiangxli avatar xiaohuanshu avatar yakovlevkll avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aiohttp-demos's Issues

Defining model

Hello,
I'm currently referring polls demo for developing aiohttp server app.
One question is, there are guide about defining model in tutorial document, and it said model can be defined as class instead of using table.

class Question(Base):
    __tablename__ = 'question'

    id = Column(Integer, primary_key=True)
    question_text = Column(String(200), nullable=False)
    pub_date = Column(Date, nullable=False)

Is there any sample to develop in this way?

Thanks.

Update moderator model

The model in moderator/moderator_bot appears to be a pickled object, but this no longer works on the latest scikit-learn releases due to a module restructuring. Does anybody know how to rebuild the model? (@jettify?)

Create sphinx project for demos

  • Make ./docs/conf.py etc. sphinx-quickstart could help
  • Setup aiohttp theme for docs
  • Setup intersphinx mapping (see ./docs/conf.py from aiohttp)
  • Add ./Makefile with make doc and make doc-spelling. Borrow implementation from aiohttp
  • Register the project on readthedocs
  • Add ./.travis.yml with docs check

Graphql demo code throwing error

Hi.

I have carefully followed the document instruction and when I execute the "sudo make prepare_database" command then I am getting the below error.

deeplearning@XXX: ~/Desktop/ML_Practise/aiohttp-demos/demos/graphql$ sudo make start_database
Starting graphql_postgres_1 ... done
deeplearning@XXX: ~/Desktop/ML_Practise/aiohttp-demos/demos/graphql$ sudo make start_redis
Starting graphql_redis_1 ... done
deeplearning@XXX: ~/Desktop/ML_Practise/aiohttp-demos/demos/graphql$ sudo make prepare_database
Start to generate a new data...
Traceback (most recent call last):
File "prepare_database.py", line 153, in
loop.run_until_complete(main())
File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "prepare_database.py", line 142, in main
users = await generate_users(conn, 20)
File "prepare_database.py", line 88, in generate_users
return [user[0] for user in response]
TypeError: 'ResultProxy' object is not iterable
/usr/local/lib/python3.6/dist-packages/aiopg/pool.py:310: ResourceWarning: Unclosed 1 connections in <aiopg.pool.Pool object at 0x7f5b4ad8ac18>
Makefile:26: recipe for target 'prepare_database' failed
make: *** [prepare_database] Error 1

also when I execute the Make Run command I am getting below error.

deeplearning@XXX :~/Desktop/ML_Practise/aiohttp-demos/demos/graphql$ sudo make run
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/deeplearning/Desktop/ML_Practise/aiohttp-demos/demos/graphql/graph/main.py", line 3, in
from .app import init_app
File "/home/deeplearning/Desktop/ML_Practise/aiohttp-demos/demos/graphql/graph/app.py", line 10, in
from graph.routes import init_routes
File "/home/deeplearning/Desktop/ML_Practise/aiohttp-demos/demos/graphql/graph/routes.py", line 3, in
from graph.api.views import (
File "/home/deeplearning/Desktop/ML_Practise/aiohttp-demos/demos/graphql/graph/api/views.py", line 3, in
import graphene
File "/usr/local/lib/python3.6/dist-packages/graphene/init.py", line 3, in
from .types import (
File "/usr/local/lib/python3.6/dist-packages/graphene/types/init.py", line 2, in
from graphql import ResolveInfo
ImportError: cannot import name 'ResolveInfo'
Makefile:8: recipe for target 'run' failed
make: *** [run] Error 1

please advise.

Create graphQl example

GraphQl is very popular, so i think it is good idea show how look simple GraphQL api.

What i want to do:

  • create graphQl api

  • add graphIQl view for interactive work with data

  • add tests

Does anyone have a suggestion before I start?

Error running ImageTagger demo app.

Hi.

I am trying to run the aiohttp - demo (ImageTagger) project in PyCharm 2019.x but it throwing some errors like below,

Error 1 :
Using TensorFlow backend.
C:\Users\saddam.X.XXXX\AppData\Roaming\Python\Python36\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.

Error 2:
ImportError: cannot import name 'routes'
etc...

Can anyone guide me on how to run this ImageTagger app?

Environment"

Ubuntu on Vmware.
python3.6

Imagetagger demo app failing while "Make run" command

Hi.

Long story in short:

I carefully followed the instruciton provided in the document and when I run the Make run command then I am getting the below error.

aiohttp-keras-demo$ make run
python -m image tagger
make: python: Command not found
Makefile:34: recipe for target 'run' failed
make: *** [run] Error 127

environment:

python 3.6.8
ubuntu os onb VMware.

please advise .

Add tests for shortify

The shortify demo has no tests, and probably doesn't work anymore.

We should add a couple of basic tests to verify it is atleast somewhat working with future updates.

data is not getting populated while running `sample_data(engine)` while seeding the polls data

Description:

While seeding the polls data in polls app the population is not getting reflected in database. Seems like the the auto-commit is not enabled by default because when I am doing conn.commit() the seeding works.

Code line: https://github.com/aio-libs/aiohttp-demos/blob/master/docs/tutorial.rst?plain=1#L350 (Adding conn.commit() above this line, before doing conn.close() populates the data correctly.)

Commit as you go reference: https://docs.sqlalchemy.org/en/20/core/connections.html#commit-as-you-go

I am happy to contribute if this is an issue and would love to know your thought on this.

Thank you!

Replace trafaret with pydantic

It would probably a good idea to replace trafaret/trafaret-config with pydantic. Trafaret seems somewhat unmaintained and doesn't have any static typing support. Pydantic is likely a better option to use here.

TravisCI needs updating

PRs currently require TravisCI to pass, but it no longer runs.

This presumably needs to be updated to github workflows.

Unable to run moderator on aiohttp 3.8.3

Running the example moderator with aiohttp=3.8.3 rise a error when POST:

ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "/Users/kunshu/opt/anaconda3/envs/aio38/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
  File "/Users/kunshu/opt/anaconda3/envs/aio38/lib/python3.8/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/Users/Kunshu/Work/aiohttp-demos/demos/moderator/moderator/handlers.py", line 26, in moderate
    results = await run(self._executor, predict_probability, features)
RuntimeError: Task <Task pending name='Task-8' coro=<RequestHandler._handle_request() running at /Users/kunshu/opt/anaconda3/envs/aio38/lib/python3.8/site-packages/aiohttp/web_protocol.py:433> cb=[<TaskWakeupMethWrapper object at 0x103d47ca0>()]> got Future <Future pending cb=[_chain_future.<locals>._call_check_cancel() at /Users/kunshu/opt/anaconda3/envs/aio38/lib/python3.8/asyncio/futures.py:360]> attached to a different loop

While I tried to use aiohttp==3.7.4, it worked without the error.

By the way, the model example used rises a ModuleNotFoundError: No module named 'sklearn.linear_model.logistic' error with sciki-learn==1.1.2. Downgrade to scikit-learn==0.23.2 solves the problem.

Add tests for motortwit

The motortwit demo has no tests, and probably doesn't work anymore.

We should add a couple of basic tests to verify it is atleast somewhat working with future updates.

Tests for demo polls app

I would like to update/fix tests for demo polls app.
Let's start with simplest test scenarios:

  1. get 'index' view (can be done with or wo test client)
  2. post:
    • count choices for question 1 (smth like res = await conn.execute(choice.count()))
    • post vote
    • recount choices (assert is it +1)

But there are a couple of questions I need to clarify first.

  • pytest (or pytest and unittest comparison)?
  • DB initialization: setup/teardown, install.sh or migration
  • do we need db fixture?

Could anyone with experience in testing async code share his view or examples I can look at? Thanks.

Plans to add Typing?

Hi,

Any plans to add typing to all demos?

So far, it hasn't been too hard to add typing to my code using aiohttp's websockets. However, it is a bit tricky to navigate aiohttp's code to find what and where the types are.

I think that adding typing to all demos would help new comers.

Unclear where to put example code from "Creating connection engine" part

На этой странице https://aiohttp-demos.readthedocs.io/en/latest/tutorial.html
Начиная с раздела Databases::Creating connection engine непонятно в какие файлы вставлять код, приходится смотреть сюда. И с раздела Templates все сыпется.

Это специально чтобы отпугнуть начинающих изучать фреймворк?

AttributeError: 'coroutine' object has no attribute '_set_loop'

Hi!
I'm trying to run chat demo with python main.py command, and getting this is my traceback :

Traceback (most recent call last):
  File "main.py", line 40, in <module>
    main()
  File "main.py", line 36, in main
    web.run_app(app)
  File "C:\Program Files\Python36\lib\site-packages\aiohttp\web.py", line 54, in run_app
    loop.run_until_complete(runner.setup())
  File "C:\Program Files\Python36\lib\asyncio\base_events.py", line 467, in run_until_complete
    return future.result()
  File "C:\Program Files\Python36\lib\site-packages\aiohttp\web_runner.py", line 170, in setup
    self._server = await self._make_server()
  File "C:\Program Files\Python36\lib\site-packages\aiohttp\web_runner.py", line 262, in _make_server
    self._app._set_loop(loop)
AttributeError: 'coroutine' object has no attribute '_set_loop'
sys:1: RuntimeWarning: coroutine 'init_app' was never awaited

How can i fix this??

Automatically give write access to the author on PR merging

The repository has no sensitive data, it is a set of demo projects.
Event accidental commit cannot harm much and can be reverted easily.

On another hand, keeping the repo in the good shape is super important.
A few individuals cannot do it well enough as I can see but lowering the bar can attract help from contributors around the world.

Ideally, we can have post-commit hook in GitHub workflow; but even manual step can be good enough if we have a general agreement on this question.

@aio-libs/admins @aio-libs/aiohttp-committers @aio-libs/aiohttp-demos-writers @aio-libs/triagers -- what do you think?

Document existing demos

We have 4 demos now but only polls is documented.
It would be nice to have something for others too.

I think new docs should not be as comprehensive as polls, no need to describe boring chapters about preparation and folder structure again and again.
Perhaps a page for demo should be enough.

Mentioning all existing demos in docs increase their visibility and teaching effect.

We need volunteers for the task. Sorry, I personally too busy by aiohttp itself.

Add deploy to heroku button for demos

It is very easy to deploy aiohttp app to heroku, and best part it is completely free. I think we should deploy few demos so users can play with apps.

Process is strait forward basically create Procfile with:

web: mlserve -c models.yml -H 0.0.0.0 -P $PORT

And deploy app with git:

$ heroku create
$ git push heroku master
$ heroku open

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.