csspin-python 3.0.1__py3-none-any.whl → 3.1.1__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.
csspin_python/python.py CHANGED
@@ -159,33 +159,12 @@ defaults = config(
159
159
  key_duration=3600 * 10, # 10 hours
160
160
  static_oidc=False,
161
161
  index="16.0/simple",
162
+ # Need to set client secret to empty string, otherwise the string "None"
163
+ # would be handled as secret and obfucsated in logs.
164
+ client_secret="", # nosec: B106
162
165
  ),
163
166
  index_url="https://pypi.org/simple",
164
- requires=config(
165
- python=["build", "wheel"],
166
- system=config(
167
- debian=config(
168
- apt=[
169
- "build-essential",
170
- "curl",
171
- "git",
172
- "libbz2-dev",
173
- "libffi-dev",
174
- "libkrb5-dev",
175
- "liblzma-dev",
176
- "libncursesw5-dev",
177
- "libreadline-dev",
178
- "libsqlite3-dev",
179
- "libssl-dev",
180
- "libxml2-dev",
181
- "libxmlsec1-dev",
182
- "make",
183
- "xz-utils",
184
- "zlib1g-dev",
185
- ]
186
- )
187
- ),
188
- ),
167
+ requires=config(python=["build", "wheel"]),
189
168
  )
190
169
 
191
170
 
@@ -813,6 +792,7 @@ class SimpleProvisioner(ProvisionerProtocol):
813
792
  None if cfg.verbosity > Verbosity.NORMAL else "-q",
814
793
  "--disable-pip-version-check",
815
794
  "install",
795
+ *[f"--constraint={constraint}" for constraint in cfg.python.constraints],
816
796
  )
817
797
 
818
798
  def prerequisites(self: Self, cfg: ConfigTree) -> None:
