fpm-cli 0.2.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.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.4
2
+ Name: fpm-cli
3
+ Version: 0.2.0
4
+ Summary: Fast Package Manager for Python — binary distribution
5
+ Author: Kartikey Yadav
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Kartikey2011yadav/fpm
8
+ Project-URL: Repository, https://github.com/Kartikey2011yadav/fpm
9
+ Project-URL: Issues, https://github.com/Kartikey2011yadav/fpm/issues
10
+ Keywords: package-manager,python,pip,fast,install
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Software Development :: Build Tools
20
+ Classifier: Topic :: System :: Installation/Setup
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+
24
+ # fpm-cli
25
+
26
+ **Fast Package Manager for Python** — binary distribution via pip.
27
+
28
+ This package provides the `fpm` command by downloading the pre-built binary for
29
+ your platform (macOS, Linux, Windows — Intel and ARM).
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ pip install fpm-cli
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ After installation, `fpm` is available:
40
+
41
+ ```bash
42
+ fpm --help
43
+ fpm init myproject
44
+ fpm install requests
45
+ ```
46
+
47
+ ## What this package does
48
+
49
+ This is a thin Python wrapper that:
50
+
51
+ 1. Downloads the correct `fpm` binary for your OS/architecture
52
+ 2. Places it alongside your Python scripts
53
+ 3. Proxies all commands to the native binary
54
+
55
+ The actual `fpm` tool is written in Go for maximum performance.
56
+
57
+ ## Platforms
58
+
59
+ | OS | Architecture | Supported |
60
+ | ------- | ------------ | --------- |
61
+ | Linux | x86_64 | ✓ |
62
+ | Linux | arm64 | ✓ |
63
+ | macOS | x86_64 | ✓ |
64
+ | macOS | arm64 (M1+) | ✓ |
65
+ | Windows | x86_64 | ✓ |
66
+
67
+ ## More information
68
+
69
+ - [GitHub](https://github.com/Kartikey2011yadav/fpm)
70
+ - [Documentation](https://github.com/Kartikey2011yadav/fpm/tree/main/docs)
@@ -0,0 +1,6 @@
1
+ fpm_pkg/__init__.py,sha256=C5ox9CnLE7IbJojNb2092K4gJq4ZGJtyMnG7a5wVpQE,3655
2
+ fpm_cli-0.2.0.dist-info/METADATA,sha256=GPFWZ3nc46XbwCrEmEQkpvG9GDvCMSQ7PIeenGZnS7Q,2043
3
+ fpm_cli-0.2.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
4
+ fpm_cli-0.2.0.dist-info/entry_points.txt,sha256=c9ADueqDzzmY4raiwroAJC6Y6K_42h9XF_z_QjYMzuo,37
5
+ fpm_cli-0.2.0.dist-info/top_level.txt,sha256=d-G4qtSZT5Q3M18mvN-PieIfl7UhEge0DkBu0MKOJug,8
6
+ fpm_cli-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ fpm = fpm_pkg:main
@@ -0,0 +1 @@
1
+ fpm_pkg
fpm_pkg/__init__.py ADDED
@@ -0,0 +1,129 @@
1
+ """fpm-cli: Fast Package Manager for Python — binary wrapper.
2
+
3
+ This package downloads and installs the fpm binary for your platform.
4
+ After installation, the `fpm` command is available in your PATH.
5
+ """
6
+
7
+ import os
8
+ import platform
9
+ import shutil
10
+ import stat
11
+ import subprocess
12
+ import sys
13
+ import tempfile
14
+ import urllib.request
15
+
16
+ __version__ = "0.2.0"
17
+
18
+ REPO = "Kartikey2011yadav/fpm"
19
+ GITHUB_API = f"https://api.github.com/repos/{REPO}/releases/latest"
20
+
21
+
22
+ def get_platform():
23
+ """Detect OS and architecture."""
24
+ system = platform.system().lower()
25
+ machine = platform.machine().lower()
26
+
27
+ if system == "darwin":
28
+ os_name = "darwin"
29
+ elif system == "linux":
30
+ os_name = "linux"
31
+ elif system == "windows":
32
+ os_name = "windows"
33
+ else:
34
+ raise RuntimeError(f"Unsupported OS: {system}")
35
+
36
+ if machine in ("x86_64", "amd64"):
37
+ arch = "amd64"
38
+ elif machine in ("aarch64", "arm64"):
39
+ arch = "arm64"
40
+ else:
41
+ raise RuntimeError(f"Unsupported architecture: {machine}")
42
+
43
+ return os_name, arch
44
+
45
+
46
+ def get_binary_path():
47
+ """Get the path where the fpm binary should be installed."""
48
+ # Install next to this Python package's scripts
49
+ scripts_dir = os.path.dirname(sys.executable)
50
+
51
+ # On Unix, use the bin dir alongside python
52
+ if platform.system() != "Windows":
53
+ return os.path.join(scripts_dir, "fpm")
54
+ else:
55
+ return os.path.join(scripts_dir, "fpm.exe")
56
+
57
+
58
+ def get_download_url(version=None):
59
+ """Construct the download URL for the platform binary."""
60
+ os_name, arch = get_platform()
61
+
62
+ if version is None:
63
+ # Try to get latest from GitHub API
64
+ try:
65
+ import json
66
+ with urllib.request.urlopen(GITHUB_API, timeout=10) as resp:
67
+ data = json.loads(resp.read())
68
+ version = data["tag_name"].lstrip("v")
69
+ except Exception:
70
+ version = __version__
71
+
72
+ ext = ".exe" if os_name == "windows" else ""
73
+ filename = f"fpm-{version}-{os_name}-{arch}{ext}"
74
+ url = f"https://github.com/{REPO}/releases/download/v{version}/{filename}"
75
+ return url, filename
76
+
77
+
78
+ def download_binary():
79
+ """Download the fpm binary for this platform."""
80
+ url, filename = get_download_url()
81
+ binary_path = get_binary_path()
82
+
83
+ print(f"Downloading fpm from {url}...")
84
+
85
+ try:
86
+ tmp = tempfile.NamedTemporaryFile(delete=False, suffix=filename)
87
+ urllib.request.urlretrieve(url, tmp.name)
88
+
89
+ # Make executable
90
+ os.chmod(tmp.name, os.stat(tmp.name).st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
91
+
92
+ # Move to final location
93
+ os.makedirs(os.path.dirname(binary_path), exist_ok=True)
94
+ shutil.move(tmp.name, binary_path)
95
+
96
+ print(f"Installed fpm to {binary_path}")
97
+ return binary_path
98
+
99
+ except Exception as e:
100
+ print(f"Failed to download fpm: {e}", file=sys.stderr)
101
+ print("Try installing manually: https://github.com/Kartikey2011yadav/fpm#installation", file=sys.stderr)
102
+ sys.exit(1)
103
+
104
+
105
+ def find_binary():
106
+ """Find the fpm binary, downloading if necessary."""
107
+ # Check if already installed alongside this package
108
+ binary_path = get_binary_path()
109
+ if os.path.isfile(binary_path) and os.access(binary_path, os.X_OK):
110
+ return binary_path
111
+
112
+ # Check PATH
113
+ which = shutil.which("fpm")
114
+ if which:
115
+ return which
116
+
117
+ # Download it
118
+ return download_binary()
119
+
120
+
121
+ def main():
122
+ """Entry point: proxy all arguments to the fpm binary."""
123
+ binary = find_binary()
124
+ result = subprocess.run([binary] + sys.argv[1:])
125
+ sys.exit(result.returncode)
126
+
127
+
128
+ if __name__ == "__main__":
129
+ main()