meerschaum 2.2.2rc1__py3-none-any.whl → 2.2.2rc3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meerschaum/_internal/shell/Shell.py +40 -16
- meerschaum/_internal/term/__init__.py +3 -2
- meerschaum/_internal/term/tools.py +1 -1
- meerschaum/actions/api.py +65 -30
- meerschaum/actions/python.py +56 -24
- meerschaum/actions/start.py +2 -4
- meerschaum/actions/uninstall.py +5 -9
- meerschaum/actions/upgrade.py +9 -1
- meerschaum/api/__init__.py +1 -0
- meerschaum/api/dash/callbacks/__init__.py +4 -0
- meerschaum/api/dash/callbacks/custom.py +39 -0
- meerschaum/api/dash/callbacks/dashboard.py +39 -6
- meerschaum/api/dash/callbacks/login.py +3 -1
- meerschaum/api/dash/components.py +5 -2
- meerschaum/api/dash/pipes.py +145 -97
- meerschaum/config/_paths.py +1 -0
- meerschaum/config/_version.py +1 -1
- meerschaum/config/static/__init__.py +1 -1
- meerschaum/connectors/__init__.py +1 -1
- meerschaum/core/Pipe/__init__.py +5 -0
- meerschaum/plugins/__init__.py +67 -9
- meerschaum/utils/daemon/Daemon.py +7 -2
- meerschaum/utils/packages/__init__.py +147 -39
- meerschaum/utils/packages/_packages.py +1 -1
- meerschaum/utils/process.py +12 -2
- meerschaum/utils/venv/__init__.py +27 -3
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/METADATA +4 -4
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/RECORD +34 -33
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/WHEEL +1 -1
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/LICENSE +0 -0
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/NOTICE +0 -0
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/entry_points.txt +0 -0
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/top_level.txt +0 -0
- {meerschaum-2.2.2rc1.dist-info → meerschaum-2.2.2rc3.dist-info}/zip-safe +0 -0
@@ -46,6 +46,7 @@ def get_module_path(
|
|
46
46
|
"""
|
47
47
|
Get a module's path without importing.
|
48
48
|
"""
|
49
|
+
import site
|
49
50
|
if debug:
|
50
51
|
from meerschaum.utils.debug import dprint
|
51
52
|
if not _try_install_name_on_fail:
|
@@ -54,33 +55,58 @@ def get_module_path(
|
|
54
55
|
import_name_lower = install_name_lower
|
55
56
|
else:
|
56
57
|
import_name_lower = import_name.lower().replace('-', '_')
|
58
|
+
|
57
59
|
vtp = venv_target_path(venv, allow_nonexistent=True, debug=debug)
|
58
60
|
if not vtp.exists():
|
59
61
|
if debug:
|
60
|
-
dprint(
|
62
|
+
dprint(
|
63
|
+
(
|
64
|
+
"Venv '{venv}' does not exist, cannot import "
|
65
|
+
+ f"'{import_name}'."
|
66
|
+
),
|
67
|
+
color = False,
|
68
|
+
)
|
61
69
|
return None
|
70
|
+
|
71
|
+
venv_target_candidate_paths = [vtp]
|
72
|
+
if venv is None:
|
73
|
+
site_user_packages_dirs = [pathlib.Path(site.getusersitepackages())]
|
74
|
+
site_packages_dirs = [pathlib.Path(path) for path in site.getsitepackages()]
|
75
|
+
|
76
|
+
paths_to_add = [
|
77
|
+
path
|
78
|
+
for path in site_user_packages_dirs + site_packages_dirs
|
79
|
+
if path not in venv_target_candidate_paths
|
80
|
+
]
|
81
|
+
venv_target_candidate_paths += paths_to_add
|
82
|
+
|
62
83
|
candidates = []
|
63
|
-
for
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
if file_name.endswith('dist_info'):
|
84
|
+
for venv_target_candidate in venv_target_candidate_paths:
|
85
|
+
try:
|
86
|
+
file_names = os.listdir(venv_target_candidate)
|
87
|
+
except FileNotFoundError:
|
68
88
|
continue
|
69
|
-
|
89
|
+
for file_name in file_names:
|
90
|
+
file_name_lower = file_name.lower().replace('-', '_')
|
91
|
+
if not file_name_lower.startswith(import_name_lower):
|
92
|
+
continue
|
93
|
+
if file_name.endswith('dist_info'):
|
94
|
+
continue
|
95
|
+
file_path = venv_target_candidate / file_name
|
70
96
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
97
|
+
### Most likely: Is a directory with __init__.py
|
98
|
+
if file_name_lower == import_name_lower and file_path.is_dir():
|
99
|
+
init_path = file_path / '__init__.py'
|
100
|
+
if init_path.exists():
|
101
|
+
candidates.append(init_path)
|
76
102
|
|
77
|
-
|
78
|
-
|
79
|
-
|
103
|
+
### May be a standalone .py file.
|
104
|
+
elif file_name_lower == import_name_lower + '.py':
|
105
|
+
candidates.append(file_path)
|
80
106
|
|
81
|
-
|
82
|
-
|
83
|
-
|
107
|
+
### Compiled wheels (e.g. pyodbc)
|
108
|
+
elif file_name_lower.startswith(import_name_lower + '.'):
|
109
|
+
candidates.append(file_path)
|
84
110
|
|
85
111
|
if len(candidates) == 1:
|
86
112
|
return candidates[0]
|
@@ -681,12 +707,22 @@ def need_update(
|
|
681
707
|
return False
|
682
708
|
|
683
709
|
|
684
|
-
def get_pip(
|
710
|
+
def get_pip(
|
711
|
+
venv: Optional[str] = 'mrsm',
|
712
|
+
color: bool = True,
|
713
|
+
debug: bool = False,
|
714
|
+
) -> bool:
|
685
715
|
"""
|
686
716
|
Download and run the get-pip.py script.
|
687
717
|
|
688
718
|
Parameters
|
689
719
|
----------
|
720
|
+
venv: Optional[str], default 'mrsm'
|
721
|
+
The virtual environment into which to install `pip`.
|
722
|
+
|
723
|
+
color: bool, default True
|
724
|
+
If `True`, force color output.
|
725
|
+
|
690
726
|
debug: bool, default False
|
691
727
|
Verbosity toggle.
|
692
728
|
|
@@ -709,7 +745,7 @@ def get_pip(venv: Optional[str] = 'mrsm', debug: bool=False) -> bool:
|
|
709
745
|
if venv is not None:
|
710
746
|
init_venv(venv=venv, debug=debug)
|
711
747
|
cmd_list = [venv_executable(venv=venv), dest.as_posix()]
|
712
|
-
return subprocess.call(cmd_list, env=_get_pip_os_env()) == 0
|
748
|
+
return subprocess.call(cmd_list, env=_get_pip_os_env(color=color)) == 0
|
713
749
|
|
714
750
|
|
715
751
|
def pip_install(
|
@@ -722,6 +758,7 @@ def pip_install(
|
|
722
758
|
check_pypi: bool = True,
|
723
759
|
check_wheel: bool = True,
|
724
760
|
_uninstall: bool = False,
|
761
|
+
_from_completely_uninstall: bool = False,
|
725
762
|
_install_uv_pip: bool = True,
|
726
763
|
color: bool = True,
|
727
764
|
silent: bool = False,
|
@@ -791,10 +828,17 @@ def pip_install(
|
|
791
828
|
|
792
829
|
_args = list(args)
|
793
830
|
have_pip = venv_contains_package('pip', venv=None, debug=debug)
|
831
|
+
try:
|
832
|
+
import pip
|
833
|
+
have_pip = True
|
834
|
+
except ImportError:
|
835
|
+
have_pip = False
|
794
836
|
try:
|
795
837
|
import uv
|
838
|
+
uv_bin = uv.find_uv_bin()
|
796
839
|
have_uv_pip = True
|
797
|
-
except ImportError:
|
840
|
+
except (ImportError, FileNotFoundError):
|
841
|
+
uv_bin = None
|
798
842
|
have_uv_pip = False
|
799
843
|
if have_pip and not have_uv_pip and _install_uv_pip:
|
800
844
|
if not pip_install(
|
@@ -811,11 +855,11 @@ def pip_install(
|
|
811
855
|
color = False,
|
812
856
|
)
|
813
857
|
|
814
|
-
use_uv_pip = venv_contains_package('uv', venv=None, debug=debug)
|
858
|
+
use_uv_pip = venv_contains_package('uv', venv=None, debug=debug) and uv_bin is not None
|
815
859
|
|
816
860
|
import sys
|
817
861
|
if not have_pip and not use_uv_pip:
|
818
|
-
if not get_pip(venv=venv, debug=debug):
|
862
|
+
if not get_pip(venv=venv, color=color, debug=debug):
|
819
863
|
import sys
|
820
864
|
minor = sys.version_info.minor
|
821
865
|
print(
|
@@ -853,7 +897,7 @@ def pip_install(
|
|
853
897
|
if check_wheel and not _uninstall and not use_uv_pip:
|
854
898
|
if not have_wheel:
|
855
899
|
if not pip_install(
|
856
|
-
'setuptools', 'wheel',
|
900
|
+
'setuptools', 'wheel', 'uv',
|
857
901
|
venv = venv,
|
858
902
|
check_update = False,
|
859
903
|
check_pypi = False,
|
@@ -863,7 +907,7 @@ def pip_install(
|
|
863
907
|
):
|
864
908
|
warn(
|
865
909
|
(
|
866
|
-
"Failed to install `setuptools` and `
|
910
|
+
"Failed to install `setuptools`, `wheel`, and `uv` for virtual "
|
867
911
|
+ f"environment '{venv}'."
|
868
912
|
),
|
869
913
|
color = False,
|
@@ -888,7 +932,7 @@ def pip_install(
|
|
888
932
|
if '--disable-pip-version-check' not in _args and not use_uv_pip:
|
889
933
|
_args.append('--disable-pip-version-check')
|
890
934
|
|
891
|
-
if '--target' not in _args and '-t' not in _args and not _uninstall:
|
935
|
+
if '--target' not in _args and '-t' not in _args and not (not use_uv_pip and _uninstall):
|
892
936
|
if venv is not None:
|
893
937
|
_args += ['--target', venv_target_path(venv, debug=debug)]
|
894
938
|
elif (
|
@@ -899,8 +943,6 @@ def pip_install(
|
|
899
943
|
and not use_uv_pip
|
900
944
|
):
|
901
945
|
_args += ['--user']
|
902
|
-
if '--break-system-packages' not in _args and not _uninstall:
|
903
|
-
_args.append('--break-system-packages')
|
904
946
|
|
905
947
|
if debug:
|
906
948
|
if '-v' not in _args or '-vv' not in _args or '-vvv' not in _args:
|
@@ -920,10 +962,10 @@ def pip_install(
|
|
920
962
|
if not silent:
|
921
963
|
print(msg)
|
922
964
|
|
923
|
-
if _uninstall:
|
965
|
+
if _uninstall and not _from_completely_uninstall and not use_uv_pip:
|
924
966
|
for install_name in _packages:
|
925
967
|
_install_no_version = get_install_no_version(install_name)
|
926
|
-
if _install_no_version in ('pip', 'wheel'):
|
968
|
+
if _install_no_version in ('pip', 'wheel', 'uv'):
|
927
969
|
continue
|
928
970
|
if not completely_uninstall_package(
|
929
971
|
_install_no_version,
|
@@ -933,16 +975,17 @@ def pip_install(
|
|
933
975
|
f"Failed to clean up package '{_install_no_version}'.",
|
934
976
|
)
|
935
977
|
|
978
|
+
### NOTE: Only append the `--prerelease=allow` flag if we explicitly depend on a prerelease.
|
936
979
|
if use_uv_pip:
|
937
980
|
_args.insert(0, 'pip')
|
938
|
-
if not _uninstall:
|
981
|
+
if not _uninstall and get_prerelease_dependencies(_packages):
|
939
982
|
_args.append('--prerelease=allow')
|
940
983
|
|
941
984
|
rc = run_python_package(
|
942
985
|
('pip' if not use_uv_pip else 'uv'),
|
943
986
|
_args + _packages,
|
944
987
|
venv = None,
|
945
|
-
env = _get_pip_os_env(),
|
988
|
+
env = _get_pip_os_env(color=color),
|
946
989
|
debug = debug,
|
947
990
|
)
|
948
991
|
if debug:
|
@@ -960,6 +1003,33 @@ def pip_install(
|
|
960
1003
|
return success
|
961
1004
|
|
962
1005
|
|
1006
|
+
def get_prerelease_dependencies(_packages: Optional[List[str]] = None):
|
1007
|
+
"""
|
1008
|
+
Return a list of explicitly prerelease dependencies from a list of packages.
|
1009
|
+
"""
|
1010
|
+
if _packages is None:
|
1011
|
+
_packages = list(all_packages.keys())
|
1012
|
+
prelrease_strings = ['dev', 'rc', 'a']
|
1013
|
+
prerelease_packages = []
|
1014
|
+
for install_name in _packages:
|
1015
|
+
_install_no_version = get_install_no_version(install_name)
|
1016
|
+
import_name = _install_to_import_name(install_name)
|
1017
|
+
install_with_version = _import_to_install_name(import_name)
|
1018
|
+
version_only = (
|
1019
|
+
install_with_version.lower().replace(_install_no_version.lower(), '')
|
1020
|
+
.split(']')[-1]
|
1021
|
+
)
|
1022
|
+
|
1023
|
+
is_prerelease = False
|
1024
|
+
for prelrease_string in prelrease_strings:
|
1025
|
+
if prelrease_string in version_only:
|
1026
|
+
is_prerelease = True
|
1027
|
+
|
1028
|
+
if is_prerelease:
|
1029
|
+
prerelease_packages.append(install_name)
|
1030
|
+
return prerelease_packages
|
1031
|
+
|
1032
|
+
|
963
1033
|
def completely_uninstall_package(
|
964
1034
|
install_name: str,
|
965
1035
|
venv: str = 'mrsm',
|
@@ -986,7 +1056,7 @@ def completely_uninstall_package(
|
|
986
1056
|
continue
|
987
1057
|
installed_versions.append(file_name)
|
988
1058
|
|
989
|
-
max_attempts = len(installed_versions)
|
1059
|
+
max_attempts = len(installed_versions)
|
990
1060
|
while attempts < max_attempts:
|
991
1061
|
if not venv_contains_package(
|
992
1062
|
_install_to_import_name(_install_no_version),
|
@@ -995,8 +1065,10 @@ def completely_uninstall_package(
|
|
995
1065
|
return True
|
996
1066
|
if not pip_uninstall(
|
997
1067
|
_install_no_version,
|
998
|
-
venv=venv,
|
999
|
-
silent=(not debug),
|
1068
|
+
venv = venv,
|
1069
|
+
silent = (not debug),
|
1070
|
+
_from_completely_uninstall = True,
|
1071
|
+
debug = debug,
|
1000
1072
|
):
|
1001
1073
|
return False
|
1002
1074
|
attempts += 1
|
@@ -1121,9 +1193,10 @@ def attempt_import(
|
|
1121
1193
|
check_update: bool = False,
|
1122
1194
|
check_pypi: bool = False,
|
1123
1195
|
check_is_installed: bool = True,
|
1196
|
+
allow_outside_venv: bool = True,
|
1124
1197
|
color: bool = True,
|
1125
1198
|
debug: bool = False
|
1126
|
-
) ->
|
1199
|
+
) -> Any:
|
1127
1200
|
"""
|
1128
1201
|
Raise a warning if packages are not installed; otherwise import and return modules.
|
1129
1202
|
If `lazy` is `True`, return lazy-imported modules.
|
@@ -1166,6 +1239,15 @@ def attempt_import(
|
|
1166
1239
|
check_is_installed: bool, default True
|
1167
1240
|
If `True`, check if the package is contained in the virtual environment.
|
1168
1241
|
|
1242
|
+
allow_outside_venv: bool, default True
|
1243
|
+
If `True`, search outside of the specified virtual environment
|
1244
|
+
if the package cannot be found.
|
1245
|
+
Setting to `False` will reinstall the package into a virtual environment, even if it
|
1246
|
+
is installed outside.
|
1247
|
+
|
1248
|
+
color: bool, default True
|
1249
|
+
If `False`, do not print ANSI colors.
|
1250
|
+
|
1169
1251
|
Returns
|
1170
1252
|
-------
|
1171
1253
|
The specified modules. If they're not available and `install` is `True`, it will first
|
@@ -1247,6 +1329,7 @@ def attempt_import(
|
|
1247
1329
|
name,
|
1248
1330
|
venv = venv,
|
1249
1331
|
split = split,
|
1332
|
+
allow_outside_venv = allow_outside_venv,
|
1250
1333
|
debug = debug,
|
1251
1334
|
)
|
1252
1335
|
_is_installed_first_check[name] = package_is_installed
|
@@ -1392,7 +1475,9 @@ def import_rich(
|
|
1392
1475
|
'pygments', lazy=False,
|
1393
1476
|
)
|
1394
1477
|
rich = attempt_import(
|
1395
|
-
'rich', lazy=lazy,
|
1478
|
+
'rich', lazy=lazy,
|
1479
|
+
**kw
|
1480
|
+
)
|
1396
1481
|
return rich
|
1397
1482
|
|
1398
1483
|
|
@@ -1626,10 +1711,26 @@ def is_installed(
|
|
1626
1711
|
import_name: str,
|
1627
1712
|
venv: Optional[str] = 'mrsm',
|
1628
1713
|
split: bool = True,
|
1714
|
+
allow_outside_venv: bool = True,
|
1629
1715
|
debug: bool = False,
|
1630
1716
|
) -> bool:
|
1631
1717
|
"""
|
1632
1718
|
Check whether a package is installed.
|
1719
|
+
|
1720
|
+
Parameters
|
1721
|
+
----------
|
1722
|
+
import_name: str
|
1723
|
+
The import name of the module.
|
1724
|
+
|
1725
|
+
venv: Optional[str], default 'mrsm'
|
1726
|
+
The venv in which to search for the module.
|
1727
|
+
|
1728
|
+
split: bool, default True
|
1729
|
+
If `True`, split on periods to determine the root module name.
|
1730
|
+
|
1731
|
+
allow_outside_venv: bool, default True
|
1732
|
+
If `True`, search outside of the specified virtual environment
|
1733
|
+
if the package cannot be found.
|
1633
1734
|
"""
|
1634
1735
|
if debug:
|
1635
1736
|
from meerschaum.utils.debug import dprint
|
@@ -1640,7 +1741,11 @@ def is_installed(
|
|
1640
1741
|
spec_path = pathlib.Path(
|
1641
1742
|
get_module_path(root_name, venv=venv, debug=debug)
|
1642
1743
|
or
|
1643
|
-
|
1744
|
+
(
|
1745
|
+
importlib.util.find_spec(root_name).origin
|
1746
|
+
if venv is not None and allow_outside_venv
|
1747
|
+
else None
|
1748
|
+
)
|
1644
1749
|
)
|
1645
1750
|
except (ModuleNotFoundError, ValueError, AttributeError, TypeError) as e:
|
1646
1751
|
spec_path = None
|
@@ -1669,6 +1774,8 @@ def venv_contains_package(
|
|
1669
1774
|
"""
|
1670
1775
|
Search the contents of a virtual environment for a package.
|
1671
1776
|
"""
|
1777
|
+
import site
|
1778
|
+
import pathlib
|
1672
1779
|
root_name = import_name.split('.')[0] if split else import_name
|
1673
1780
|
return get_module_path(root_name, venv=venv, debug=debug) is not None
|
1674
1781
|
|
@@ -1732,7 +1839,7 @@ def _monkey_patch_get_distribution(_dist: str, _version: str) -> None:
|
|
1732
1839
|
pkg_resources.get_distribution = _get_distribution
|
1733
1840
|
|
1734
1841
|
|
1735
|
-
def _get_pip_os_env():
|
1842
|
+
def _get_pip_os_env(color: bool = True):
|
1736
1843
|
"""
|
1737
1844
|
Return the environment variables context in which `pip` should be run.
|
1738
1845
|
See PEP 668 for why we are overriding the environment.
|
@@ -1741,5 +1848,6 @@ def _get_pip_os_env():
|
|
1741
1848
|
pip_os_env = os.environ.copy()
|
1742
1849
|
pip_os_env.update({
|
1743
1850
|
'PIP_BREAK_SYSTEM_PACKAGES': 'true',
|
1851
|
+
('FORCE_COLOR' if color else 'NO_COLOR'): '1',
|
1744
1852
|
})
|
1745
1853
|
return pip_os_env
|
@@ -119,7 +119,7 @@ packages: Dict[str, Dict[str, str]] = {
|
|
119
119
|
},
|
120
120
|
}
|
121
121
|
packages['sql'] = {
|
122
|
-
'numpy' : 'numpy
|
122
|
+
'numpy' : 'numpy<2.0.0',
|
123
123
|
'pandas' : 'pandas[parquet]>=2.0.1',
|
124
124
|
'pyarrow' : 'pyarrow>=16.1.0',
|
125
125
|
'dask' : 'dask[dataframe]>=2024.5.1',
|
meerschaum/utils/process.py
CHANGED
@@ -9,10 +9,16 @@ See `meerschaum.utils.pool` for multiprocessing and
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
from __future__ import annotations
|
12
|
-
import os, signal, subprocess, sys, platform
|
12
|
+
import os, signal, subprocess, sys, platform, traceback
|
13
13
|
from meerschaum.utils.typing import Union, Optional, Any, Callable, Dict, Tuple
|
14
14
|
from meerschaum.config.static import STATIC_CONFIG
|
15
15
|
|
16
|
+
_child_processes = []
|
17
|
+
def signal_handler(sig, frame):
|
18
|
+
for child in _child_processes:
|
19
|
+
child.send_signal(sig)
|
20
|
+
child.wait()
|
21
|
+
|
16
22
|
def run_process(
|
17
23
|
*args,
|
18
24
|
foreground: bool = False,
|
@@ -73,6 +79,7 @@ def run_process(
|
|
73
79
|
sys.stdout.write(line.decode('utf-8'))
|
74
80
|
sys.stdout.flush()
|
75
81
|
|
82
|
+
|
76
83
|
if capture_output or line_callback is not None:
|
77
84
|
kw['stdout'] = subprocess.PIPE
|
78
85
|
kw['stderr'] = subprocess.STDOUT
|
@@ -123,6 +130,7 @@ def run_process(
|
|
123
130
|
|
124
131
|
try:
|
125
132
|
child = subprocess.Popen(*args, **kw)
|
133
|
+
_child_processes.append(child)
|
126
134
|
|
127
135
|
# we can't set the process group id from the parent since the child
|
128
136
|
# will already have exec'd. and we can't SIGSTOP it before exec,
|
@@ -147,7 +155,9 @@ def run_process(
|
|
147
155
|
store_proc_dict[store_proc_key] = child
|
148
156
|
_ret = poll_process(child, line_callback) if line_callback is not None else child.wait()
|
149
157
|
ret = _ret if not as_proc else child
|
150
|
-
|
158
|
+
except KeyboardInterrupt:
|
159
|
+
child.send_signal(signal.SIGINT)
|
160
|
+
ret = child.wait() if not as_proc else child
|
151
161
|
finally:
|
152
162
|
if foreground:
|
153
163
|
# we have to mask SIGTTOU because tcsetpgrp
|
@@ -15,7 +15,7 @@ __all__ = sorted([
|
|
15
15
|
'activate_venv', 'deactivate_venv', 'init_venv',
|
16
16
|
'inside_venv', 'is_venv_active', 'venv_exec',
|
17
17
|
'venv_executable', 'venv_exists', 'venv_target_path',
|
18
|
-
'Venv', 'get_venvs', 'verify_venv',
|
18
|
+
'Venv', 'get_venvs', 'verify_venv', 'get_module_venv',
|
19
19
|
])
|
20
20
|
__pdoc__ = {'Venv': True}
|
21
21
|
|
@@ -79,7 +79,7 @@ def activate_venv(
|
|
79
79
|
else:
|
80
80
|
threads_active_venvs[thread_id][venv] += 1
|
81
81
|
|
82
|
-
target =
|
82
|
+
target = venv_target_path(venv, debug=debug).as_posix()
|
83
83
|
if venv in active_venvs_order:
|
84
84
|
sys.path.remove(target)
|
85
85
|
try:
|
@@ -171,7 +171,7 @@ def deactivate_venv(
|
|
171
171
|
if sys.path is None:
|
172
172
|
return False
|
173
173
|
|
174
|
-
target =
|
174
|
+
target = venv_target_path(venv, allow_nonexistent=force, debug=debug).as_posix()
|
175
175
|
with LOCKS['sys.path']:
|
176
176
|
if target in sys.path:
|
177
177
|
sys.path.remove(target)
|
@@ -709,4 +709,28 @@ def get_venvs() -> List[str]:
|
|
709
709
|
return venvs
|
710
710
|
|
711
711
|
|
712
|
+
def get_module_venv(module) -> Union[str, None]:
|
713
|
+
"""
|
714
|
+
Return the virtual environment where an imported module is installed.
|
715
|
+
|
716
|
+
Parameters
|
717
|
+
----------
|
718
|
+
module: ModuleType
|
719
|
+
The imported module to inspect.
|
720
|
+
|
721
|
+
Returns
|
722
|
+
-------
|
723
|
+
The name of a venv or `None`.
|
724
|
+
"""
|
725
|
+
import pathlib
|
726
|
+
from meerschaum.config.paths import VIRTENV_RESOURCES_PATH
|
727
|
+
module_path = pathlib.Path(module.__file__).resolve()
|
728
|
+
try:
|
729
|
+
rel_path = module_path.relative_to(VIRTENV_RESOURCES_PATH)
|
730
|
+
except ValueError:
|
731
|
+
return None
|
732
|
+
|
733
|
+
return rel_path.as_posix().split('/', maxsplit=1)[0]
|
734
|
+
|
735
|
+
|
712
736
|
from meerschaum.utils.venv._Venv import Venv
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: meerschaum
|
3
|
-
Version: 2.2.
|
3
|
+
Version: 2.2.2rc3
|
4
4
|
Summary: Sync Time-Series Pipes with Meerschaum
|
5
5
|
Home-page: https://meerschaum.io
|
6
6
|
Author: Bennett Meares
|
@@ -40,7 +40,7 @@ Requires-Dist: fastapi >=0.111.0 ; extra == 'api'
|
|
40
40
|
Requires-Dist: fastapi-login >=1.7.2 ; extra == 'api'
|
41
41
|
Requires-Dist: python-multipart >=0.0.9 ; extra == 'api'
|
42
42
|
Requires-Dist: httpx >=0.24.1 ; extra == 'api'
|
43
|
-
Requires-Dist: numpy
|
43
|
+
Requires-Dist: numpy <2.0.0 ; extra == 'api'
|
44
44
|
Requires-Dist: pandas[parquet] >=2.0.1 ; extra == 'api'
|
45
45
|
Requires-Dist: pyarrow >=16.1.0 ; extra == 'api'
|
46
46
|
Requires-Dist: dask[dataframe] >=2024.5.1 ; extra == 'api'
|
@@ -225,7 +225,7 @@ Requires-Dist: duckdb-engine >=0.13.0 ; extra == 'full'
|
|
225
225
|
Requires-Dist: toga >=0.3.0-dev29 ; extra == 'full'
|
226
226
|
Requires-Dist: pywebview >=3.6.3 ; extra == 'full'
|
227
227
|
Requires-Dist: pycparser >=2.21.0 ; extra == 'full'
|
228
|
-
Requires-Dist: numpy
|
228
|
+
Requires-Dist: numpy <2.0.0 ; extra == 'full'
|
229
229
|
Requires-Dist: pandas[parquet] >=2.0.1 ; extra == 'full'
|
230
230
|
Requires-Dist: pyarrow >=16.1.0 ; extra == 'full'
|
231
231
|
Requires-Dist: dask[dataframe] >=2024.5.1 ; extra == 'full'
|
@@ -259,7 +259,7 @@ Provides-Extra: minimal
|
|
259
259
|
Provides-Extra: required
|
260
260
|
Provides-Extra: setup
|
261
261
|
Provides-Extra: sql
|
262
|
-
Requires-Dist: numpy
|
262
|
+
Requires-Dist: numpy <2.0.0 ; extra == 'sql'
|
263
263
|
Requires-Dist: pandas[parquet] >=2.0.1 ; extra == 'sql'
|
264
264
|
Requires-Dist: pyarrow >=16.1.0 ; extra == 'sql'
|
265
265
|
Requires-Dist: dask[dataframe] >=2024.5.1 ; extra == 'sql'
|