sdv-installer 0.4.1.dev0__tar.gz → 0.5.0__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. {sdv_installer-0.4.1.dev0/sdv_installer.egg-info → sdv_installer-0.5.0}/PKG-INFO +1 -1
  2. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/pyproject.toml +1 -1
  3. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/__init__.py +1 -1
  4. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/cli/__main__.py +10 -1
  5. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/constants.py +54 -1
  6. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/installation/installer.py +31 -9
  7. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/utils/system_requirements.py +102 -7
  8. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0/sdv_installer.egg-info}/PKG-INFO +1 -1
  9. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/LICENSE +0 -0
  10. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/README.md +0 -0
  11. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/authentication/__init__.py +0 -0
  12. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/authentication/authentication.py +0 -0
  13. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/cli/__init__.py +0 -0
  14. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/config.py +0 -0
  15. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/installation/__init__.py +0 -0
  16. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/utils/__init__.py +0 -0
  17. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/utils/console_utils.py +0 -0
  18. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/utils/data_storage.py +0 -0
  19. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/utils/package_utils.py +0 -0
  20. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer/utils/request_error_handling.py +0 -0
  21. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer.egg-info/SOURCES.txt +0 -0
  22. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer.egg-info/dependency_links.txt +0 -0
  23. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer.egg-info/entry_points.txt +0 -0
  24. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer.egg-info/requires.txt +0 -0
  25. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/sdv_installer.egg-info/top_level.txt +0 -0
  26. {sdv_installer-0.4.1.dev0 → sdv_installer-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdv-installer
3
- Version: 0.4.1.dev0
3
+ Version: 0.5.0
4
4
  Summary: Package to install SDV Enterprise packages.
5
5
  Author-email: "DataCebo, Inc." <info@datacebo.com>
6
6
  License-Expression: MIT
@@ -165,7 +165,7 @@ max-doc-length = 100
165
165
  max-line-length = 100
166
166
 
167
167
  [tool.bumpversion]
168
- current_version = "0.4.1.dev0"
168
+ current_version = "0.5.0"
169
169
  parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?'
170
170
  serialize = [
171
171
  '{major}.{minor}.{patch}.{release}{candidate}',
@@ -4,4 +4,4 @@ from sdv_installer import config, constants
4
4
 
5
5
 
6
6
  __all__ = ('config', 'constants')
7
- __version__ = '0.4.1.dev0'
7
+ __version__ = '0.5.0'
@@ -14,11 +14,20 @@ from sdv_installer.installation import (
14
14
  from sdv_installer.utils.system_requirements import print_check_results
15
15
 
16
16
  # Adding a new version here to avoid circular imports
17
- SDV_INSTALLER_VERSION = '0.4.1.dev0'
17
+ SDV_INSTALLER_VERSION = '0.5.0'
18
+
19
+
20
+ def _validate_install_args(args):
21
+ if args.upgrade and args.version is not None:
22
+ raise ValueError(
23
+ "The '--upgrade' flag cannot be used in combination with the '--version' flag. Use "
24
+ "'--upgrade' to upgrade to the latest version and '--version' for a specific version."
25
+ )
18
26
 
19
27
 
20
28
  def install_action(args):
21
29
  """Install the `SDV-Enterprise` packages."""
30
+ _validate_install_args(args)
22
31
  if args.folder:
23
32
  install_packages_from_folder(
24
33
  folder=args.folder,
@@ -1,5 +1,6 @@
1
1
  """Constants used across the SDV-Installer."""
2
2
 
3
+ from datetime import date
3
4
  from enum import IntEnum
4
5
 
5
6
  try:
@@ -14,8 +15,60 @@ from sdv_installer.config import PYPI_URL
14
15
 
15
16
  # System Requirement Constants
16
17
 
17
- MIN_PYTHON_VERSION = Version('3.9')
18
18
  MAX_PYTHON_VERSION = Version('3.14')
19
+
20
+ PYTHON_EOL_WARNING_MONTHS = 3
21
+ PYTHON_DEPRECATION_WARNING_MONTHS = 6
22
+ # Python end-of-life dates are from https://devguide.python.org/versions/.
23
+ # SDV Enterprise drops a version 6 months after that end-of-life. Python 3.9 is
24
+ # the exception and is deprecated on 2026-12-22.
25
+ # https://docs.sdv.dev/sdv-enterprise/installation/requirements
26
+ PYTHON_VERSION_SUPPORT = {
27
+ '3.9': {'eol': date(2025, 10, 31), 'deprecation': date(2026, 12, 22)},
28
+ '3.10': {'eol': date(2026, 10, 1), 'deprecation': date(2027, 4, 1)},
29
+ '3.11': {'eol': date(2027, 10, 1), 'deprecation': date(2028, 4, 1)},
30
+ '3.12': {'eol': date(2028, 10, 1), 'deprecation': date(2029, 4, 1)},
31
+ '3.13': {'eol': date(2029, 10, 1), 'deprecation': date(2030, 4, 1)},
32
+ '3.14': {'eol': date(2030, 10, 1), 'deprecation': date(2031, 4, 1)},
33
+ '3.15': {'eol': date(2031, 10, 1), 'deprecation': date(2032, 4, 1)},
34
+ '3.16': {'eol': date(2032, 10, 1), 'deprecation': date(2033, 4, 1)},
35
+ }
36
+
37
+
38
+ def get_min_python_version(today=None):
39
+ """Return the oldest Python version that SDV Enterprise still supports.
40
+
41
+ A version is supported until the ``deprecation`` date in ``PYTHON_VERSION_SUPPORT``.
42
+ That date is 6 months after Python's end-of-life, except where the schedule
43
+ sets a different day.
44
+
45
+ Args:
46
+ today (datetime.date):
47
+ Date used to evaluate the schedule. Defaults to the current date.
48
+
49
+ Returns:
50
+ Version: The minimum supported Python version.
51
+
52
+ Raises:
53
+ ValueError: If every scheduled Python version has reached its drop date.
54
+ """
55
+ if today is None:
56
+ today = date.today()
57
+
58
+ supported_versions = [
59
+ Version(version)
60
+ for version, support in PYTHON_VERSION_SUPPORT.items()
61
+ if today < support['deprecation']
62
+ ]
63
+ if not supported_versions:
64
+ raise ValueError(
65
+ 'No supported Python versions remain. Please contact DataCebo to request a new version.'
66
+ )
67
+
68
+ return min(supported_versions)
69
+
70
+
71
+ MIN_PYTHON_VERSION = get_min_python_version()
19
72
  REQUIRED_BITNESS = '64-bit'
20
73
  AUTH_FILE_NAME = 'auth.json'
21
74
 
@@ -318,27 +318,48 @@ def _get_accessible_packages(username, license_key):
318
318
  return package_to_product_type
319
319
 
320
320
 
321
- def _get_packages(username, license_key, package=None, options=None):
322
- """Retrieve a list of available packages to install."""
323
- package_to_product_type = _get_accessible_packages(username, license_key)
324
- if not package_to_product_type:
321
+ def _get_packages(
322
+ username: str,
323
+ license_key: str,
324
+ package: Optional[str] = None,
325
+ options: Optional[Union[str, list[str]]] = None,
326
+ accessible_packages: Optional[Dict[str, str]] = None,
327
+ ):
328
+ """Retrieve a list of available packages to install.
329
+
330
+ Args:
331
+ username:
332
+ The user's username in the License Key Service. This is usually their email.
333
+ license_key:
334
+ The license key for that user.
335
+ package:
336
+ The name of the package to install. If this is not provided, all packages the user
337
+ has access to will be returned.
338
+ options:
339
+ Either an optional dependency or a list of optional dependencies.
340
+ accessible_packages:
341
+ A dictionary mapping package names the user can access to the product type.
342
+ """
343
+ if accessible_packages is None:
344
+ accessible_packages = _get_accessible_packages(username, license_key)
345
+ if not accessible_packages:
325
346
  return
326
347
 
327
- if package in package_to_product_type and options:
348
+ if package in accessible_packages and options:
328
349
  options = options if isinstance(options, list) else [options]
329
350
  bundle_available_packages = {
330
351
  f'{package}[{option}]': ProductType.BUNDLE.value for option in options
331
352
  }
332
353
  return bundle_available_packages
333
354
 
334
- elif package and package not in package_to_product_type:
355
+ elif package and package not in accessible_packages:
335
356
  print_message(f'Invalid package {package} or no access to the given package.')
336
357
  return
337
358
 
338
- if package and package in package_to_product_type:
339
- return {package: package_to_product_type[package]}
359
+ if package and package in accessible_packages:
360
+ return {package: accessible_packages[package]}
340
361
 
341
- return package_to_product_type
362
+ return accessible_packages
342
363
 
343
364
 
344
365
  def _create_user_data_dir(data_dir, error_message=None):
@@ -442,6 +463,7 @@ def install_packages(
442
463
  license_key=license_key,
443
464
  package=package,
444
465
  options=options,
466
+ accessible_packages=all_sdv_enterprise_related_pkgs,
445
467
  )
446
468
  if not user_requested_packages:
447
469
  return
@@ -1,10 +1,12 @@
1
1
  """System requirements utility functions."""
2
2
 
3
+ import calendar
3
4
  import platform
4
5
  import re
5
6
  import subprocess
6
7
  import sys
7
8
  import sysconfig
9
+ from datetime import date
8
10
 
9
11
  import pip
10
12
  from packaging.tags import sys_tags
@@ -14,11 +16,14 @@ from sdv_installer.constants import (
14
16
  MAX_PYTHON_VERSION,
15
17
  MIN_OS_VERSIONS,
16
18
  MIN_PIP_VERSION,
17
- MIN_PYTHON_VERSION,
19
+ PYTHON_DEPRECATION_WARNING_MONTHS,
20
+ PYTHON_EOL_WARNING_MONTHS,
21
+ PYTHON_VERSION_SUPPORT,
18
22
  REQUIRED_BITNESS,
19
23
  SUPPORTED_ARCHITECTURES,
20
24
  SUPPORTED_LINUX_DISTROS,
21
25
  SUPPORTED_OSES,
26
+ get_min_python_version,
22
27
  )
23
28
  from sdv_installer.utils.console_utils import print_message
24
29
 
@@ -177,7 +182,7 @@ def validate_system_requirements(info):
177
182
 
178
183
  # Validate Python version
179
184
  python_version = get_python_version_code()
180
- if python_version < MIN_PYTHON_VERSION or python_version > MAX_PYTHON_VERSION:
185
+ if python_version < get_min_python_version() or python_version > MAX_PYTHON_VERSION:
181
186
  errors.append('python_version')
182
187
 
183
188
  # Validate system bitness
@@ -215,14 +220,78 @@ def validate_system_requirements(info):
215
220
  return errors
216
221
 
217
222
 
223
+ def _add_months(day, months):
224
+ """Return the date that is `months` away from `day`."""
225
+ month_index = day.month - 1 + months
226
+ year = day.year + month_index // 12
227
+ month = month_index % 12 + 1
228
+ last_day = calendar.monthrange(year, month)[1]
229
+ return date(year, month, min(day.day, last_day))
230
+
231
+
232
+ def _is_within_upcoming_months(today, target, months):
233
+ """Return whether `target` is in the future and strictly less than `months` away."""
234
+ return today < target < _add_months(today, months)
235
+
236
+
237
+ def get_python_deprecation_warning(python_version, today=None):
238
+ """Return a deprecation warning for a Python version, if one applies.
239
+
240
+ A warning applies when Python's end-of-life is less than 3 months away, or
241
+ when that end-of-life has already passed and SDV Enterprise will drop the
242
+ version in less than 6 months.
243
+
244
+ Args:
245
+ python_version (str):
246
+ Full Python version reported by the interpreter, such as '3.9.1'.
247
+ today (datetime.date):
248
+ Date used to evaluate the schedule. Defaults to the current date.
249
+
250
+ Returns:
251
+ str or None:
252
+ The warning sentence, or None when this version is not near deprecation.
253
+ """
254
+ if today is None:
255
+ today = date.today()
256
+
257
+ version = Version(python_version)
258
+ support = PYTHON_VERSION_SUPPORT.get(f'{version.major}.{version.minor}')
259
+ if support is None:
260
+ return None
261
+
262
+ eol = support['eol']
263
+ deprecation = support['deprecation']
264
+ if _is_within_upcoming_months(today, eol, PYTHON_EOL_WARNING_MONTHS):
265
+ return f'Python {python_version} will reach end-of-life in {eol.strftime("%b %Y")}.'
266
+
267
+ eol_has_passed = today >= eol
268
+ deprecation_is_soon = _is_within_upcoming_months(
269
+ today, deprecation, PYTHON_DEPRECATION_WARNING_MONTHS
270
+ )
271
+ if eol_has_passed and deprecation_is_soon:
272
+ drop_date = f'{deprecation.strftime("%b")} {deprecation.day}, {deprecation.year}'
273
+ return (
274
+ f'Python {python_version} has already reached end-of-life and will be '
275
+ f'deprecated in SDV Enterprise on {drop_date}.'
276
+ )
277
+
278
+ return None
279
+
280
+
218
281
  def print_check_results():
219
282
  """Runs the system checks and prints the result in a user-friendly format."""
220
283
  print_message('Verifying system requirements for SDV Enterprise: \n')
221
284
  info = get_system_info()
222
285
  errors = validate_system_requirements(info)
286
+ python_deprecation_warning = get_python_deprecation_warning(info['python_version'])
223
287
 
224
288
  def mark(key):
225
- return ' (!)' if key in errors else ''
289
+ if key in errors:
290
+ return ' (!)'
291
+ if python_deprecation_warning and key == 'python_version':
292
+ return ' (*)'
293
+
294
+ return ''
226
295
 
227
296
  print_message(f'Operating system: {info["os_system"]}{mark("os_system")}')
228
297
  print_message(f'OS Version: {info["os_version"]}{mark("os_version")}')
@@ -234,15 +303,41 @@ def print_check_results():
234
303
  print_message(f'System bit: {info["system_bit"]}{mark("system_bit")}')
235
304
  print_message(f'Pip version: {info["pip_version"]}{mark("pip_version")}')
236
305
 
237
- print_message(f'\nResult: {"Passed" if not errors else "Failed"}')
238
- if not errors:
239
- print_message('Your system meets the technical requirements for SDV Enterprise.')
240
- sys.exit(0)
306
+ if errors:
307
+ result = 'Failed'
308
+ elif python_deprecation_warning:
309
+ result = 'Passed (Warnings)'
241
310
  else:
311
+ result = 'Passed'
312
+
313
+ print_message(f'\nResult: {result}')
314
+ if errors:
242
315
  print_message(
243
316
  'Your system may not meet the technical requirements for SDV Enterprise. '
244
317
  'Please check the items marked by (!) and try updating the SDV '
245
318
  "Installer if something doesn't seem right."
246
319
  )
247
320
  print_message('The most up-to-date requirements are on the SDV Enterprise docs site.')
321
+ if python_deprecation_warning:
322
+ print_message('')
323
+ print_message(python_deprecation_warning)
324
+ print_message(
325
+ 'Please upgrade your Python version for continued access to SDV Enterprise.'
326
+ )
327
+
248
328
  sys.exit(1)
329
+ elif python_deprecation_warning:
330
+ print_message(
331
+ 'Your system meets the technical requirements for SDV Enterprise, '
332
+ 'with warnings that indicate upcoming deprecations.'
333
+ )
334
+ print_message('')
335
+ print_message(python_deprecation_warning)
336
+ print_message('Please upgrade your Python version for continued access to SDV Enterprise.')
337
+ print_message('')
338
+ print_message("If something doesn't seem right, try updating your SDV Installer version.")
339
+ print_message('The most up-to-date requirements are on the SDV Enterprise docs site.')
340
+ sys.exit(0)
341
+ else:
342
+ print_message('Your system meets the technical requirements for SDV Enterprise.')
343
+ sys.exit(0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sdv-installer
3
- Version: 0.4.1.dev0
3
+ Version: 0.5.0
4
4
  Summary: Package to install SDV Enterprise packages.
5
5
  Author-email: "DataCebo, Inc." <info@datacebo.com>
6
6
  License-Expression: MIT