I agree with the other answer --
logging is for logging and
warning is for warning -- but I'd like to add more detail.
Here is a tutorial-style HOWTO taking you through the steps in using the
logging module. https://docs.python.org/3/howto/logging.html
It directly answers your question:
warnings.warn() in library code if the issue is avoidable and the client application should be modified to eliminate the warning
logging.warning() if there is nothing the client application can do about the situation, but the event should still be noted