circup 1.6.0__tar.gz → 1.6.2__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 (70) hide show
  1. {circup-1.6.0/circup.egg-info → circup-1.6.2}/PKG-INFO +7 -7
  2. {circup-1.6.0 → circup-1.6.2}/circup/__init__.py +88 -58
  3. {circup-1.6.0 → circup-1.6.2}/circup/backends.py +20 -3
  4. {circup-1.6.0 → circup-1.6.2/circup.egg-info}/PKG-INFO +7 -7
  5. {circup-1.6.0 → circup-1.6.2}/.github/ISSUE_TEMPLATE.md +0 -0
  6. {circup-1.6.0 → circup-1.6.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  7. {circup-1.6.0 → circup-1.6.2}/.github/workflows/build.yml +0 -0
  8. {circup-1.6.0 → circup-1.6.2}/.github/workflows/release.yml +0 -0
  9. {circup-1.6.0 → circup-1.6.2}/.gitignore +0 -0
  10. {circup-1.6.0 → circup-1.6.2}/.isort.cfg +0 -0
  11. {circup-1.6.0 → circup-1.6.2}/.pre-commit-config.yaml +0 -0
  12. {circup-1.6.0 → circup-1.6.2}/.pylintrc +0 -0
  13. {circup-1.6.0 → circup-1.6.2}/CODE_OF_CONDUCT.rst +0 -0
  14. {circup-1.6.0 → circup-1.6.2}/CODE_OF_CONDUCT.rst.license +0 -0
  15. {circup-1.6.0 → circup-1.6.2}/CONTRIBUTING.rst +0 -0
  16. {circup-1.6.0 → circup-1.6.2}/CONTRIBUTING.rst.license +0 -0
  17. {circup-1.6.0 → circup-1.6.2}/LICENSE +0 -0
  18. {circup-1.6.0 → circup-1.6.2}/LICENSES/CC-BY-4.0.txt +0 -0
  19. {circup-1.6.0 → circup-1.6.2}/LICENSES/MIT.txt +0 -0
  20. {circup-1.6.0 → circup-1.6.2}/LICENSES/Unlicense.txt +0 -0
  21. {circup-1.6.0 → circup-1.6.2}/README.rst +0 -0
  22. {circup-1.6.0 → circup-1.6.2}/README.rst.license +0 -0
  23. {circup-1.6.0 → circup-1.6.2}/circup/config/bundle_config.json +0 -0
  24. {circup-1.6.0 → circup-1.6.2}/circup/config/bundle_config.json.license +0 -0
  25. {circup-1.6.0 → circup-1.6.2}/circup/shared.py +0 -0
  26. {circup-1.6.0 → circup-1.6.2}/circup.egg-info/SOURCES.txt +0 -0
  27. {circup-1.6.0 → circup-1.6.2}/circup.egg-info/dependency_links.txt +0 -0
  28. {circup-1.6.0 → circup-1.6.2}/circup.egg-info/entry_points.txt +0 -0
  29. {circup-1.6.0 → circup-1.6.2}/circup.egg-info/requires.txt +6 -6
  30. {circup-1.6.0 → circup-1.6.2}/circup.egg-info/top_level.txt +0 -0
  31. {circup-1.6.0 → circup-1.6.2}/docs/_static/favicon.ico +0 -0
  32. {circup-1.6.0 → circup-1.6.2}/docs/_static/favicon.ico.license +0 -0
  33. {circup-1.6.0 → circup-1.6.2}/docs/conf.py +0 -0
  34. {circup-1.6.0 → circup-1.6.2}/docs/index.rst +0 -0
  35. {circup-1.6.0 → circup-1.6.2}/docs/index.rst.license +0 -0
  36. {circup-1.6.0 → circup-1.6.2}/docs/logo.png +0 -0
  37. {circup-1.6.0 → circup-1.6.2}/docs/logo.png.license +0 -0
  38. {circup-1.6.0 → circup-1.6.2}/readthedocs.yml +0 -0
  39. {circup-1.6.0 → circup-1.6.2}/requirements.txt +0 -0
  40. {circup-1.6.0 → circup-1.6.2}/requirements.txt.license +0 -0
  41. {circup-1.6.0 → circup-1.6.2}/setup.cfg +0 -0
  42. {circup-1.6.0 → circup-1.6.2}/setup.py +0 -0
  43. {circup-1.6.0 → circup-1.6.2}/tests/__init__.py +0 -0
  44. {circup-1.6.0 → circup-1.6.2}/tests/bad_module/__init__.py +0 -0
  45. {circup-1.6.0 → circup-1.6.2}/tests/bad_module/my_module.py +0 -0
  46. {circup-1.6.0 → circup-1.6.2}/tests/bad_python.py +0 -0
  47. {circup-1.6.0 → circup-1.6.2}/tests/bundle.json +0 -0
  48. {circup-1.6.0 → circup-1.6.2}/tests/bundle.json.license +0 -0
  49. {circup-1.6.0 → circup-1.6.2}/tests/device.json +0 -0
  50. {circup-1.6.0 → circup-1.6.2}/tests/device.json.license +0 -0
  51. {circup-1.6.0 → circup-1.6.2}/tests/dir_module/__init__.py +0 -0
  52. {circup-1.6.0 → circup-1.6.2}/tests/dir_module/my_module.py +0 -0
  53. {circup-1.6.0 → circup-1.6.2}/tests/import_styles.py +0 -0
  54. {circup-1.6.0 → circup-1.6.2}/tests/local_module.py +0 -0
  55. {circup-1.6.0 → circup-1.6.2}/tests/local_module_cp7.mpy +0 -0
  56. {circup-1.6.0 → circup-1.6.2}/tests/local_module_cp7.mpy.license +0 -0
  57. {circup-1.6.0 → circup-1.6.2}/tests/mock_device/boot_out.txt +0 -0
  58. {circup-1.6.0 → circup-1.6.2}/tests/mock_device/boot_out.txt.license +0 -0
  59. {circup-1.6.0 → circup-1.6.2}/tests/mount_exists.txt +0 -0
  60. {circup-1.6.0 → circup-1.6.2}/tests/mount_exists.txt.license +0 -0
  61. {circup-1.6.0 → circup-1.6.2}/tests/mount_missing.txt +0 -0
  62. {circup-1.6.0 → circup-1.6.2}/tests/mount_missing.txt.license +0 -0
  63. {circup-1.6.0 → circup-1.6.2}/tests/remote_module.py +0 -0
  64. {circup-1.6.0 → circup-1.6.2}/tests/test_bundle_config.json +0 -0
  65. {circup-1.6.0 → circup-1.6.2}/tests/test_bundle_config.json.license +0 -0
  66. {circup-1.6.0 → circup-1.6.2}/tests/test_bundle_config_local.json +0 -0
  67. {circup-1.6.0 → circup-1.6.2}/tests/test_bundle_config_local.json.license +0 -0
  68. {circup-1.6.0 → circup-1.6.2}/tests/test_circup.py +0 -0
  69. {circup-1.6.0 → circup-1.6.2}/tests/test_module.mpy +0 -0
  70. {circup-1.6.0 → circup-1.6.2}/tests/test_module.mpy.license +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: circup
3
- Version: 1.6.0
3
+ Version: 1.6.2
4
4
  Summary: A tool to manage/update libraries on CircuitPython devices.
5
5
  Home-page: https://github.com/adafruit/circup
6
6
  Author: Adafruit Industries
@@ -57,16 +57,16 @@ Requires-Dist: sphinx; extra == "dev"
57
57
  Requires-Dist: wheel; extra == "dev"
58
58
  Requires-Dist: twine; extra == "dev"
59
59
  Provides-Extra: all
60
- Requires-Dist: pytest-faulthandler; extra == "all"
61
- Requires-Dist: pytest; extra == "all"
62
- Requires-Dist: coverage; extra == "all"
60
+ Requires-Dist: black; extra == "all"
61
+ Requires-Dist: pytest-cov; extra == "all"
63
62
  Requires-Dist: pytest-random-order>=1.0.0; extra == "all"
64
- Requires-Dist: twine; extra == "all"
65
63
  Requires-Dist: sphinx; extra == "all"
64
+ Requires-Dist: coverage; extra == "all"
65
+ Requires-Dist: twine; extra == "all"
66
66
  Requires-Dist: wheel; extra == "all"
67
- Requires-Dist: pytest-cov; extra == "all"
67
+ Requires-Dist: pytest-faulthandler; extra == "all"
68
+ Requires-Dist: pytest; extra == "all"
68
69
  Requires-Dist: pylint; extra == "all"
69
- Requires-Dist: black; extra == "all"
70
70
 
71
71
 
72
72
  CircUp
@@ -1352,76 +1352,106 @@ def uninstall(ctx, module): # pragma: no cover
1352
1352
  help="Update all modules without Major Version warnings.",
1353
1353
  )
