protoprimer 0.13.0.dev2__tar.gz → 0.13.0.dev3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: protoprimer
3
- Version: 0.13.0.dev2
3
+ Version: 0.13.0.dev3
4
4
  Summary: Escape the fragile mess of pre-venv shell scripts with a pure Python bootstrap wrapper: 🚀 ⏩ single-touch, zero-args, self-contained, no-deps, cross-platform, testable init logic using standard tools to run apps in a custom environment isolated per repository
5
5
  Author-email: uvsmtid <uvsmtid@gmail.com>
6
6
  License: MIT
@@ -40,7 +40,7 @@ import typing
40
40
 
41
41
  # The release process ensures that content in this file matches the version below while tagging the release commit
42
42
  # (otherwise, if the file comes from a different commit, the version is irrelevant):
43
- __version__ = "0.13.0.dev2"
43
+ __version__ = "0.13.0.dev3"
44
44
 
45
45
  logger: logging.Logger = logging.getLogger()
46
46
 
@@ -751,6 +751,35 @@ class VenvDriverBase:
751
751
  ) -> list[str]:
752
752
  raise NotImplementedError()
753
753
 
754
+ @staticmethod
755
+ def _list_installed_pkg_names(
756
+ venv_python_file_abs_path: str,
757
+ ) -> list[str]:
758
+ """
759
+ Returns names (without versions) of all packages currently
760
+ installed in the `venv` behind `venv_python_file_abs_path`.
761
+
762
+ Used to re-pin with `--constraint` whatever
763
+ a `venv`-seeding mechanism (`ensurepip`, `uv --seed`, ...)
764
+ happens to install (e.g. `pip`/`setuptools`/`wheel`).
765
+ """
766
+ freeze_output = subprocess.check_output(
767
+ [
768
+ venv_python_file_abs_path,
769
+ "-m",
770
+ "pip",
771
+ "list",
772
+ "--format=freeze",
773
+ "--exclude-editable",
774
+ ]
775
+ )
776
+ return [
777
+ #
778
+ output_line.split("==")[0]
779
+ for output_line in freeze_output.decode().splitlines()
780
+ if output_line.strip()
781
+ ]
782
+
754
783
  def pin_versions(
755
784
  self,
756
785
  venv_python_file_abs_path: str,
@@ -809,14 +838,15 @@ class VenvDriverPip(VenvDriverBase):
809
838
  "-m",
810
839
  "pip",
811
840
  "install",
841
+ "--no-input",
812
842
  "--upgrade",
813
- "pip",
814
- ]
815
- # Respect the committed constraints (if any) so a fresh `venv` does not
816
- # silently drift `pip` itself past the pinned version:
843
+ ] + self._list_installed_pkg_names(venv_python_executable)
817
844
  if os.path.exists(constraints_file_abs_path):
818
845
  pip_upgrade_cmd.extend(
819
846
  [
847
+ # Respect the committed constraints (if any)
848
+ # so a fresh `venv` does not silently drift
849
+ # seeded packages past the pinned version:
820
850
  "--constraint",
821
851
  constraints_file_abs_path,
822
852
  ]
@@ -948,9 +978,6 @@ class VenvDriverUv(VenvDriverBase):
948
978
  ]
949
979
  )
950
980
 
951
- # `--seed` installs whatever `pip` `uv` currently considers current, ignoring any
952
- # committed constraints - re-pin it explicitly so a fresh `venv` does not silently
953
- # drift `pip` itself past the pinned version:
954
981
  if os.path.exists(constraints_file_abs_path):
955
982
  seeded_venv_python_abs_path = os.path.join(
956
983
  local_venv_dir_abs_path,
@@ -963,10 +990,13 @@ class VenvDriverUv(VenvDriverBase):
963
990
  "install",
964
991
  "--python",
965
992
  seeded_venv_python_abs_path,
993
+ # Respect the committed constraints (if any)
994
+ # so a fresh `venv` does not silently drift
995
+ # seeded packages past the pinned version:
966
996
  "--constraint",
967
997
  constraints_file_abs_path,
968
- "pip",
969
998
  ]
999
+ + self._list_installed_pkg_names(seeded_venv_python_abs_path)
970
1000
  )
971
1001
 
972
1002
  def get_install_dependencies_cmd(
@@ -4798,6 +4828,8 @@ class EnvState(enum.Enum):
4798
4828
 
4799
4829
  state_default_file_log_handler_configured = Bootstrapper_state_default_file_log_handler_configured
4800
4830
 
4831
+ # TODO: Add a (replaceable) env_check step to execute before switching to `StateStride.stride_py_required`.
4832
+
4801
4833
  # restart: `StateStride.stride_py_arbitrary` -> `StateStride.stride_py_required`:
4802
4834
  state_stride_py_required_reached = Factory_state_stride_py_required_reached
4803
4835
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: protoprimer
3
- Version: 0.13.0.dev2
3
+ Version: 0.13.0.dev3
4
4
  Summary: Escape the fragile mess of pre-venv shell scripts with a pure Python bootstrap wrapper: 🚀 ⏩ single-touch, zero-args, self-contained, no-deps, cross-platform, testable init logic using standard tools to run apps in a custom environment isolated per repository
5
5
  Author-email: uvsmtid <uvsmtid@gmail.com>
6
6
  License: MIT
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "protoprimer"
8
- version = "0.13.0.dev2"
8
+ version = "0.13.0.dev3"
9
9
 
10
10
  authors = [
11
11
  { name = "uvsmtid", email = "uvsmtid@gmail.com" },