@@ -939,7 +919,7 @@ def venv_provision( # pylint: disable=too-many-branches,missing-function-docstr
939
919
 
940
920
  # Plugins can define a 'venv_hook' function, to give them a
941
921
  # chance to do something with the virtual environment just
942
- # being provisioned (e.g. preparing the venv by adding pth
922
+ # being provisioned (e.g. preparing the venv by adding .pth
943
923
  # files or by adding packages with other installers like
944
924
  # easy_install).
945
925
  for plugin in cfg.spin.topo_plugins:
@@ -1017,7 +997,9 @@ def _obfuscate_index_url(index_url: str) -> None:
1017
997
  secrets.add(index_url.split(":")[2].split("@")[0]) # Codeartifact token
1018
998
 
1019
999
 
1020
- def _check_aws_token_validity(cfg: ConfigTree) -> None:
1000
+ def _check_aws_token_validity( # pylint: disable=too-many-locals
1001
+ cfg: ConfigTree,
1002
+ ) -> None:
1021
1003
  """
1022
1004
  If csspin-python[aws_auth] is installed, we can use csaccess to get the
1023
1005
  CodeArtifact authentication token.
@@ -1033,6 +1015,17 @@ def _check_aws_token_validity(cfg: ConfigTree) -> None:
1033
1015
 
1034
1016
  import time
1035
1017
 
1018
+ if not (
1019
+ client_secret := (
1020
+ interpolate1(cfg.python.aws_auth.client_secret)
1021
+ or os.getenv("CS_AWS_OIDC_CLIENT_SECRET")
1022
+ )
1023
+ ):
1024
+ die(
1025
+ "Please provide a client secret for CodeArtifact access via"
1026
+ " 'python.aws_auth.client_secret'."
1027
+ )
1028
+
1036
1029
  current_time = int(time.time())
1037
1030
  timestamp_key = "aws_auth_timestamp"
1038
1031
 
@@ -1058,18 +1051,24 @@ def _check_aws_token_validity(cfg: ConfigTree) -> None:
1058
1051
  memo.items().remove(item)
1059
1052
  else:
1060
1053
  info("Updating Codeartifact token.")
1054
+ from urllib.error import HTTPError
1061
1055
  from urllib.parse import urljoin
1062
1056
 
1063
1057
  opts = {
1058
+ "client_secret": client_secret,
1064
1059
  "static_oidc": interpolate1(cfg.python.aws_auth.static_oidc).lower()
1065
- == "true"
1060
+ == "true",
1066
1061
  }
1067
1062
  if cfg.python.aws_auth.client_id:
1068
1063
  opts["client_id"] = interpolate1(cfg.python.aws_auth.client_id)
1069
1064
  if cfg.python.aws_auth.role_arn:
1070
1065
  opts["aws_role_arn"] = interpolate1(cfg.python.aws_auth.role_arn)
1071
1066
 
1072
- index_base_url = get_ca_pypi_url_programmatic(**opts)
1067
+ try:
1068
+ index_base_url = get_ca_pypi_url_programmatic(**opts)
1069
+ except HTTPError as e:
1070
+ die(f"Failed to establish CodeArtifact connection: {e}")
1071
+
1073
1072
  index_url = urljoin(
1074
1073
  index_base_url + "/", interpolate1(cfg.python.aws_auth.index)
1075
1074
  )
@@ -105,6 +105,11 @@ python:
105
105
  setup.py/setup.cfg.
106
106
  Note that editable installs with ``-e`` or requirement files
107
107
  with ``-r`` can also be used here.
108
+ constraints:
109
+ type: list
110
+ help: |
111
+ The list of constraint files that should be used when
112
+ installing packages into the virtual environment.
108
113
  index_url:
109
114
  type: str
110
115
  help: |
@@ -143,10 +148,15 @@ python:
143
148
  CodeArtifact.
144
149
  index:
145
150
  type: str
146
- help: The Codeartifact repository index (e.g. "16.0/simple").
151
+ help: The CodeArtifact repository index (e.g. "16.0/simple").
147
152
  client_id:
148
153
  type: str
149
154
  help: The OIDC client ID to use.
155
+ client_secret:
156
+ type: secret
157
+ help: |
158
+ The OIDC client secret to use, defaults to the
159
+ environment variable 'CS_AWS_OIDC_CLIENT_SECRET'.
150
160
  role_arn:
151
161
  type: str
152
162
  help: The role ARN to assume when authenticating.
@@ -135,6 +135,7 @@ class SimpleUvProvisioner(SimpleProvisioner):
135
135
  *self._uv_cmd._cmd,
136
136
  "pip",
137
137
  "install",
138
+ *[f"--constraint={constraint}" for constraint in cfg.python.constraints],
138
139
  )
139
140
 
140
141
  def provision_python(self, cfg: ConfigTree) -> None:
@@ -179,7 +180,7 @@ def _update_index_url_in_toml(cfg: ConfigTree) -> None:
179
180
  """
180
181
  Update the index-url in the uv.toml in case it changed.
181
182
  """
182
- if (uv_toml_path := interpolate1(cfg.uv_provisioner.uv_toml_path)).exists():
183
+ if (uv_toml_path := interpolate1(Path(cfg.uv_provisioner.uv_toml_path))).exists():
183
184
  with open(uv_toml_path, mode="r+b") as fd:
184
185
  toml_content = tomllib.load(fd)
185
186
  if toml_content.get("index-url") != cfg.python.index_url:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csspin-python
3
- Version: 3.0.1
3
+ Version: 3.1.1
4
4
  Summary: Plugin-package for csspin providing Python related plugins
5
5
  Author-email: CONTACT Software GmbH <info@contact-software.com>
6
6
  Maintainer-email: Waleri Enns <waleri.enns@contact-software.com>, Benjamin Thomas Schwertfeger <benjaminthomas.schwertfeger@contact-software.com>, Fabian Hafer <fabian.hafer@contact-software.com>
@@ -8,14 +8,14 @@ csspin_python/playwright.py,sha256=oFfphLqa4AB6K9vasCUFHN0kFXu63n3ocrsqVuRp4-0,5
8
8
  csspin_python/playwright_schema.yaml,sha256=TSeR16YHa7m7bfO59F2eMV-jXcglluTJdEpUeL16saY,1178
9
9
  csspin_python/pytest.py,sha256=pTOb5zFd9RINZwJsHNaRuSGVDkPMABzaAhwpAJo1nQE,4574
10
10
  csspin_python/pytest_schema.yaml,sha256=tzXtdF6MvGC9v59EVRJFfLeMMHqPsXcFXy2zJtRECBI,1535
11
- csspin_python/python.py,sha256=SRsl7wXkPFxEqwhjDtr-Uq80N_JNRrlD0kPMaE1gfrU,34610
12
- csspin_python/python_schema.yaml,sha256=s8snEDJ8UdfpORgCgqbKvy0exaXlvy4U1gUwBd-Do94,5739
11
+ csspin_python/python.py,sha256=32L4S6fKMWh5tbU-Rv5l6NVqrjjPLAiL25cB5gfeiC4,34784
12
+ csspin_python/python_schema.yaml,sha256=_EBDglOM9AuXOvYUjFRJkUmtezCHcObEYmO64f-FOHI,6176
13
13
  csspin_python/radon.py,sha256=uFqm6FEi5oWj-_XVaAm3s9cam0cUmr1_FwRf40K6xWs,1876
14
14
  csspin_python/radon_schema.yaml,sha256=rlRzXw5z4XbjOVznRiUxWGP4E9hx1Jm-gGw1iQiYzE0,548
15
- csspin_python/uv_provisioner.py,sha256=A6Di0ahCrZCO3KhYedry7JCfa5ME6h7vH4ypRBZh5UA,5907
15
+ csspin_python/uv_provisioner.py,sha256=MGedx4e286ZE1miwh70y6b3wePw3mmc0m1kG6H_738I,5999
16
16
  csspin_python/uv_provisioner_schema.yaml,sha256=Y8ZNC2OMnhR8Us3WUXAXK9hMjqGWAKFJB2puX4X5XNQ,727
17
- csspin_python-3.0.1.dist-info/licenses/LICENSE,sha256=4MAecetnRTQw5DlHtiikDSzKWO1xVLwzM5_DsPMYlnE,10172
18
- csspin_python-3.0.1.dist-info/METADATA,sha256=jZxpZnrvJ_Afr6Hab4bgRqU0a7TkdjGeOV_Xoy6gqN4,4715
19
- csspin_python-3.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
- csspin_python-3.0.1.dist-info/top_level.txt,sha256=QSeglMEGbFu1z4L6MCQYwo01NgL0KojWvC4rzgMQ8gU,14
21
- csspin_python-3.0.1.dist-info/RECORD,,
17
+ csspin_python-3.1.1.dist-info/licenses/LICENSE,sha256=4MAecetnRTQw5DlHtiikDSzKWO1xVLwzM5_DsPMYlnE,10172
18
+ csspin_python-3.1.1.dist-info/METADATA,sha256=OsIblHbaQVC9ybAydVQ1L-YEzqKtzw3qyJZnXqc-nZs,4715
19
+ csspin_python-3.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ csspin_python-3.1.1.dist-info/top_level.txt,sha256=QSeglMEGbFu1z4L6MCQYwo01NgL0KojWvC4rzgMQ8gU,14
21
+ csspin_python-3.1.1.dist-info/RECORD,,