AMR 2.1.1.9220__py3-none-any.whl → 2.1.1.9222__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.
- AMR/datasets.py +17 -19
- {amr-2.1.1.9220.dist-info → amr-2.1.1.9222.dist-info}/METADATA +2 -2
- amr-2.1.1.9222.dist-info/RECORD +7 -0
- {amr-2.1.1.9220.dist-info → amr-2.1.1.9222.dist-info}/WHEEL +1 -1
- amr-2.1.1.9220.dist-info/RECORD +0 -7
- {amr-2.1.1.9220.dist-info → amr-2.1.1.9222.dist-info}/top_level.txt +0 -0
AMR/datasets.py
CHANGED
@@ -1,45 +1,43 @@
|
|
1
1
|
import os
|
2
2
|
import sys
|
3
|
-
from rpy2 import robjects
|
4
|
-
from rpy2.robjects import pandas2ri
|
5
|
-
from rpy2.robjects.packages import importr, isinstalled
|
6
3
|
import pandas as pd
|
7
4
|
import importlib.metadata as metadata
|
8
5
|
|
9
6
|
# Get the path to the virtual environment
|
10
7
|
venv_path = sys.prefix
|
11
|
-
|
12
|
-
# Define R library path within the venv
|
13
8
|
r_lib_path = os.path.join(venv_path, "R_libs")
|
14
|
-
# Ensure the R library path exists
|
15
9
|
os.makedirs(r_lib_path, exist_ok=True)
|
16
10
|
|
11
|
+
# Set environment variable before importing rpy2
|
12
|
+
os.environ['R_LIBS_SITE'] = r_lib_path
|
13
|
+
|
14
|
+
from rpy2 import robjects
|
15
|
+
from rpy2.robjects import pandas2ri
|
16
|
+
from rpy2.robjects.packages import importr, isinstalled
|
17
|
+
|
17
18
|
# Import base and utils
|
18
19
|
base = importr('base')
|
19
20
|
utils = importr('utils')
|
20
21
|
|
21
|
-
base.options(warn
|
22
|
-
|
23
|
-
# Override R library paths globally for the session
|
24
|
-
robjects.r(f'.Library.site <- "{r_lib_path}"') # Replace site-specific library
|
25
|
-
base._libPaths(r_lib_path) # Override .libPaths() as well
|
22
|
+
base.options(warn=-1)
|
26
23
|
|
27
|
-
#
|
28
|
-
|
24
|
+
# Ensure library paths explicitly
|
25
|
+
base._libPaths(r_lib_path)
|
29
26
|
|
30
27
|
# Check if the AMR package is installed in R
|
31
|
-
if not isinstalled('AMR', lib_loc=
|
32
|
-
print(f"AMR: Installing latest AMR R package to {
|
28
|
+
if not isinstalled('AMR', lib_loc=r_lib_path):
|
29
|
+
print(f"AMR: Installing latest AMR R package to {r_lib_path}...", flush=True)
|
33
30
|
utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
|
34
31
|
|
35
|
-
# Python
|
32
|
+
# Retrieve Python AMR version
|
36
33
|
try:
|
37
34
|
python_amr_version = metadata.version('AMR')
|
38
35
|
except metadata.PackageNotFoundError:
|
39
36
|
python_amr_version = ''
|
40
37
|
|
41
|
-
# R
|
42
|
-
r_amr_version = robjects.r(f'as.character(packageVersion("AMR", lib.loc = "{
|
38
|
+
# Retrieve R AMR version
|
39
|
+
r_amr_version = robjects.r(f'as.character(packageVersion("AMR", lib.loc = "{r_lib_path}"))')
|
40
|
+
r_amr_version = str(r_amr_version[0])
|
43
41
|
|
44
42
|
print(python_amr_version)
|
45
43
|
print(r_amr_version)
|
@@ -47,7 +45,7 @@ print(r_amr_version)
|
|
47
45
|
# Compare R and Python package versions
|
48
46
|
if r_amr_version != python_amr_version:
|
49
47
|
try:
|
50
|
-
print(f"AMR: Updating AMR package in {
|
48
|
+
print(f"AMR: Updating AMR package in {r_lib_path}...", flush=True)
|
51
49
|
utils.install_packages('AMR', repos='https://msberends.r-universe.dev', quiet=True)
|
52
50
|
except Exception as e:
|
53
51
|
print(f"AMR: Could not update: {e}", flush=True)
|
@@ -0,0 +1,7 @@
|
|
1
|
+
AMR/__init__.py,sha256=CqpcLv7M6mte09zdHYPzBuHJQeFAqJ4s2uN_rExYfoM,7730
|
2
|
+
AMR/datasets.py,sha256=BwauDkIaXKnIrIxxMc8oa46PPnvC1FQOrr_9aMo0uwo,2496
|
3
|
+
AMR/functions.py,sha256=91Tl9Jh6sbu-1xUvlst9VyQB5HJOe6ZCNhjtPpnLuik,46722
|
4
|
+
amr-2.1.1.9222.dist-info/METADATA,sha256=7_VWyOKNs1uFKZm1-t-O7fDfENV-vAvoZRKmhv0vaDg,10095
|
5
|
+
amr-2.1.1.9222.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
|
6
|
+
amr-2.1.1.9222.dist-info/top_level.txt,sha256=7K6Mq_X_OHdXOzQM5y06VUadXjYkze6yzufL1d7_6xc,4
|
7
|
+
amr-2.1.1.9222.dist-info/RECORD,,
|
amr-2.1.1.9220.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
AMR/__init__.py,sha256=CqpcLv7M6mte09zdHYPzBuHJQeFAqJ4s2uN_rExYfoM,7730
|
2
|
-
AMR/datasets.py,sha256=Fc9Ogxehhthw2T7qVc758zWdYkkztDYyWH4RRMwekcI,2667
|
3
|
-
AMR/functions.py,sha256=91Tl9Jh6sbu-1xUvlst9VyQB5HJOe6ZCNhjtPpnLuik,46722
|
4
|
-
amr-2.1.1.9220.dist-info/METADATA,sha256=IC1zGwCDMXU4UIika_3fe6Vw6V2Lqu_fiRqg0tEVXtk,10095
|
5
|
-
amr-2.1.1.9220.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
6
|
-
amr-2.1.1.9220.dist-info/top_level.txt,sha256=7K6Mq_X_OHdXOzQM5y06VUadXjYkze6yzufL1d7_6xc,4
|
7
|
-
amr-2.1.1.9220.dist-info/RECORD,,
|
File without changes
|