Pydantic URL types based on str class for fast and simple URL validation. Current version 1.0.2, release cadence is low (semi-active maintenance). Provides Pydantic field types like HttpUrl, FtpUrl, etc., but unlike pydantic's own UrlStr, these are simple str subclasses that do not parse URL components.
pip install pydantic-string-urlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Define a Pydantic model with URL fields. The URL types validate the string is a proper URL, but keep it as a plain string (not parsed into components).
Use str(your_url_field) to get a plain string, or use .__str__() if needed for serialization.
If you need URL parsing (e.g., url.host), use from pydantic import HttpUrl instead of pydantic_string_url.
Use 'from pydantic_string_url import HttpUrl' for this library's version. Or use 'from pydantic import HttpUrl' for pydantic's parsed URL type.
Ensure URL starts with http://, https://, ftp://, etc. and conforms to standard URL format.