vibora
                                
                                
                                
                                    vibora copied to clipboard
                            
                            
                            
                        Vibora unusable: doesn't works with Python 3.7 and can't install from sources
Describe the bug Right now, installing from pypi and using python 3.7 makes unusable vibora, if you try install from sources there is a missing file (parser.c) make impossible to work in Linux.
To Reproduce With pip
- pip install vibora (using python 3.7)
 - Run any example With sources
 - Clone repo
 - python setup.py install
 
Expected behavior The library needs to work, right now is imposible to do that
Screenshots With sources i get: building 'vibora.parsers.parser' extension creating build/temp.linux-x86_64-3.7 creating build/temp.linux-x86_64-3.7/vibora creating build/temp.linux-x86_64-3.7/vibora/parsers creating build/temp.linux-x86_64-3.7/vendor creating build/temp.linux-x86_64-3.7/vendor/http-parser-2.8.1 gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIC -I. -I/git/vibora/vibora -I/usr/include/python3.7m -c vibora/parsers/parser.c -o build/temp.linux-x86_64-3.7/vibora/parsers/parser.o -O3 gcc: error: vibora/parsers/parser.c: No existe el fichero o el directorio gcc: error fatal: no hay ficheros de entrada
Additional context
run build.py
+1 having this issue also on python 3.7, is unusable
Using conda and a fresh checkout of vibora:
my environment.yml:
name: vibora-py37
dependencies:
  - python>=3.7
  - pip:
    - vibora
conda env create --file environment.ymlconda activate vibora-py37git clone https://github.com/vibora-io/vibora.gitcd vibora/samples
python --version
Python 3.7.0
Running any vibora script results in an error:
python simple.py                             
Traceback (most recent call last):
  File "simple.py", line 1, in <module>
    from vibora import Vibora
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/__init__.py", line 7, in <module>
    from .server import *
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/server.py", line 11, in <module>
    from .workers.handler import RequestHandler
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/workers/handler.py", line 7, in <module>
    from ..hooks import Events
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/hooks.py", line 38
    self.async = iscoroutinefunction(handler)
             ^
SyntaxError: invalid syntax
                                    
                                    
                                    
                                
Same on the v0.1.0 branch:
endafarrell@SpaceGrey ~/W/g/v/v/samples (master) [1]> git checkout v0.1.0                           (vibora-py37)
Switched to branch 'v0.1.0'
Your branch is up to date with 'origin/v0.1.0'.
endafarrell@SpaceGrey ~/W/g/v/v/samples (v0.1.0)> python simple.py                                  (vibora-py37)
Traceback (most recent call last):
  File "simple.py", line 1, in <module>
    from vibora import Vibora, Response
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/__init__.py", line 7, in <module>
    from .server import *
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/server.py", line 11, in <module>
    from .workers.handler import RequestHandler
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/workers/handler.py", line 7, in <module>
    from ..hooks import Events
  File "/Users/endafarrell/anaconda/anaconda3/envs/vibora-py37/lib/python3.7/site-packages/vibora/hooks.py", line 38
    self.async = iscoroutinefunction(handler)
             ^
SyntaxError: invalid syntax
Not being able to use the current version of python is a showstopper (to me at least).
OK: I realise I've made a mistake by having vibora in my conda env file.
New env file:
name: vibora-py37
dependencies:
  - python>=3.7
  - cython=0.28.3
Then update conda env, run the checked-out build.py, then python setup.py install.
Now, running python samples/simple.py works.
I think this can be caused by the fact that since Python 3.7, async and await are reserved keywords: source. The fix would be changing Vibora source code to rename these attributes to something else.
It seems that the latest version is not on the pip source. in the error message self.async = iscoroutinefunction(handler) . self.is_async = iscoroutinefunction(handler) in the git project.
I thought I'd try out vibora but installing from pip and then running the sample hello world program gives:
  File "../env/lib/python3.7/site-packages/vibora/hooks.py", line 38
    self.async = iscoroutinefunction(handler)
             ^
SyntaxError: invalid syntax
I then searched and found this relatively old bug. So it seems that this project is abandoned ?
I asked the author some time ago that he is working on the official version, indicating that the latest version should be released soon. But it seems that this time is a bit long.
April 27, 2019. Vibora is still unusable on Python 3.7. Same error.
April 27, 2019. Vibora is still unusable on Python 3.7. Same error.
@inadarei It looks like there is some design issue in Vibora, and its micro-benchmarks weren't correct after all. If you look at the results of new rounds of tests from TechEmpower, you will see that Vibora didn't shine in performance:
- run completed on the 19th of April
 - run completed on the 26th of April
 
My web framework BlackSheep, which is also using Cython, httptools, and uvloop, did much better in these tests; and also the frameworks from Tom Christie Uvicorn and Starlette (the latter uses the former as its base, they both use uvloop and httptools but without Cythonizing things).
Something looks wrong - I also wasn't able to reproduce such good results on my local PC and using wrk to generate load, a few months ago. Maybe in how it handles multiprocessing (?).
A 3 seconds look at the benchmark code and voilà: someone is benchmarking Vibora in debug mode lol. https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/frameworks/Python/vibora/app.py I'll add Vibora to TechEmpower myself after the release.
BTW: If you want to reproduce the results of my micro-benchmarks (lookout the machine specs): https://github.com/vibora-io/benchmarks It's quite simple, and I'll be glad to add your framework there if you wish.
Anyway, great job on BlackSheep :)
Hi Frank, So somebody added your framework to TechEmpower benchmarks without your knowledge and making such mistake! I feel sorry for this, and sorry for my previous words: for sure I didn't imagine something like this.
I rapidly gave a look at the source code you linked to, and the source code of your benchmarks in GitHub, and I think the person who added Vibora to TechEmpower benchmark is forgivable:
- it doesn't look intuitive that 
app.runby default is in debug mode, it violates the principle of least astonishment and this case demonstrates it - I would recommend changing this method to run in production mode by default
 
I didn't lie when I wrote that I couldn't reproduce the same results when running the tests locally, but maybe I did something wrong. This is what I did some months ago:
- cloned your vibora benchmarks repository (and learnt something more about wrk in the process - so thank you :smile:)
 - added uvicorn / Starlette to them
 - ran tests using the same version of Python used there (3.6)
 - updated Dockerfile to use Python 3.7 image and ran tests with the newest version of Python, and here I didn't manage to get the same results even rebuilding Vibora for P3.7
 
Yes, if you have time and mood, I would be grateful if you added BlackSheep there too, and thanks for you kind words. :blush: PS. I am happy that I managed to get you answer on this thread! Now it got a bit out of topic, my fault.
Regarding the app.run, I completely agree with you and this is already done in the upcoming release (I learned so much building this project that I decided to build it again lol). I'll add BlackSheep there (and a few other async frameworks) too. I'm three months late on my release so just be patient :)
Vibora has been broken for a very long time on the later versions of Python - even if you're not ready for a feature release, it would make a lot of sense to make a release fixing this problem either way, right? It's a complete showstopper for a lot of people, after all.
I'd install from Git, but it's impossible to automate the install using normal tools - I can't integrate Vibora into my build that way, because I need to be able to use Pipenv and lock the dependencies.