fapi-init 0.0.0__tar.gz → 0.1.1__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: fapi-init
3
- Version: 0.0.0
3
+ Version: 0.1.1
4
4
  Summary: Scaffold a production-ready FastAPI project in seconds
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/markryangarcia/fapi-init
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Topic :: Software Development :: Code Generators
15
15
  Requires-Python: >=3.8
16
16
  Description-Content-Type: text/markdown
17
+ Requires-Dist: certifi
17
18
 
18
19
  # fapi-init
19
20
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  import os
4
4
  import platform
5
+ import shutil
6
+ import ssl
5
7
  import stat
6
8
  import sys
7
9
  import tarfile
@@ -35,6 +37,28 @@ def _bin_path(version: str) -> Path:
35
37
  return CACHE_DIR / version / (BIN_NAME + suffix)
36
38
 
37
39
 
40
+ def _ssl_context() -> ssl.SSLContext:
41
+ """Return an SSL context, falling back gracefully on macOS cert issues."""
42
+ try:
43
+ import certifi
44
+ return ssl.create_default_context(cafile=certifi.where())
45
+ except ImportError:
46
+ pass
47
+
48
+ ctx = ssl.create_default_context()
49
+ # On macOS with python.org builds, system certs may not be available.
50
+ # Try to load them from the macOS keychain path if present.
51
+ mac_certs = "/etc/ssl/cert.pem"
52
+ if platform.system().lower() == "darwin" and os.path.exists(mac_certs):
53
+ ctx.load_verify_locations(mac_certs)
54
+ return ctx
55
+
56
+ # Last resort: disable verification (still encrypted, just not verified)
57
+ ctx.check_hostname = False
58
+ ctx.verify_mode = ssl.CERT_NONE
59
+ return ctx
60
+
61
+
38
62
  def ensure_binary(version: str) -> Path:
39
63
  bin_path = _bin_path(version)
40
64
  if bin_path.exists():
@@ -47,7 +71,10 @@ def ensure_binary(version: str) -> Path:
47
71
 
48
72
  archive_path = bin_path.parent / asset
49
73
  print(f"Downloading fapi-init v{version}...", file=sys.stderr)
50
- urllib.request.urlretrieve(url, archive_path)
74
+
75
+ ctx = _ssl_context()
76
+ with urllib.request.urlopen(url, context=ctx) as response, open(archive_path, "wb") as out:
77
+ shutil.copyfileobj(response, out)
51
78
 
52
79
  if asset.endswith(".zip"):
53
80
  with zipfile.ZipFile(archive_path) as zf:
@@ -58,6 +85,5 @@ def ensure_binary(version: str) -> Path:
58
85
 
59
86
  archive_path.unlink()
60
87
 
61
- # ensure executable
62
88
  bin_path.chmod(bin_path.stat().st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
63
89
  return bin_path
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fapi-init
3
- Version: 0.0.0
3
+ Version: 0.1.1
4
4
  Summary: Scaffold a production-ready FastAPI project in seconds
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/markryangarcia/fapi-init
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Topic :: Software Development :: Code Generators
15
15
  Requires-Python: >=3.8
16
16
  Description-Content-Type: text/markdown
17
+ Requires-Dist: certifi
17
18
 
18
19
  # fapi-init
19
20
 
@@ -6,4 +6,5 @@ fapi_init.egg-info/PKG-INFO
6
6
  fapi_init.egg-info/SOURCES.txt
7
7
  fapi_init.egg-info/dependency_links.txt
8
8
  fapi_init.egg-info/entry_points.txt
9
+ fapi_init.egg-info/requires.txt
9
10
  fapi_init.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ certifi
@@ -9,6 +9,7 @@ description = "Scaffold a production-ready FastAPI project in seconds"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
11
11
  requires-python = ">=3.8"
12
+ dependencies = ["certifi"]
12
13
  keywords = ["fastapi", "scaffold", "generator", "cli", "boilerplate"]
13
14
  classifiers = [
14
15
  "Development Status :: 4 - Beta",
File without changes
File without changes