1354
1354
  @click.pass_context
1355
+ # pylint: disable=too-many-locals
1355
1356
  def update(ctx, update_all): # pragma: no cover
1356
1357
  """
1357
1358
  Checks for out-of-date modules on the connected CIRCUITPYTHON device, and
1358
1359
  prompts the user to confirm updating such modules.
1359
1360
  """
1360
1361
  logger.info("Update")
1361
- # Grab out of date modules.
1362
- modules = [
1363
- m for m in find_modules(ctx.obj["backend"], get_bundles_list()) if m.outofdate
1364
- ]
1365
- if modules:
1366
- click.echo("Found {} module[s] needing update.".format(len(modules)))
1367
- if not update_all:
1368
- click.echo("Please indicate which modules you wish to update:\n")
1369
- for module in modules:
1370
- update_flag = update_all
1371
- if VERBOSE:
1372
- click.echo(
1373
- "Device version: {}, Bundle version: {}".format(
1374
- module.device_version, module.bundle_version
1375
- )
1362
+ # Grab current modules.
1363
+ bundles_list = get_bundles_list()
1364
+ installed_modules = find_modules(ctx.obj["backend"], bundles_list)
1365
+ modules_to_update = [m for m in installed_modules if m.outofdate]
1366
+
1367
+ if not modules_to_update:
1368
+ click.echo("None of the module[s] found on the device need an update.")
1369
+ return
1370
+
1371
+ # Process out of date modules
1372
+ updated_modules = []
1373
+ click.echo("Found {} module[s] needing update.".format(len(modules_to_update)))
1374
+ if not update_all:
1375
+ click.echo("Please indicate which module[s] you wish to update:\n")
1376
+ for module in modules_to_update:
1377
+ update_flag = update_all
1378
+ if VERBOSE:
1379
+ click.echo(
1380
+ "Device version: {}, Bundle version: {}".format(
1381
+ module.device_version, module.bundle_version
1376
1382
  )
1377
- if isinstance(module.bundle_version, str) and not VersionInfo.is_valid(
1378
- module.bundle_version
1379
- ):
1383
+ )
1384
+ if isinstance(module.bundle_version, str) and not VersionInfo.is_valid(
1385
+ module.bundle_version
1386
+ ):
1387
+ click.secho(
1388
+ f"WARNING: Library {module.name} repo has incorrect __version__"
1389
+ "\n\tmetadata. Circup will assume it needs updating."
1390
+ "\n\tPlease file an issue in the library repo.",
1391
+ fg="yellow",
1392
+ )
1393
+ if module.repo:
1394
+ click.secho(f"\t{module.repo}", fg="yellow")
1395
+ if not update_flag:
1396
+ if module.bad_format:
1380
1397
  click.secho(
1381
- f"WARNING: Library {module.name} repo has incorrect __version__"
1382
- "\n\tmetadata. Circup will assume it needs updating."
1383
- "\n\tPlease file an issue in the library repo.",
1398
+ f"WARNING: '{module.name}': module corrupted or in an"
1399
+ " unknown mpy format. Updating is required.",
1384
1400
  fg="yellow",
1385
1401
  )
1386
- if module.repo:
1387
- click.secho(f"\t{module.repo}", fg="yellow")
1388
- if not update_flag:
1389
- if module.bad_format:
1390
- click.secho(
1391
- f"WARNING: '{module.name}': module corrupted or in an"
1392
- " unknown mpy format. Updating is required.",
1393
- fg="yellow",
1394
- )
1395
- update_flag = click.confirm("Do you want to update?")
1396
- elif module.mpy_mismatch:
1397
- click.secho(
1398
- f"WARNING: '{module.name}': mpy format doesn't match the"
1399
- " device's Circuitpython version. Updating is required.",
1400
- fg="yellow",
1401
- )
1402
- update_flag = click.confirm("Do you want to update?")
1403
- elif module.major_update:
1404
- update_flag = click.confirm(
1405
- (
1406
- "'{}' is a Major Version update and may contain breaking "
1407
- "changes. Do you want to update?".format(module.name)
1408
- )
1409
- )
1410
- else:
1411
- update_flag = click.confirm("Update '{}'?".format(module.name))
1412
- if update_flag:
1413
- # pylint: disable=broad-except
1414
- try:
1415
- ctx.obj["backend"].update(module)
1416
- click.echo("Updated {}".format(module.name))
1417
- except Exception as ex:
1418
- logger.exception(ex)
1419
- click.echo(
1420
- "Something went wrong, {} (check the logs)".format(str(ex))
1402
+ update_flag = click.confirm("Do you want to update?")
1403
+ elif module.mpy_mismatch:
1404
+ click.secho(
1405
+ f"WARNING: '{module.name}': mpy format doesn't match the"
1406
+ " device's Circuitpython version. Updating is required.",
1407
+ fg="yellow",
1408
+ )
1409
+ update_flag = click.confirm("Do you want to update?")
1410
+ elif module.major_update:
1411
+ update_flag = click.confirm(
1412
+ (
1413
+ "'{}' is a Major Version update and may contain breaking "
1414
+ "changes. Do you want to update?".format(module.name)
1421
1415
  )
1422
- # pylint: enable=broad-except
1416
+ )
1417
+ else:
1418
+ update_flag = click.confirm("Update '{}'?".format(module.name))
1419
+ if update_flag:
1420
+ # pylint: disable=broad-except
1421
+ try:
1422
+ ctx.obj["backend"].update(module)
1423
+ updated_modules.append(module.name)
1424
+ click.echo("Updated {}".format(module.name))
1425
+ except Exception as ex:
1426
+ logger.exception(ex)
1427
+ click.echo("Something went wrong, {} (check the logs)".format(str(ex)))
1428
+ # pylint: enable=broad-except
1429
+
1430
+ if not updated_modules:
1423
1431
  return
1424
- click.echo("None of the modules found on the device need an update.")
1432
+
1433
+ # We updated modules, look to see if any requirements are missing
1434
+ click.echo(
1435
+ "Checking {} updated module[s] for missing requirements.".format(
1436
+ len(updated_modules)
1437
+ )
1438
+ )
1439
+ available_modules = get_bundle_versions(bundles_list)
1440
+ mod_names = {}
1441
+ for module, metadata in available_modules.items():
1442
+ mod_names[module.replace(".py", "").lower()] = metadata
1443
+ missing_modules = get_dependencies(updated_modules, mod_names=mod_names)
1444
+ device_modules = ctx.obj["backend"].get_device_versions()
1445
+ # Process newly needed modules
1446
+ if missing_modules is not None:
1447
+ installed_module_names = [m.name for m in installed_modules]
1448
+ missing_modules = set(missing_modules) - set(installed_module_names)
1449
+ missing_modules = sorted(list(missing_modules))
1450
+ click.echo(f"Ready to install: {missing_modules}\n")
1451
+ for library in missing_modules:
1452
+ ctx.obj["backend"].install_module(
1453
+ ctx.obj["DEVICE_PATH"], device_modules, library, False, mod_names
1454
+ )
1425
1455
 
1426
1456
 
1427
1457
  # pylint: enable=too-many-branches
@@ -589,14 +589,31 @@ class WebBackend(Backend):
589
589
 
590
590
  def is_device_present(self):
591
591
  """
592
- returns True if the device is currently connected
592
+ returns True if the device is currently connected and running supported version
593
593
  """
594
594
  try:
595
- _ = self.session.get(f"{self.device_location}/cp/version.json")
596
- return True
595
+ with self.session.get(f"{self.device_location}/cp/version.json") as r:
596
+ r.raise_for_status()
597
+ web_api_version = r.json().get("web_api_version")
598
+ if web_api_version is None:
599
+ self.logger.error("Unable to get web API version from device.")
600
+ click.secho("Unable to get web API version from device.", fg="red")
601
+ return False
602
+
603
+ if web_api_version < 4:
604
+ self.logger.error(
605
+ f"Device running unsupported web API version {web_api_version} < 4."
606
+ )
607
+ click.secho(
608
+ f"Device running unsupported web API version {web_api_version} < 4.",
609
+ fg="red",
610
+ )
611
+ return False
597
612
  except requests.exceptions.ConnectionError:
598
613
  return False
599
614
 
615
+ return True
616
+
600
617
  def get_device_versions(self):
601
618
  """
602
619
  Returns a dictionary of metadata from modules on the connected device.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: circup
3
- Version: 1.6.0
3
+ Version: 1.6.2
4
4
  Summary: A tool to manage/update libraries on CircuitPython devices.
5
5
  Home-page: https://github.com/adafruit/circup
6
6
  Author: Adafruit Industries
@@ -57,16 +57,16 @@ Requires-Dist: sphinx; extra == "dev"
57
57
  Requires-Dist: wheel; extra == "dev"
58
58
  Requires-Dist: twine; extra == "dev"
59
59
  Provides-Extra: all
60
- Requires-Dist: pytest-faulthandler; extra == "all"
61
- Requires-Dist: pytest; extra == "all"
62
- Requires-Dist: coverage; extra == "all"
60
+ Requires-Dist: black; extra == "all"
61
+ Requires-Dist: pytest-cov; extra == "all"
63
62
  Requires-Dist: pytest-random-order>=1.0.0; extra == "all"
64
- Requires-Dist: twine; extra == "all"
65
63
  Requires-Dist: sphinx; extra == "all"
64
+ Requires-Dist: coverage; extra == "all"
65
+ Requires-Dist: twine; extra == "all"
66
66
  Requires-Dist: wheel; extra == "all"
67
- Requires-Dist: pytest-cov; extra == "all"
67
+ Requires-Dist: pytest-faulthandler; extra == "all"
68
+ Requires-Dist: pytest; extra == "all"
68
69
  Requires-Dist: pylint; extra == "all"
69
- Requires-Dist: black; extra == "all"
70
70
 
71
71
 
72
72
  CircUp
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -10,16 +10,16 @@ update_checker
10
10
  importlib_metadata
11
11
 
12
12
  [all]
13
- pytest-faulthandler
14
- pytest
15
- coverage
13
+ black
14
+ pytest-cov
16
15
  pytest-random-order>=1.0.0
17
- twine
18
16
  sphinx
17
+ coverage
18
+ twine
19
19
  wheel
20
- pytest-cov
20
+ pytest-faulthandler
21
+ pytest
21
22
  pylint
22
- black
23
23
 
24
24
  [dev]
25
25
  pytest
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes