fapi-init 0.0.0__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.
fapi_init/__init__.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
__version__ = version("fapi-init")
|
|
6
|
+
except PackageNotFoundError:
|
|
7
|
+
__version__ = "0.0.0"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def main() -> None:
|
|
11
|
+
from ._binary import ensure_binary
|
|
12
|
+
import subprocess
|
|
13
|
+
|
|
14
|
+
binary = ensure_binary(__version__)
|
|
15
|
+
result = subprocess.run([str(binary)] + sys.argv[1:])
|
|
16
|
+
sys.exit(result.returncode)
|
fapi_init/_binary.py
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Downloads and caches the fapi-init binary from GitHub Releases."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import platform
|
|
5
|
+
import stat
|
|
6
|
+
import sys
|
|
7
|
+
import tarfile
|
|
8
|
+
import urllib.request
|
|
9
|
+
import zipfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
GITHUB_REPO = "markryangarcia/fapi-init"
|
|
13
|
+
BIN_NAME = "fapi-init"
|
|
14
|
+
CACHE_DIR = Path.home() / ".cache" / "fapi-init"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _platform_asset() -> str:
|
|
18
|
+
system = platform.system().lower()
|
|
19
|
+
machine = platform.machine().lower()
|
|
20
|
+
|
|
21
|
+
arch = "arm64" if machine in ("arm64", "aarch64") else "amd64"
|
|
22
|
+
|
|
23
|
+
if system == "darwin":
|
|
24
|
+
return f"fapi-init_darwin_{arch}.tar.gz"
|
|
25
|
+
elif system == "linux":
|
|
26
|
+
return f"fapi-init_linux_{arch}.tar.gz"
|
|
27
|
+
elif system == "windows":
|
|
28
|
+
return f"fapi-init_windows_{arch}.zip"
|
|
29
|
+
else:
|
|
30
|
+
raise RuntimeError(f"Unsupported platform: {system}/{machine}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _bin_path(version: str) -> Path:
|
|
34
|
+
suffix = ".exe" if platform.system().lower() == "windows" else ""
|
|
35
|
+
return CACHE_DIR / version / (BIN_NAME + suffix)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def ensure_binary(version: str) -> Path:
|
|
39
|
+
bin_path = _bin_path(version)
|
|
40
|
+
if bin_path.exists():
|
|
41
|
+
return bin_path
|
|
42
|
+
|
|
43
|
+
asset = _platform_asset()
|
|
44
|
+
url = f"https://github.com/{GITHUB_REPO}/releases/download/v{version}/{asset}"
|
|
45
|
+
|
|
46
|
+
bin_path.parent.mkdir(parents=True, exist_ok=True)
|
|
47
|
+
|
|
48
|
+
archive_path = bin_path.parent / asset
|
|
49
|
+
print(f"Downloading fapi-init v{version}...", file=sys.stderr)
|
|
50
|
+
urllib.request.urlretrieve(url, archive_path)
|
|
51
|
+
|
|
52
|
+
if asset.endswith(".zip"):
|
|
53
|
+
with zipfile.ZipFile(archive_path) as zf:
|
|
54
|
+
zf.extractall(bin_path.parent)
|
|
55
|
+
else:
|
|
56
|
+
with tarfile.open(archive_path, "r:gz") as tf:
|
|
57
|
+
tf.extractall(bin_path.parent)
|
|
58
|
+
|
|
59
|
+
archive_path.unlink()
|
|
60
|
+
|
|
61
|
+
# ensure executable
|
|
62
|
+
bin_path.chmod(bin_path.stat().st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
|
|
63
|
+
return bin_path
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fapi-init
|
|
3
|
+
Version: 0.0.0
|
|
4
|
+
Summary: Scaffold a production-ready FastAPI project in seconds
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/markryangarcia/fapi-init
|
|
7
|
+
Project-URL: Repository, https://github.com/markryangarcia/fapi-init
|
|
8
|
+
Keywords: fastapi,scaffold,generator,cli,boilerplate
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
15
|
+
Requires-Python: >=3.8
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
|
|
18
|
+
# fapi-init
|
|
19
|
+
|
|
20
|
+
Scaffold a production-ready FastAPI project in seconds.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install fapi-init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
fapi-init my-project
|
|
32
|
+
# or scaffold into the current directory
|
|
33
|
+
fapi-init .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The CLI will guide you through selecting a database, ORM, auth provider, Docker support, and more.
|
|
37
|
+
|
|
38
|
+
## Source
|
|
39
|
+
|
|
40
|
+
Built with Go. Binaries are downloaded from [GitHub Releases](https://github.com/markryangarcia/fapi-init/releases) on first run and cached at `~/.cache/fapi-init`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
fapi_init/__init__.py,sha256=jtHfZTYfDVnkBkPua4j_qwb2d1yL1Q1PIGZ7XbdfZYA,402
|
|
2
|
+
fapi_init/_binary.py,sha256=eSfNwzJPuwxJ2C2gQV5Hkk3rnDdU3A4btmoFshbiVUI,1880
|
|
3
|
+
fapi_init-0.0.0.dist-info/METADATA,sha256=StP5wM7XY0aXkvmph_pBxNS66xlw4RxnAmo17vKVTgY,1155
|
|
4
|
+
fapi_init-0.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
fapi_init-0.0.0.dist-info/entry_points.txt,sha256=_G5UBMAbrtsI-3YUTeBNdX2fXj92aM3jRdT9jHGAE1g,45
|
|
6
|
+
fapi_init-0.0.0.dist-info/top_level.txt,sha256=U6Enp7LSEnY12YpXS63RfWCEWMY2n6LzyEjzCuhr1fU,10
|
|
7
|
+
fapi_init-0.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fapi_init
|