lmod-toolkit 0.0.4__tar.gz → 0.0.5__tar.gz

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.
Files changed (26) hide show
  1. {lmod_toolkit-0.0.4/src/lmod_toolkit.egg-info → lmod_toolkit-0.0.5}/PKG-INFO +1 -1
  2. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/setup.sh +23 -3
  3. lmod_toolkit-0.0.5/src/lmod_toolkit/__init__.py +1 -0
  4. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit/_version.py +3 -3
  5. lmod_toolkit-0.0.5/src/lmod_toolkit/bin/lmtk-test.sh +10 -0
  6. lmod_toolkit-0.0.5/src/lmod_toolkit/lmod_ext_attrs.py +79 -0
  7. lmod_toolkit-0.0.5/src/lmod_toolkit/test.py +14 -0
  8. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5/src/lmod_toolkit.egg-info}/PKG-INFO +1 -1
  9. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit.egg-info/SOURCES.txt +3 -0
  10. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit.egg-info/scm_file_list.json +3 -0
  11. lmod_toolkit-0.0.5/src/lmod_toolkit.egg-info/scm_version.json +8 -0
  12. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/utils/quickstart.sh +6 -2
  13. lmod_toolkit-0.0.4/src/lmod_toolkit/__init__.py +0 -1
  14. lmod_toolkit-0.0.4/src/lmod_toolkit.egg-info/scm_version.json +0 -8
  15. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/.github/workflows/publish-to-test-pypi.yml +0 -0
  16. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/.gitignore +0 -0
  17. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/README.md +0 -0
  18. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/README.pypi +0 -0
  19. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/pyproject.toml +0 -0
  20. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/setup.cfg +0 -0
  21. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit/build_helper.py +0 -0
  22. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit/lmod_config.py +0 -0
  23. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit/lmod_spider.py +0 -0
  24. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit.egg-info/dependency_links.txt +0 -0
  25. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/src/lmod_toolkit.egg-info/top_level.txt +0 -0
  26. {lmod_toolkit-0.0.4 → lmod_toolkit-0.0.5}/utils/uv_installer.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lmod-toolkit
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: ACCESS Lmod Toolkit
5
5
  Author-email: Andy Loftus <aloftus@illinois.edu>, Eric Blau <blau@globus.org>
6
6
  Project-URL: Repository, https://github.com/access-ci-org/lmod-toolkit
@@ -118,18 +118,38 @@ is_pre_release_allowed() {
118
118
  }
119
119
 
120
120
 
121
+ is_upgrade_allowed() {
122
+ # to enable upgrade of lmod-toolkit: export $LMTK_ALLOW_UPGRADE=yes
123
+ [[ $DEBUG -eq $YES ]] && set -x
124
+ local _retval=$NO
125
+ if [[ "$LMTK_ALLOW_UPGRADE" == "yes" \
126
+ || "$LMTK_ALLOW_UPGRADE" == "YES" \
127
+ || "$LMTK_ALLOW_UPGRADE" == "Y" \
128
+ || "$LMTK_ALLOW_UPGRADE" == "y" \
129
+ || "$LMTK_ALLOW_UPGRADE" -eq 1
130
+ ]] ; then
131
+ _retval=$YES
132
+ fi
133
+ return $_retval
134
+ }
135
+
136
+
121
137
  install_lmod_toolkit() {
122
138
  [[ $DEBUG -eq $YES ]] && set -x
123
- export UV_DEFAULT_INDEX=https://pypi.org/simple
139
+ local -a _cli_opts
140
+ is_upgrade_allowed && {
141
+ _cli_opts+=( '--upgrade' )
142
+ }
124
143
  is_pre_release_allowed && {
125
144
  export UV_INDEX=https://test.pypi.org/simple
126
- export UV_PRERELEASE=allow
145
+ _cli_opts+=( '--prerelease-package' 'lmod-toolkit=allow' )
127
146
  }
147
+ export UV_DEFAULT_INDEX=https://pypi.org/simple
128
148
  pushd "${INSTALL_DIR}"
129
149
  "${UV}" pip install \
150
+ "${_cli_opts[@]}" \
130
151
  lmod-toolkit"${LMTK_INSTALL_VERSION:+==$LMTK_INSTALL_VERSION}"
131
152
  popd
132
-
133
153
  }
134
154
 
135
155
 
