From d80e2b7aa813ac4184de528fb61097992d60313c Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Tue, 21 May 2024 12:57:55 -0700 Subject: [PATCH] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f044681..cf57f3b 100644 --- a/README.md +++ b/README.md @@ -62,13 +62,13 @@ for binary in dependencies: ```python from pydantic_pkgr import Binary, BinProvider, BrewProvider, EnvProvider -# Or for better type checking ergonomics, use class-based definitions: +# you can also define binaries as classes, making them usable for type checking class CurlBinary(Binary): name: str = 'curl' providers: list[BinProvider] = [BrewProvider(), EnvProvider()] -# it works the same either way curl = CurlBinary().install() +assert isinstance(curl, CurlBinary) # CurlBinary is a unique type you can use in annotations now print(curl.abspath, curl.version, curl.provider, curl.is_valid) # Path('/opt/homebrew/bin/curl') SemVer('8.4.0') 'brew' True curl.exec(cmd=['--version']) # curl 8.4.0 (x86_64-apple-darwin23.0) libcurl/8.4.0 ... ```