mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 02:30:44 -06:00
fix(#23): add pip version check
This commit is contained in:
parent
8aced00ace
commit
303831bdb8
5 changed files with 22 additions and 4 deletions
|
@ -7,6 +7,7 @@ it will generate a new vivenv.
|
||||||
It may be important to require a exe specificty if you are frequently running
|
It may be important to require a exe specificty if you are frequently running
|
||||||
different version of pythons and rely on c extension modules as in numpy.
|
different version of pythons and rely on c extension modules as in numpy.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__import__("viv").use("numpy", "plotext", track_exe=True) # noqa
|
__import__("viv").use("numpy", "plotext", track_exe=True) # noqa
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
|
@ -6,6 +6,7 @@ This import statement was generated using
|
||||||
Using viv freeze ensures future runs of this
|
Using viv freeze ensures future runs of this
|
||||||
script will use the same essential environment
|
script will use the same essential environment
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__import__("viv").use(
|
__import__("viv").use(
|
||||||
"numpy==1.24.0",
|
"numpy==1.24.0",
|
||||||
"pandas==1.5.2",
|
"pandas==1.5.2",
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"""
|
"""
|
||||||
Embed the viv.py on the sys.path at runtime rather than using PYTHONPATH
|
Embed the viv.py on the sys.path at runtime rather than using PYTHONPATH
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
old_sys_path = sys.path.copy() # noqa
|
old_sys_path = sys.path.copy() # noqa
|
||||||
|
|
|
@ -42,7 +42,7 @@ test = [
|
||||||
"sampleproject"
|
"sampleproject"
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff.lint]
|
||||||
select = ["E","F","I"]
|
select = ["E","F","I"]
|
||||||
ignore = ["E402"]
|
ignore = ["E402"]
|
||||||
|
|
||||||
|
|
|
@ -3877,6 +3877,20 @@ class Cli:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _pip_check():
|
||||||
|
pip_version_requirement = ">=22.2"
|
||||||
|
if not shutil.which("pip"):
|
||||||
|
err_quit("viv requires pip to be installed")
|
||||||
|
|
||||||
|
# importing viv may have side effects I'm not aware of...
|
||||||
|
if Version((pip_version := __import__("pip").__version__)) not in SpecifierSet(
|
||||||
|
pip_version_requirement
|
||||||
|
):
|
||||||
|
err_quit(
|
||||||
|
f"viv requires pip version {pip_version_requirement} but got {pip_version}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _no_traceback_excepthook(
|
def _no_traceback_excepthook(
|
||||||
exc_type: type[BaseException],
|
exc_type: type[BaseException],
|
||||||
exc_val: BaseException,
|
exc_val: BaseException,
|
||||||
|
@ -3888,6 +3902,7 @@ def _no_traceback_excepthook(
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
try:
|
try:
|
||||||
|
_pip_check()
|
||||||
viv = Viv()
|
viv = Viv()
|
||||||
Cli(viv).run()
|
Cli(viv).run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|
Loading…
Reference in a new issue