@@ -0,0 +1 @@
1
+ from . import lmod_config, lmod_spider, lmod_ext_attrs
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.0.4'
22
- __version_tuple__ = version_tuple = (0, 0, 4)
21
+ __version__ = version = '0.0.5'
22
+ __version_tuple__ = version_tuple = (0, 0, 5)
23
23
 
24
- __commit_id__ = commit_id = 'g9727bc061'
24
+ __commit_id__ = commit_id = 'g772328371'
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/bash
2
+
3
+ INSTALL_DIR=___INSTALL_DIR___
4
+ V_PYTHON="${INSTALLL_DIR}"/.venv/bin/python
5
+ SITE_PACKAGES=$(
6
+ "${V_PYTHON}" -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'
7
+ )
8
+ LMTK_PATH="${SITE_PACKAGES}"/lmod_toolkit
9
+
10
+ "${V_PYTHON}" "${LMTK_PATH}"/test.py
@@ -0,0 +1,79 @@
1
+ import functools
2
+ import json
3
+ import pprint
4
+ import re
5
+
6
+ from pathlib import Path
7
+
8
+ from lmod_toolkit import lmod_spider
9
+
10
+ __all__ = [
11
+ 'as_json',
12
+ 'get_ext_attrs',
13
+ ]
14
+
15
+ EXTATTR_KEYS = [
16
+ 'Name',
17
+ 'Version',
18
+ '.*escription',
19
+ 'URL',
20
+ 'Category',
21
+ 'Keywords',
22
+ 'SupportStatus',
23
+ 'SupportContact',
24
+ 'Default',
25
+ 'IPF_FLAGS',
26
+ ]
27
+ LONGEST_FIRST = sorted(EXTATTR_KEYS, key=len, reverse=True)
28
+ WHATIS_RE = re.compile(r'whatis\(\[\[((?:{}))\s*:\s*(.*)\]\]\)'.format('|'.join(LONGEST_FIRST)))
29
+ COMMENT_RE = re.compile(r'\"((?:{})):([^\"]+)\"'.format('|'.join(LONGEST_FIRST)))
30
+
31
+
32
+ @functools.cache
33
+ def get_ext_attrs():
34
+ ''' Search through all modules' lua files for any extended attributes.
35
+ Extended attributes are non-lmod supported data added to a lua file.
36
+ '''
37
+ ext_attrs = {}
38
+ for module in lmod_spider.get_module_data():
39
+ for version in module[ 'versions' ]:
40
+ path = version[ 'path' ]
41
+ # skip non-lua files
42
+ if not path.endswith(".lua"):
43
+ #logr.debug( f"skipping non-lua file {path}" )
44
+ print( f"skipping non-lua file {path}" )
45
+ continue
46
+ filepath = Path( path )
47
+ try:
48
+ file_contents = filepath.read_text()
49
+ except ( FileNotFoundError, PermissionError, IOError ) as e:
50
+ #logr.debug( f"error opening file '{filepath}' {e}" )
51
+ print( f"error opening file '{filepath}' {e}" )
52
+ continue
53
+ ext_data = get_ext_attrs_from_lua_file( file_contents )
54
+ if ext_data:
55
+ full_name = version[ 'full' ]
56
+ ext_attrs[ full_name ] = ext_data
57
+ return ext_attrs
58
+
59
+
60
+ def get_ext_attrs_from_lua_file( text: str ) -> dict:
61
+ ''' text parsing taken from
62
+ https://github.com/access-ci-org/ipf/blob/3e419ebb/ipf/glue2/modules.py#L444
63
+ '''
64
+ whatis_res = WHATIS_RE.findall(text)
65
+ comment_res = COMMENT_RE.findall(text)
66
+ # Return all tuples found, allow "comment" to override "whatis"
67
+ ext_attrs = {
68
+ k: v
69
+ for k, v in whatis_res+comment_res
70
+ }
71
+ return ext_attrs
72
+
73
+
74
+ def as_json():
75
+ return json.dumps( get_ext_attrs() )
76
+
77
+
78
+ if __name__ == '__main__':
79
+ pprint.pprint( get_ext_attrs() )
@@ -0,0 +1,14 @@
1
+
2
+ import lmod_toolkit as lmtk
3
+
4
+ print( '\nLMOD CONFIG' )
5
+ print( '===========' )
6
+ print( lmtk.lmod_config.as_json() )
7
+
8
+ print( '\nLMOD SPIDER' )
9
+ print( '===========' )
10
+ print( lmtk.lmod_spider.as_json() )
11
+
12
+ print( '\nLMOD EXT ATTRS' )
13
+ print( '==============' )
14
+ print( lmtk.lmod_ext_attrs.as_json() )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lmod-toolkit
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: ACCESS Lmod Toolkit
5
5
  Author-email: Andy Loftus <aloftus@illinois.edu>, Eric Blau <blau@globus.org>
