ciel 3.2.0__tar.gz → 3.3.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ciel
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: An PDK builder/version manager for PDKs in the open_pdks format
5
5
  Home-page: https://github.com/fossi-foundation/ciel
6
6
  License: Apache-2.0
@@ -19,7 +19,8 @@ Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
20
20
  Classifier: Programming Language :: Python :: 3.13
21
21
  Requires-Dist: click (>=8,<8.5)
22
- Requires-Dist: httpx (>=0.22.0,<0.29)
22
+ Requires-Dist: httpx (>=0.22.0,<0.29) ; python_version < "3.10"
23
+ Requires-Dist: httpx2 (>=2,<3) ; python_version >= "3.10"
23
24
  Requires-Dist: pcpp (>=1.2,<2)
24
25
  Requires-Dist: pyyaml (>=5,<7)
25
26
  Requires-Dist: rich (>=12,<16)
@@ -257,7 +258,7 @@ PDK version 7519dfb04400f224f140749cda44ee7de6f5e095 enabled.
257
258
  ## Building PDKs
258
259
  For special cases, you may have to build the PDK yourself, which Ciel does support.
259
260
 
260
- You'll need Magic installed and in PATH. You can either do that manually or, if you have [Nix](https://nixos.org), invoke `nix shell github:fossi-foundation/nix-eda#magic` before building.
261
+ You'll need [Magic](https://github.com/rtimothyedwards/magic) installed and in PATH. `python3 -m pip install git+https://github.com/rtimothyedwards/magic@8.3.706` is sufficient.
261
262
 
262
263
  You can invoke `ciel build --help` for more options. Be aware, the built PDK won't automatically be enabled and you'll have to `ciel enable` the appropriate version.
263
264
 
@@ -228,7 +228,7 @@ PDK version 7519dfb04400f224f140749cda44ee7de6f5e095 enabled.
228
228
  ## Building PDKs
229
229
  For special cases, you may have to build the PDK yourself, which Ciel does support.
230
230
 
231
- You'll need Magic installed and in PATH. You can either do that manually or, if you have [Nix](https://nixos.org), invoke `nix shell github:fossi-foundation/nix-eda#magic` before building.
231
+ You'll need [Magic](https://github.com/rtimothyedwards/magic) installed and in PATH. `python3 -m pip install git+https://github.com/rtimothyedwards/magic@8.3.706` is sufficient.
232
232
 
233
233
  You can invoke `ciel build --help` for more options. Be aware, the built PDK won't automatically be enabled and you'll have to `ciel enable` the appropriate version.
234
234
 
@@ -20,7 +20,6 @@ import shutil
20
20
  import sys
21
21
 
22
22
  import click
23
- import httpx
24
23
  from rich.console import Console
25
24
 
26
25
  from .__version__ import __version__
@@ -38,6 +37,7 @@ from .common import (
38
37
  )
39
38
  from .families import Family, resolve_pdk_family, resolve_pdk_selector
40
39
  from .github import opt_github_token
