Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 12 11:07

    florimondmanca on docs

    Update mentions.md (compare)

  • Sep 11 22:29

    florimondmanca on npm_and_yarn

    (compare)

  • Sep 11 22:28

    florimondmanca on master

    Bump mixin-deep from 1.3.1 to 1… (compare)

  • Sep 11 22:28
    florimondmanca closed #330
  • Sep 09 05:07
    dependabot-preview[bot] labeled #331
  • Sep 09 05:07
    dependabot-preview[bot] opened #331
  • Sep 09 05:07

    dependabot-preview[bot] on pip

    Update uvicorn requirement from… (compare)

  • Aug 28 14:27
    codecov-io commented #330
  • Aug 28 14:27
    codecov-io commented #330
  • Aug 28 14:25
    codecov-io commented #330
  • Aug 28 14:24
    codecov-io commented #330
  • Aug 28 14:20
    dependabot[bot] labeled #330
  • Aug 28 14:20
    dependabot[bot] opened #330
  • Aug 28 14:20

    dependabot[bot] on npm_and_yarn

    Bump mixin-deep from 1.3.1 to 1… (compare)

  • Aug 27 07:13
    florimondmanca labeled #329
  • Aug 27 07:13
    florimondmanca opened #329
  • Aug 03 16:55

    florimondmanca on docs

    Update graphql.md Fix link to Twitter account (compare)

  • Aug 03 16:54

    florimondmanca on stable

    Bump lodash from 4.17.11 to 4.1… Loosen status code check in HST… Fix dependency conflict with we… and 7 more (compare)

  • Aug 03 16:53

    florimondmanca on v0.18.2

    (compare)

  • Aug 03 16:53
    codecov-io commented #328
Florimond Manca
@florimondmanca
@zowhair_twitter The contributing guide should help you get started :) https://github.com/bocadilloproject/bocadillo/blob/master/CONTRIBUTING.md
As for your question about Python, I’m not an Ubuntu user but I guess you should be able to find an answer by a bit of googling 👍
Zuhair
@zowhair_twitter
@florimondmanca Thanks bro
EricE
@EricE
Thanks for the updated documentation on async. In https://bocadilloproject.github.io/guides/async.html#converting-a-regular-function-to-an-asynchronous-function, if compute is slow, the I assume you would wrap it in run_in_threadpool since wrapping it in an async function doesn't protect you?
Florimond Manca
@florimondmanca
Absolutely @EricE, something like:
async def compute_async(*args, **kwargs):
    return await run_in_threadpool(compute, *args, **kwargs)
Florimond Manca
@florimondmanca
I pushed an update to that section with an additional tip on using partial :)
@alfredchiesa Coming back to your question on larger project structures last time, you may want to check out the new Bocadillo CLI and fiddle around with the create command, it should give you an example of a full-featured project file structure: https://github.com/bocadilloproject/bocadillo-cli
We’re still working towards being able to easily split an app into multiple files :)
^For example via #261
EricE
@EricE
Thanks for the update! For truly CPU bound applications, wouldn't you want to use ProcessPoolExecutor instead of ThreadPoolExecutor (unfortunately not in starlette)? Seems like you would slow down your asyncio app using the ThreadPoolExecutor but have minimal impact with ProcessPoolExecutor. I know it can be more limiting to work with Processes over Threads (pickling) but for maximum speed using ThreadPoolExecutor seems better.
Florimond Manca
@florimondmanca
Yes, I’ve heard that deferring highly CPU-bound operations to a process is more effective in Python. @EricE Maybe you should open a PR to Starlette to add run_in_processpool()? ;)
EricE
@EricE
If I only knew how to use Github :) I just downloaded their desktop app, I'll see if I can figure it out. The hardware guys at my company still use SVN for our FPGA files, etc., and I use it for my Python projects. Our SW guys are switching to Git and it is clearly the winner so time to switch...
Florimond Manca
@florimondmanca
Ah right, you’re into hardware! This website helped me a lot when starting with git two years ago :) http://rogerdudler.github.io/git-guide/
Ilyes Bouchlaghem
@Ibouch
Hi ! I am reading about ASGI servers more precisely on Uvicorn and a framework using it (Starlette.io). It turns out that in their section 'Third Party Packages' they quote you with another framework (FastAPI), so Bocadillo is a framework of another framework? Would not this add unnecessary overlays rather than contribute directly to the Starlette.io project?
Anyway good job, there are features that look cool
Florimond Manca
@florimondmanca

Hi Ilyes! Thanks for pitching in, this is an interesting question!

Actually, Bocadillo uses Starlette as an ASGI toolkit, not as a framework. For example, we reuse Starlette’s HTTP request representation (the Request class), as well as various ASGI middleware classes (eg the CORS middleware) and some other features (eg background tasks). But Bocadillo has a different design for views, and other features completely separate from Starlette (eg dependency injection). This hasn’t happened yet, but I’d be very much keen to bring generic enough features back into Starlette (in fact, I am personally a contributor to Starlette and uvicorn). :)

OTOH, it is true that FastAPI can be seen as a framework of a framework. For example, its app class is a direct subclass of ‘Starlette’ class. I think tiangolo is involved in both Starlette and uvicorn as well though.

Ilyes Bouchlaghem
@Ibouch
Ok thank you for the precision, in the description of your project, would you know what 'asynchronous salsa` means?
Florimond Manca
@florimondmanca
Bocadillo means sandwich in Spanish, and salsa means sauce, so it’s just a pun for the fact that Bocadillo is an async framework :)
Ilyes Bouchlaghem
@Ibouch
hm ok, because I had found on the internet "Salsa: A Framework for Scalable Asynchronous Replica Exchange"
but it did not make sense
Florimond Manca
@florimondmanca
Oh, right. Yeah, Bocadillo has nothing to do with this paper. 😅 I can see that’s what I get as a second result when googling for “asynchronous salsa” as well.
Ilyes Bouchlaghem
@Ibouch
I chose to use starlette.io, but I may reconsider my choice if I realize that bocadillo saves me development time and does not affect performance. This is for a web application of a large community and the current version under Flask (and Flask-SocketIO for websocket), does not support the load.
If I use bocadillo, I will mention to my community (video games so also some devs) to increase the visibility of your project!
Florimond Manca
@florimondmanca
Sounds good! Good luck with your project 👍
Ilyes Bouchlaghem
@Ibouch
Thank you :)
EricE
@EricE
I'm wondering is something is off with the demo file structure? I ran bocadillo create demo and got
+---demo
¦   +---demo
¦   ¦   +---app.py
¦   ¦   +---asgi.py
¦   ¦   +---providerconf.py
¦   ¦   +---settings.py
¦   ¦   +---__init__.py
¦   +---templates
(I added templates). From the tutorial it seems like templates should be in the same subdirectory as app.py but jinja2 throws an error if it is
I run uvicorn demo.asgi:app --reload in the first demo subdirectory
EricE
@EricE
If I run uvicorn asgi:app --reload in the second demo subdirectory, it errors:
(D:\SVNRepo\projects-sw\async_web\trunk\env) D:\SVNRepo\projects-sw\async_web\tr
unk\env\projects\demo\demo>uvicorn asgi:app --reload
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [18712]
Process SpawnProcess-1:
Traceback (most recent call last):
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\multiprocessing\process.p
y", line 297, in _bootstrap
    self.run()
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\multiprocessing\process.p
y", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\mai
n.py", line 305, in run
    loop.run_until_complete(self.serve(sockets=sockets))
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\asyncio\base_events.py",
line 584, in run_until_complete
    return future.result()
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\mai
n.py", line 312, in serve
    config.load()
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\con
fig.py", line 182, in load
    self.loaded_app = import_from_string(self.app)
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\imp
orter.py", line 23, in import_from_string
    raise exc from None
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\site-packages\uvicorn\imp
orter.py", line 20, in import_from_string
    module = importlib.import_module(module_str)
  File "d:\svnrepo\projects-sw\async_web\trunk\env\lib\importlib\__init__.py", l
