circup 2.2.3__py3-none-any.whl → 2.2.4__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.
circup/command_utils.py CHANGED
@@ -841,3 +841,15 @@ def sorted_by_directory_then_alpha(list_of_files):
841
841
  sorted_full_list.append(files[cur_name])
842
842
 
843
843
  return sorted_full_list
844
+
845
+
846
+ def is_virtual_env_active():
847
+ """
848
+ Check if a virtual environment is currently active.
849
+
850
+ We don't check the more commonly recommended way of checking if
851
+ sys.prefix != sys.base_prefix as this will always be true if running circup
852
+ from a pipx install. This way ensures the user manually activated a
853
+ virtual environment, regardless how circup is installed.
854
+ """
855
+ return "VIRTUAL_ENV" in os.environ
circup/commands.py CHANGED
@@ -41,6 +41,7 @@ from circup.command_utils import (
41
41
  get_bundles_dict,
42
42
  completion_for_example,
43
43
  get_bundle_examples,
44
+ is_virtual_env_active,
44
45
  )
45
46
 
46
47
 
@@ -354,6 +355,7 @@ def install(
354
355
  device_modules = ctx.obj["backend"].get_device_versions()
355
356
  if to_install is not None:
356
357
  to_install = sorted(to_install)
358
+ is_global_install_ok = None
357
359
  click.echo(f"Ready to install: {to_install}\n")
358
360
  for library in to_install:
359
361
  ctx.obj["backend"].install_module(
@@ -366,6 +368,26 @@ def install(
366
368
  )
367
369
 
368
370
  if stubs:
371
+ # Check we are in a virtual environment
372
+ if not is_virtual_env_active():
373
+ if is_global_install_ok is None:
374
+ click.secho(
375
+ (
376
+ "No virtual environment detected.\n"
377
+ "It is recommended to run circup inside a virtual environment "
378
+ "when installing stubs. Without a virtual environment, the stubs "
379
+ "will be installed to the global python."
380
+ ),
381
+ fg="yellow",
382
+ )
383
+ is_global_install_ok = click.confirm(
384
+ click.style(
385
+ "Would you still like to install stubs (to the global python)?",
386
+ fg="yellow",
387
+ )
388
+ )
389
+ if not is_global_install_ok:
390
+ continue
369
391
  library_stubs = "adafruit-circuitpython-{}".format(
370
392
  library.replace("adafruit_", "")
371
393
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: circup
3
- Version: 2.2.3
3
+ Version: 2.2.4
4
4
  Summary: A tool to manage/update libraries on CircuitPython devices.
5
5
  Author-email: Adafruit Industries <circuitpython@adafruit.com>
6
6
  License: MIT License
@@ -1,8 +1,8 @@
1
1
  circup/__init__.py,sha256=9A98U3DyA14tm-7_d88fGSlLfEKz9T_85t8kXkErqRg,662
2
2
  circup/backends.py,sha256=g9Q9xCGZidwsEDL2Ga2cm50YYB54IiqlKUPcxj-pWZA,40008
3
3
  circup/bundle.py,sha256=FEP4F470aJtwmm8jgTM3DgR3dj5SVwbX1tbyIRKVHn8,5327
4
- circup/command_utils.py,sha256=o-Qdl868OidXqw_2Zs0uzsZAT9swqaYhtWrndcqEcgw,30157
5
- circup/commands.py,sha256=1UQ8EONlcEFQsytPO3LAHLcNHZIO0Fi5XCU47quzt08,27436
4
+ circup/command_utils.py,sha256=FNEhTYbbCT9UzKv4NG5lhbWHlObSEl4DQ7iDd8O0-cs,30581
5
+ circup/commands.py,sha256=jrgJDmqx4U1K--_OnZoOt1d9n1QRNnInK_nBeWrThMw,28542
6
6
  circup/logging.py,sha256=hu4v8ljkXo8ru-cqs0W3PU-xEVvTO_qqMKDJM18OXbQ,1115
7
7
  circup/module.py,sha256=33_kdy5BZn6COyIjAFZMpw00rTtPiryQZWFXQkMF8FY,7435
8
8
  circup/shared.py,sha256=IBW3v0rry1wLr8yR8_xHfe0QC5SFGzv6bdnPv96vZaM,8944
@@ -12,9 +12,9 @@ circup/wwshell/README.rst,sha256=M_jFP0hwOcngF0RdosdeqmVOISNcPzyjTW3duzIu9A8,361
12
12
  circup/wwshell/README.rst.license,sha256=GhA0SoZGP7CReDam-JJk_UtIQIpQaZWQFzR26YSuMm4,107
13
13
  circup/wwshell/__init__.py,sha256=CAPZiYrouWboyPx4KiWLBG_vf_n0MmArGqaFyTXGKWk,398
14
14
  circup/wwshell/commands.py,sha256=-I5l7XeoDmvWWuZg5wHdt9qe__SBQ1EGmKwCDTBMeus,7454
15
- circup-2.2.3.dist-info/licenses/LICENSE,sha256=bVlIMmSL_pqLCqae4hzixy9pYXD808IbgsMoQXTNLBk,1076
16
- circup-2.2.3.dist-info/METADATA,sha256=DX5Y0xFJa3RwpnTOA8L01eVtCGbNg3rPAgsYiN_Us98,13617
17
- circup-2.2.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
- circup-2.2.3.dist-info/entry_points.txt,sha256=FjTmwYD_ApgLRGifUrr_Ui1voW6fEzodQc3DKNzoAPc,69
19
- circup-2.2.3.dist-info/top_level.txt,sha256=Qx6E0eZgSBE10ciNKsLZx8-TTy_9fEVZh7NLmn24KcU,7
20
- circup-2.2.3.dist-info/RECORD,,
15
+ circup-2.2.4.dist-info/licenses/LICENSE,sha256=bVlIMmSL_pqLCqae4hzixy9pYXD808IbgsMoQXTNLBk,1076
16
+ circup-2.2.4.dist-info/METADATA,sha256=DmXRgPwq1G5-zZoilQRa6vtK1eP3clouiQy4LOt0teA,13617
17
+ circup-2.2.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
18
+ circup-2.2.4.dist-info/entry_points.txt,sha256=FjTmwYD_ApgLRGifUrr_Ui1voW6fEzodQc3DKNzoAPc,69
19
+ circup-2.2.4.dist-info/top_level.txt,sha256=Qx6E0eZgSBE10ciNKsLZx8-TTy_9fEVZh7NLmn24KcU,7
20
+ circup-2.2.4.dist-info/RECORD,,
File without changes