@@ -39,14 +39,24 @@ pip install pydantic-pkgr
39
39
<br />
40
40
41
41
``` python
42
- from pydantic_pkgr import AptProvider, Binary
42
+ from pydantic_pkgr import *
43
43
44
- apt = AptProvider()
45
- curl = apt.install(' curl' )
44
+ apt, brew, pip, npm, env = AptProvider(), BrewProvider(), PipProvider(), NpmProvider(), EnvProvider()
45
+
46
+ dependencies = [
47
+ Binary(name = ' curl' , providers = [env, apt, brew]),
48
+ Binary(name = ' wget' , providers = [env, apt, brew]),
49
+ Binary(name = ' yt-dlp' , providers = [env, apt, brew, pip]),
50
+ Binary(name = ' playwright' , providers = [env, pip, npm]),
51
+ Binary(name = ' puppeteer' , providers = [env, npm]),
52
+ ]
53
+ for binary in dependencies:
54
+ binary = binary.load_or_install()
46
55
47
- print (curl.abspath, curl.version, curl.provider, curl.is_valid) # Path('/usr/bin/curl') SemVer('7.81.0') 'apt' True
56
+ print (binary.abspath, binary.version, binary.provider, binary.is_valid)
57
+ # Path('/usr/bin/curl') SemVer('7.81.0') 'apt' True ...
48
58
49
- proc = curl. exec([' -fsSL' , ' https://example.com' ]) # <!doctype html>...
59
+ proc = Binary( name = ' curl' ).load(). exec([' -fsSL' , ' https://example.com' ]) # <!doctype html>...
50
60
```
51
61
52
62
``` python
0 commit comments