-
Notifications
You must be signed in to change notification settings - Fork 517
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
feat: add fastapi docker #2740
feat: add fastapi docker #2740
Conversation
Could be the same issue as what's causing #2498? There's a bug in VSCode somewhere that causes terminals to not work. Seems like a very active issue (100+ comments): microsoft/vscode#105446 |
I'm going to check that in some hours. Thank you! Do I need to add specific tests? For Django and Flask it looks like they are handled by "python containers" instead of something specific. Am I wrong? |
Unfortunately we have pretty little in the way of automated tests, and most of what we do have makes more noise than signal 😞 So nothing in particular to add for now. |
Yeah... I've tried some stuff, also downloaded insiders. But it didn't work. I'm not going to have time to check it again before the weekend, jfyk @bwateratmsft |
No problem. I'll try to find some time to test these changes out. |
Ok, I was able to test it out, bumped into a couple of issues.
case 'fastapi':
return 'Uvicorn running on (https?://\\S+|[0-9]+)'; The reason we don't need a listener for the Gunicorn approach is that when debugging--which is the only time this code will be active--we'll always be using Uvicorn to launch (more on that next...)
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build"
],
"python": {
"args": [
"--host",
"0.0.0.0",
"--port",
"8000"
],
"file": "main.py"
}
} It needs to be this: {
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": [
"docker-build"
],
"python": {
"args": [
"main:app",
"--host",
"0.0.0.0",
"--port",
"8000"
],
"module": "uvicorn"
}
} The code for generating this task is here, and it contains an example of how the Flask task gets some custom handling--you'd have something very similar, like: // ... (the Flask code)
} else if (options.projectType === 'fastapi') {
runOptions.args.unshift(`${path.basename(runOptions.file, '.py')}:app`); // Also, an `import * as path from 'path';` at the top
runOptions.module = 'uvicorn';
runOptions.file = undefined;
} |
I didn't understand this. For the other points: got it! It's more clear now. I'll probably have to bother you to test it again after (if I can't fix the issue I mentioned above). Thank you for the comments, @bwateratmsft ! |
@bwateratmsft I've applied the changes. Thank you for the update @bwateratmsft :) Unfortunately I still need to bother you with the testing 😢 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bwateratmsft I've applied the changes. Thank you for the update @bwateratmsft :)
Unfortunately I still need to bother you with the testing 😢
Worked like a charm! Didn't encounter any issues on either Window or Mac. Usually Mac means Linux works too, I'm not worried about it.
This is exciting! Thanks @Kludex!
COOL! 🎉 @bwateratmsft Thanks for all the help! :) |
Closes #2615