You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(I would definitely be willing to help implement this feature. But, there are a couple of things I'm not sure how to accomplish)
Description
For local development, it would be very helpful to have a "watch" mode. Other plugins generally name this target serve.
Motivation
Being able to run a script, such as a REST API, with a single command from the workspace root and have it re-run when file contents change would speed up development in workspaces using this plugin.
Suggested Implementation
I'm able to manually add a serve target that uses nodemon to the generated project.json like so:
"""Automatically generated by Nx."""fromhelloimporthelloif__name__=="__main__":
print(hello())
But, I'm not sure that would also watch library code. I'm also not sure if nodemon is the right tool for this job or not. Since it's able to run with npx, it would prevent users from having to install additional tooling.
Alternate Implementations
A "more correct" approach would probably be to use watchmedo or something similar. nodemon has worked in my testing. But, that may not be true for everyone.
The text was updated successfully, but these errors were encountered:
By using the @nxlv/python:run-commands you can achieve that, however, it would be nice to have an executor dedicated to this, the same as Nx does for many platforms, like next.js, react, angular and etc.
I think it's definitely worth the investigation, in the meantime could you explore a little bit on your side if uvicorn or fastapi CLI works for your needs, please let me know the findings so we can implement something based on a real scenario.
@jafaircl I've created an example repo that uses the FastAPI CLI to serve the Rest API with watch mode, it worked pretty well, I don't think we need a dedicated Nx executor for that, the serve target is pretty simple and straightforward
(I would definitely be willing to help implement this feature. But, there are a couple of things I'm not sure how to accomplish)
Description
For local development, it would be very helpful to have a "watch" mode. Other plugins generally name this target
serve
.Motivation
Being able to run a script, such as a REST API, with a single command from the workspace root and have it re-run when file contents change would speed up development in workspaces using this plugin.
Suggested Implementation
I'm able to manually add a
serve
target that usesnodemon
to the generatedproject.json
like so:I also modified
__init__.py
to look like this:But, I'm not sure that would also watch library code. I'm also not sure if
nodemon
is the right tool for this job or not. Since it's able to run withnpx
, it would prevent users from having to install additional tooling.Alternate Implementations
A "more correct" approach would probably be to use
watchmedo
or something similar.nodemon
has worked in my testing. But, that may not be true for everyone.The text was updated successfully, but these errors were encountered: