Skip to content

Commit

Permalink
add pydantic_extra_types.S3Path to typing
Browse files Browse the repository at this point in the history
  • Loading branch information
eonu committed Dec 28, 2024
1 parent 0eccade commit ecba884
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/source/sections/typing/pydantic_extra_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ Phone number type

- :py:obj:`pydantic_extra_types.phone_numbers.PhoneNumber` (``>= 2.1.0``)

Path types
----------

- :py:obj:`pydantic_extra_types.s3.S3Path` (``>= 2.10.0``)

Payment types
-------------

Expand Down
6 changes: 6 additions & 0 deletions feud/_internal/_types/click.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@

EXTRA_TYPES[SemanticVersion] = click.STRING

if version >= packaging.version.parse("2.10.0"):
from pydantic_extra_types.s3 import S3Path

# NOTE: pathlib.Path isn't ideal for S3 paths
EXTRA_TYPES[S3Path] = click.STRING

except ImportError:
EXTRA_TYPES = {}

Expand Down
5 changes: 5 additions & 0 deletions feud/typing/pydantic_extra_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,10 @@ def split(string: str) -> str:

__all__.append("SemanticVersion")

if version >= packaging.version.parse("2.10.0"):
from pydantic_extra_types.s3 import S3Path

__all__.append("S3Path")

except ImportError:
pass
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
(t.LanguageAlpha2, click.STRING),
(t.LanguageName, click.STRING),
(t.SemanticVersion, click.STRING),
(t.S3Path, click.STRING),
],
)
def test_pydantic_extra(
Expand Down

0 comments on commit ecba884

Please sign in to comment.