Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
pirate authored May 21, 2024
1 parent ddc6715 commit d80e2b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
```
Expand Down

0 comments on commit d80e2b7

Please sign in to comment.