ine 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File ".\asgi.py", line 3, in <module>
    from .app import app
ImportError: attempted relative import with no known parent package
INFO: Stopping reloader process [18712]
Florimond Manca
@florimondmanca

From the tutorial it seems like templates should be in the same subdirectory as app.py but jinja2 throws an error if it is

The docs say that it should be placed in the same directory relative to where the app is run (ie using uvicorn), so that means the location you put it at should work. Doesn’t it?

If I run uvicorn asgi:app --reload in the second demo subdirectory, it errors:

Yes, that is expected, because the generated demo package uses relative imports, which you can’t use in Python unless you’re running from outside of that package. We should probably add a warning/caveat in the docs

EricE
@EricE
It did work when I put the templates directory as I showed in the directory tree listing above. However, in the templates guide it looks different:
https://safe.menlosecurity.com/https://bocadilloproject.github.io/guides/agnostic/templates.html#how-templates-are-discovered
shows the templates directory at the same level as app.py. However, app.py is created in the second demo subdirectory and when I tried running there it caused the above error. So I was able to make it work but it seems inconsistent with the documentation.
Florimond Manca
@florimondmanca
Yes, I see. This is because the example app there doesn’t use a project generated with Bocadillo CLI. The templates dir location really is irrelevant or where app.py is. It really is just ./templates, with . meaning the current directory.
Could you track this in an issue, please? I’ll have a look when I have some time. Or if you feel like it you can propose a clearer wording. :-)
Florimond Manca
@florimondmanca
@EricE I opened #276 :+1:
Zuhair
@zowhair_twitter
do bocadillo have database functionality?
@florimondmanca
Florimond Manca
@florimondmanca
Hi @zowhair_twitter :-) DB support is not built-in, but you should find useful info here: https://bocadilloproject.github.io/discussions/databases.html
Zuhair
@zowhair_twitter
Thanks bro, and cli tool you used is click??
Florimond Manca
@florimondmanca
Yup, Bocadillo CLI is built on top of Click
Zuhair
@zowhair_twitter
i see..
Florimond Manca
@florimondmanca

Hi peeps, just to let you know that I am planning to close this Gitter chat soon.

The experience I’ve had is that most of the discussions taking place here would benefit from being out there in the open (ie in GitHub issues), indexed, searchable and actionable.

Also, while I enjoy answering questions, the chat or DM system here has been taking up on my attention, and it would be much easier to manage via issues.

So I invite everyone to start using issues for questions (even simple ones!), since this chat should be closed by next week. 👍 Thanks!

Marwan Rabbâa
@waghanza
Hi, could a route be constrained (accept only digits for example) by any regexp or else ?
Florimond Manca
@florimondmanca
Hi @waghanza, I don’t think regex validation is supported atm. I think it’s an interesting topic though, could you open an issue as I mentioned in my last post?
Also realizing that I didn’t actually close this chat 😄 actually my thought is that Gitter may not be the best solution for community gathering and chatter. Haven’t got much time to dedicate to this recently unfortunately. Will open an issue to track what’s to be done / what questions need to be discussed
Marwan Rabbâa
@waghanza
@florimondmanca perhaps slack could be a suitable alternative
Florimond Manca
@florimondmanca
Yes, I’ve been thinking about Slack — I know a few communities that use it (Masonite, Tartiflette), but the fact that workspaces are private bugs me (not searchable, not indexable, etc). I’ve also heard about Spectrum, do you know about it / have any opinion on it? :)
Marwan Rabbâa
@waghanza
have heard of it, but now used. I like slack because of ecosystem + mobile app, and I've also heard of https://twist.com which is a slack alternative
I'm not keen on discord