File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,10 @@ classifiers = [
1919 " Typing :: Typed" ,
2020]
2121dynamic = [" version" ]
22- dependencies = [" requests>=2.31.0,<3" ]
22+ dependencies = [
23+ " requests>=2.31.0,<3" ,
24+ " packaging"
25+ ]
2326
2427[project .urls ]
2528Source = " https://github.com/posit-dev/posit-sdk-py"
Original file line number Diff line number Diff line change 11requests == 2.32.2
2+ packaging == 24.1
Original file line number Diff line number Diff line change 11import functools
22from typing import Optional , Protocol
33
4+ from packaging .version import Version
5+
46
57def requires (version : str ):
68 def decorator (func ):
79 @functools .wraps (func )
810 def wrapper (instance : ContextManager , * args , ** kwargs ):
911 ctx = instance .ctx
10- if ctx .version and ctx .version < version :
12+ if ctx .version and Version ( ctx .version ) < Version ( version ) :
1113 raise RuntimeError (
1214 f"This API is not available in Connect version { ctx .version } . Please upgrade to version { version } or later." ,
1315 )
You can’t perform that action at this time.
0 commit comments