Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Issue or bug
When running the generated API on docker would throw this exception:
pydantic.errors.PydanticUserError: A non-annotated attribute was detected
And also, I wasn't able to access the API running on docker.
Did not found any open issue on this problems, I found the problems when I was using pycaret.
Describe the changes you've made
I changed only
pycaret\internal\pycaret_experiment\tabular_experiment.py
.There was 4 modifications:
pydantic==1.10.0
requirement at generated requirement.txt.It was necessary because airflow version it's compatible with pydantic version 1.10. If you don't specify the version it will use pydantic version < 2.0.
You could also solve that error without specifying pydantic version changing the requirement
pycaret
topycaret[full]
. But it would make your docker image size significantly bigger. That's why I choose to follow this approach. In my tests I made version 1 withpycaret[full]
and version 2 withpydantic==1.10.0
. Here's the result:apt-get clean
atRUN
on the generated docker file.This will remove the cache after install packages, not storing an index, reducing the size of your docker image and speeding up your deployments.
CMD
on generated dockerfile to["uvicorn", "{API_NAME}:app", "--host", "0.0.0.0", "--port", "{PORT}"]
.When running fast api on a container you need to tell Uvicorn to not care about the incoming host IP with option
--host 0.0.0.0
. Without it you will not be able to access your API outside Docker.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
I built docker images using python:3-8-slim to python:3.11-slim, in each version of python I built images with and without specifying pydantic version, and with and without telling Uvicorn to not care about incoming host IP.
Describe if there is any unusual behaviour of your code(Write
NA
if there isn't)NA
Checklist:
Screenshots