6
6
  Project-URL: Repository, https://github.com/access-ci-org/lmod-toolkit
@@ -8,12 +8,15 @@ src/lmod_toolkit/__init__.py
8
8
  src/lmod_toolkit/_version.py
9
9
  src/lmod_toolkit/build_helper.py
10
10
  src/lmod_toolkit/lmod_config.py
11
+ src/lmod_toolkit/lmod_ext_attrs.py
11
12
  src/lmod_toolkit/lmod_spider.py
13
+ src/lmod_toolkit/test.py
12
14
  src/lmod_toolkit.egg-info/PKG-INFO
13
15
  src/lmod_toolkit.egg-info/SOURCES.txt
14
16
  src/lmod_toolkit.egg-info/dependency_links.txt
15
17
  src/lmod_toolkit.egg-info/scm_file_list.json
16
18
  src/lmod_toolkit.egg-info/scm_version.json
17
19
  src/lmod_toolkit.egg-info/top_level.txt
20
+ src/lmod_toolkit/bin/lmtk-test.sh
18
21
  utils/quickstart.sh
19
22
  utils/uv_installer.sh
@@ -7,9 +7,12 @@
7
7
  "pyproject.toml",
8
8
  "setup.sh",
9
9
  "src/lmod_toolkit/__init__.py",
10
+ "src/lmod_toolkit/bin/lmtk-test.sh",
10
11
  "src/lmod_toolkit/build_helper.py",
11
12
  "src/lmod_toolkit/lmod_config.py",
13
+ "src/lmod_toolkit/lmod_ext_attrs.py",
12
14
  "src/lmod_toolkit/lmod_spider.py",
15
+ "src/lmod_toolkit/test.py",
13
16
  "utils/quickstart.sh",
14
17
  "utils/uv_installer.sh"
15
18
  ]
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.0.5",
3
+ "distance": 0,
4
+ "node": "g772328371eff4a673f8284183d36aa2ccc19c951",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-11-18"
8
+ }
@@ -19,6 +19,9 @@ LMTK_INSTALL_DIR="${HOME}"/lmod-toolkit
19
19
  # set to "yes" or leave unset (defaults to latest)
20
20
  # LMTK_ALLOW_PRE_RELEASE=yes
21
21
 
22
+ # set to "yes" to enable upgrading lmod-toolkit
23
+ # LMTK_ALLOW_UPGRADE=yes
24
+
22
25
  # specify an exact version of LMTK
23
26
  # get version string from
24
27
  # https://pypi.org/project/lmod-toolkit/#history (production releases)
@@ -52,6 +55,7 @@ VENV="${LMTK_INSTALL_DIR}"/.venv
52
55
  export LMTK_UV_URL
53
56
  export LMTK_INSTALL_DIR
54
57
  [[ -n "${LMTK_ALLOW_PRE_RELEASE}" ]] && export LMTK_ALLOW_PRE_RELEASE
58
+ [[ -n "${LMTK_ALLOW_UPGRADE}" ]] && export LMTK_ALLOW_UPGRADE
55
59
  [[ -n "${LMTK_UV_PYTHON}" ]] && export LMTK_UV_PYTHON
56
60
  [[ -n "${LMTK_INSTALL_VERSION}" ]] && export LMTK_INSTALL_VERSION
57
61
 
@@ -77,5 +81,5 @@ ${ACTION} curl -o "${LMTK_SETUP}" "${LMTK_SETUP_URL}"
77
81
  ${ACTION} bash "${LMTK_SETUP}"
78
82
 
79
83
  # validate install
80
- # ${ACTION} "${VENV}"/bin/python --version
81
- # ${ACTION} "${VENV}"/bin/python -m pip freeze
84
+ ${ACTION} "${VENV}"/bin/python --version
85
+ ${ACTION} "${INSTALL_DIR}"/uv/uv --directory "${INSTALL_DIR}" pip freeze
@@ -1 +0,0 @@
1
- from . import lmod_config, lmod_spider
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.0.4",
3
- "distance": 0,
4
- "node": "g9727bc061151dfc0466b13bd7510e0a30aeb40d1",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-11-13"
8
- }
File without changes
File without changes
File without changes
File without changes