40
+ from .httpx import HTTPStatusError, NetworkError
41
41
  from .manage import (
42
42
  enable,
43
43
  fetch,
@@ -213,11 +213,11 @@ def list_remote_cmd(data_source, pdk_root, pdk_selector):
213
213
  console = Console(stderr=True)
214
214
  console.print(f"[red]{e}")
215
215
  sys.exit(-1)
216
- except httpx.HTTPStatusError as e:
216
+ except HTTPStatusError as e:
217
217
  console = Console(stderr=True)
218
218
  console.print(f"[red]Encountered an error when polling version list: {e}")
219
219
  sys.exit(-1)
220
- except httpx.NetworkError as e:
220
+ except NetworkError as e:
221
221
  console = Console(stderr=True)
222
222
  console.print(
223
223
  f"[red]You don't appear to be connected to the Internet. ls-remote cannot be used.: {e}"
@@ -363,8 +363,8 @@ def list_libs_cmd(pdk_root, pdk_selector):
363
363
  def update_readme_lib_table_cmd(readme):
364
364
  # internal command - behavior may change or command may be removed in any
365
365
  # version
366
- import fileinput
367
- import html
366
+ import fileinput # noqa: PLC0415
367
+ import html # noqa: PLC0415
368
368
 
369
369
  table = [
370
370
  (name, sorted(f.get_all_libraries("*"))) for name, f in Family.by_name.items()
@@ -20,7 +20,7 @@ def __get_version():
20
20
  try:
21
21
  return importlib.metadata.version(__package__ or __name__)
22
22
  except importlib.metadata.PackageNotFoundError:
23
- import re
23
+ import re # noqa: PLC0415
24
24
 
25
25
  rx = re.compile(r"version\s*=\s*\"([^\"]+)\"")
26
26
  repo_directory = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -48,12 +48,11 @@ def open_pdks_fix_makefile_provenance(at_path: str):
48
48
 
49
49
  unpatched_rx = re.compile(r"[^$]\${(\w+)_COMMIT\}")
50
50
 
51
- with open(backup_path, "r") as file_in, open(at_path, "w") as file_out:
52
- for line in file_in:
51
+ with open(backup_path) as file_in, open(at_path, "w") as file_out:
52
+ for line_raw in file_in:
53
53
  # This patch makes it so the subshells parse this as an assignment
54
54
  # and not as a command. (a=b valid, a = b not valid)
55
- if "_COMMIT = `" in line:
56
- line = line.replace("_COMMIT = ", "_COMMIT=")
55
+ line = line_raw.replace("_COMMIT = ", "_COMMIT=")
57
56
  # This patch makes it so the _COMMIT assignment is propagated to
58
57
  # the next if block instead of the next if block being run in
59
58
  # another subshell.
@@ -76,7 +75,7 @@ def open_pdks_patch_gnu_sed(at_path: str):
76
75
  backup_path = get_backup_path(at_path)
77
76
  shutil.move(at_path, backup_path)
78
77
 
79
- with open(backup_path, "r") as file_in, open(at_path, "w") as file_out:
78
+ with open(backup_path) as file_in, open(at_path, "w") as file_out:
80
79
  file_out.writelines(
81
80
  line.replace("${SED} -i ", "${SED} -i.bak ") for line in file_in
82
81
  )
@@ -22,6 +22,8 @@ from datetime import datetime, timezone
22
22
  from pathlib import Path
23
23
  from typing import List, Optional
24
24
 
25
+ import yaml
26
+
25
27
  from .families import Family
26
28
 
27
29
  # -- Assorted Helper Functions
@@ -169,8 +171,6 @@ def resolve_version(
169
171
  if version is not None:
170
172
  return version
171
173
 
172
- import yaml
173
-
174
174
  if tool_metadata_file_path is None:
175
175
  tool_metadata_file_path = os.path.join(".", "tool_metadata.yml")
176
176
  if not os.path.isfile(tool_metadata_file_path):
@@ -24,9 +24,9 @@ from datetime import datetime, timezone
24
24
  from typing import Any, Callable, ClassVar, Optional
25
25
 
26
26
  import click
27
- import httpx
28
27
 
29
28
  from .__version__ import __version__
29
+ from .httpx import Client, Headers, HTTPError
30
30
 
31
31
 
32
32
  @dataclass
@@ -67,7 +67,7 @@ freepdk45_repo = RepoInfo(
67
67
  )
68
68
 
69
69
 
70
- class GitHubSession(httpx.Client):
70
+ class GitHubSession(Client):
71
71
  class Token:
72
72
  override: ClassVar[Optional[str]] = None
73
73
 
@@ -105,7 +105,7 @@ class GitHubSession(httpx.Client):
105
105
  ):
106
106
  if ssl_context is None:
107
107
  try:
108
- import truststore
108
+ import truststore # noqa: PLC0415
109
109
 
110
110
  ssl_context = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
111
111
  except ImportError:
@@ -134,7 +134,7 @@ class GitHubSession(httpx.Client):
134
134
  }
135
135
  if github_token is not None:
136
136
  raw_headers["Authorization"] = f"Bearer {github_token}"
137
- self.headers = httpx.Headers(raw_headers)
137
+ self.headers = Headers(raw_headers)
138
138
 
139
139
  def api(
140
140
  self,
@@ -170,7 +170,7 @@ def get_commit_date(
170
170
 
171
171
  try:
172
172
  response = session.api(repo, f"/commits/{commit}", "get")
173
- except httpx.HTTPError:
173
+ except HTTPError:
174
174
  return None
175
175
 
176
176
  date = response["commit"]["author"]["date"]
@@ -0,0 +1,30 @@
1
+ from typing import TYPE_CHECKING
2
+
3
+ try:
4
+ from httpx2 import (
5
+ Client,
6
+ Headers,
7
+ HTTPError,
8
+ HTTPStatusError,
9
+ NetworkError,
10
+ Response,
11
+ )
12
+ except ImportError:
13
+ if not TYPE_CHECKING:
14
+ from httpx import (
15
+ Client,
16
+ Headers,
17
+ HTTPError,
18
+ HTTPStatusError,
19
+ NetworkError,
20
+ Response,
21
+ )
22
+
23
+ __all__ = [
24
+ "Client",
25
+ "HTTPError",
26
+ "HTTPStatusError",
27
+ "Headers",
28
+ "NetworkError",
29
+ "Response",
30
+ ]
@@ -24,7 +24,6 @@ import tempfile
24
24
  from pathlib import Path
25
25
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
26
26
 
27
- import httpx
28
27
  import rich
29
28
  import rich.progress
30
29
  import rich.tree
@@ -39,6 +38,7 @@ from .common import (
39
38
  get_versions_dir,
40
39
  )
41
40
  from .families import Family, resolve_pdk_selector
41
+ from .httpx import HTTPError, HTTPStatusError
42
42
  from .source import DataSource
43
43
 
44
44
 
@@ -69,7 +69,7 @@ def print_installed_list(
69
69
  installed.commit_date = remote_version.commit_date
70
70
  installed.upload_date = remote_version.upload_date
71
71
  versions.sort(reverse=True)
72
- except (ValueError, httpx.HTTPError):
72
+ except (ValueError, HTTPError):
73
73
  console.print(
74
74
  "[red]Failed to connect to GitHub. Date information may be unavailable."
75
75
  )
@@ -231,7 +231,7 @@ def fetch(
231
231
  )
232
232
  with open(final_path, "wb") as f:
233
233
  f.write(io.read())
234
- except httpx.HTTPStatusError as e:
234
+ except HTTPStatusError as e:
235
235
  if e.response is not None and e.response.status_code == 404:
236
236
  if not build_if_not_found:
237
237
  raise RuntimeError(f"Version {version} not found remotely.")
@@ -244,13 +244,12 @@ def fetch(
244
244
  version=version,
245
245
  **(build_kwargs or {}),
246
246
  )
247
+ elif e.response is not None:
248
+ raise RuntimeError(
249
+ f"Failed to obtain {version} remotely: {e.response}."
250
+ )
247
251
  else:
248
- if e.response is not None:
249
- raise RuntimeError(
250
- f"Failed to obtain {version} remotely: {e.response}."
251
- )
252
- else:
253
- raise RuntimeError(f"Failed to request {version} from server: {e}.")
252
+ raise RuntimeError(f"Failed to request {version} from server: {e}.")
254
253
  except KeyboardInterrupt as e:
255
254
  console.print("Interrupted.")
256
255
  for path in affected_paths:
@@ -21,11 +21,11 @@ from dataclasses import dataclass
21
21
  from typing import Callable, ClassVar, Dict, List, Tuple, Type
22
22
 
23
23
  import click
24
- import httpx
25
24
 
26
25
  from .common import Version, date_from_iso8601
27
26
  from .families import Family
28
27
  from .github import GitHubSession, RepoInfo
28
+ from .httpx import Client, HTTPStatusError, Response
29
29
 
30
30
 
31
31
  @dataclass
@@ -45,9 +45,7 @@ class DataSource:
45
45
  def get_available_versions(self, pdk: str) -> List[Version]:
46
46
  raise NotImplementedError()
47
47
 
48
- def get_downloads_for_version(
49
- self, version: Version
50
- ) -> Tuple[httpx.Client, List[Asset]]:
48
+ def get_downloads_for_version(self, version: Version) -> Tuple[Client, List[Asset]]:
51
49
  raise NotImplementedError()
52
50
 
53
51
 
@@ -113,10 +111,8 @@ class GitHubReleasesDataSource(DataSource):
113
111
  )
114
112
  return versions
115
113
 
116
- def get_downloads_for_version(
117
- self, version: Version
118
- ) -> Tuple[httpx.Client, List[Asset]]:
119
- family_res: httpx.Response = self.session.api(
114
+ def get_downloads_for_version(self, version: Version) -> Tuple[Client, List[Asset]]:
115
+ family_res: Response = self.session.api(
120
116
  self.repo,
121
117
  f"/releases/tags/{version.pdk}-{version.name}",
122
118
  "get",
@@ -129,7 +125,7 @@ class GitHubReleasesDataSource(DataSource):
129
125
  # try variants because ihp was renamed (grumble)
130
126
  variants = Family.by_name[version.pdk].variants
131
127
  for variant in variants:
132
- variant_res: httpx.Response = self.session.api(
128
+ variant_res: Response = self.session.api(
133
129
  self.repo,
134
130
  f"/releases/tags/{variant}-{version.name}",
135
131
  "get",
@@ -165,7 +161,7 @@ class StaticWebDataSource(DataSource):
165
161
  req = self.session.request("GET", self.base_url + f"/{pdk}/manifest.json")
166
162
  try:
167
163
  req.raise_for_status()
168
- except httpx.HTTPStatusError as e:
164
+ except HTTPStatusError as e:
169
165
  if e.response.status_code == 404:
170
166
  raise ValueError(
171
167
  f"No versions found for '{pdk}' at '{self.base_url}'"
@@ -192,15 +188,13 @@ class StaticWebDataSource(DataSource):
192
188
  raise ValueError(f"No versions found for '{pdk}' on '{self.base_url}'")
193
189
  return versions
194
190
 
195
- def get_downloads_for_version(
196
- self, version: Version
197
- ) -> Tuple[httpx.Client, List[Asset]]:
191
+ def get_downloads_for_version(self, version: Version) -> Tuple[Client, List[Asset]]:
198
192
  req = self.session.request(
199
193
  "GET", self.base_url + f"/{version.pdk}/{version.name}/manifest.json"
200
194
  )
201
195
  try:
202
196
  req.raise_for_status()
203
- except httpx.HTTPStatusError as e:
197
+ except HTTPStatusError as e:
204
198
  if e.response.status_code == 404:
205
199
  raise ValueError(
206
200
  f"Manifest for '{version.pdk}/{version.name}' at '{self.base_url}'"
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "ciel"
7
- version = "3.2.0"
7
+ version = "3.3.0"
8
8
  description = "An PDK builder/version manager for PDKs in the open_pdks format"
9
9
  authors = ["Mohamed Gaber <me@donn.website>", "Efabless Corporation"]
10
10
  readme = "Readme.md"
@@ -23,7 +23,8 @@ python = ">=3.8"
23
23
  click = ">=8,<8.5"
24
24
  pyyaml = ">=5,<7"
25
25
  rich = ">=12,<16"
26
- httpx = ">=0.22.0,<0.29"
26
+ httpx = { version = ">=0.22.0,<0.29", markers = "python_version < '3.10'" }
27
+ httpx2 = { version = ">=2,<3", markers = "python_version >= '3.10'" }
27
28
  pcpp = ">=1.2,<2"
28
29
  zstandard = ">=0.19.0,<1"
29
30
 
@@ -44,7 +45,10 @@ ciel = "ciel.__main__:cli"
44
45
  target-version = "py38"
45
46
 
46
47
  [tool.ruff.lint]
48
+ extend-select = ["I", "PL", "UP"]
47
49
  ignore = [
50
+ # Annoying refactor suggestions
51
+ "PLR",
48
52
  # See GitHub issue #131
49
53
  "BLE001",
50
54
  # Will need to update like 80 billion annotations
@@ -52,3 +56,9 @@ ignore = [
52
56
  # ihp-sg13 is an invalid module name
53
57
  "N999",
54
58
  ]
59
+
60
+
61
+
62
+ [[tool.mypy.overrides]]
63
+ module = "httpx.*"
64
+ ignore_errors = true
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