uv-sbom-bin 0.1.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.
@@ -0,0 +1,48 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ debug
4
+ target
5
+
6
+ # These are backup files generated by rustfmt
7
+ **/*.rs.bk
8
+
9
+ # MSVC Windows builds of rustc generate these, which store debugging information
10
+ *.pdb
11
+
12
+ # Generated by cargo mutants
13
+ # Contains mutation testing data
14
+ **/mutants.out*/
15
+
16
+ # RustRover
17
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
18
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
19
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
20
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
21
+ #.idea/
22
+
23
+ # macOS
24
+ .DS_Store
25
+ .AppleDouble
26
+ .LSOverride
27
+
28
+ # Icon must end with two \r
29
+ Icon
30
+
31
+ # Thumbnails
32
+ ._*
33
+
34
+ # Files that might appear in the root of a volume
35
+ .DocumentRevisions-V100
36
+ .fseventsd
37
+ .Spotlight-V100
38
+ .TemporaryItems
39
+ .Trashes
40
+ .VolumeIcon.icns
41
+ .com.apple.timemachine.donotpresent
42
+
43
+ # Directories potentially created on remote AFP share
44
+ .AppleDB
45
+ .AppleDesktop
46
+ Network Trash Folder
47
+ Temporary Items
48
+ .apdisk
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: uv-sbom-bin
3
+ Version: 0.1.0
4
+ Summary: Python wrapper for uv-sbom - SBOM generation tool for uv projects
5
+ Project-URL: Homepage, https://github.com/Taketo-Yoda/uv-sbom
6
+ Project-URL: Repository, https://github.com/Taketo-Yoda/uv-sbom
7
+ Project-URL: Bug Tracker, https://github.com/Taketo-Yoda/uv-sbom/issues
8
+ Author-email: Taketo Yoda <exhaust7.drs@gmail.com>
9
+ License: MIT
10
+ Keywords: cyclonedx,python-wrapper,sbom,security,supply-chain,uv
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Security
22
+ Classifier: Topic :: Software Development :: Build Tools
23
+ Classifier: Topic :: System :: Software Distribution
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+
27
+ # uv-sbom-bin
28
+
29
+ Python wrapper for the `uv-sbom` CLI tool written in Rust.
30
+
31
+ This package allows Python users to install `uv-sbom` via PyPI and use it with `uv tool install`.
32
+
33
+ ## Installation
34
+
35
+ ### Via pip
36
+
37
+ ```bash
38
+ pip install uv-sbom-bin
39
+ ```
40
+
41
+ ### Via uv
42
+
43
+ ```bash
44
+ uv tool install uv-sbom-bin
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ After installation, the `uv-sbom` command will be available in your PATH:
50
+
51
+ ```bash
52
+ uv-sbom --version
53
+ uv-sbom --format json
54
+ uv-sbom --format markdown --output SBOM.md
55
+ ```
56
+
57
+ ## How It Works
58
+
59
+ This package downloads the prebuilt Rust binary for your platform from the [GitHub releases](https://github.com/Taketo-Yoda/uv-sbom/releases) and installs it.
60
+
61
+ Supported platforms:
62
+ - macOS (Apple Silicon and Intel)
63
+ - Linux (x86_64)
64
+ - Windows (x86_64)
65
+
66
+ ## Development
67
+
68
+ This is a wrapper package. The actual tool is developed at:
69
+ https://github.com/Taketo-Yoda/uv-sbom
70
+
71
+ ## License
72
+
73
+ MIT License - see [LICENSE](https://github.com/Taketo-Yoda/uv-sbom/blob/main/LICENSE)
@@ -0,0 +1,47 @@
1
+ # uv-sbom-bin
2
+
3
+ Python wrapper for the `uv-sbom` CLI tool written in Rust.
4
+
5
+ This package allows Python users to install `uv-sbom` via PyPI and use it with `uv tool install`.
6
+
7
+ ## Installation
8
+
9
+ ### Via pip
10
+
11
+ ```bash
12
+ pip install uv-sbom-bin
13
+ ```
14
+
15
+ ### Via uv
16
+
17
+ ```bash
18
+ uv tool install uv-sbom-bin
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ After installation, the `uv-sbom` command will be available in your PATH:
24
+
25
+ ```bash
26
+ uv-sbom --version
27
+ uv-sbom --format json
28
+ uv-sbom --format markdown --output SBOM.md
29
+ ```
30
+
31
+ ## How It Works
32
+
33
+ This package downloads the prebuilt Rust binary for your platform from the [GitHub releases](https://github.com/Taketo-Yoda/uv-sbom/releases) and installs it.
34
+
35
+ Supported platforms:
36
+ - macOS (Apple Silicon and Intel)
37
+ - Linux (x86_64)
38
+ - Windows (x86_64)
39
+
40
+ ## Development
41
+
42
+ This is a wrapper package. The actual tool is developed at:
43
+ https://github.com/Taketo-Yoda/uv-sbom
44
+
45
+ ## License
46
+
47
+ MIT License - see [LICENSE](https://github.com/Taketo-Yoda/uv-sbom/blob/main/LICENSE)
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "uv-sbom-bin"
7
+ version = "0.1.0"
8
+ description = "Python wrapper for uv-sbom - SBOM generation tool for uv projects"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ authors = [
12
+ { name = "Taketo Yoda", email = "exhaust7.drs@gmail.com" }
13
+ ]
14
+ keywords = [
15
+ "sbom",
16
+ "cyclonedx",
17
+ "uv",
18
+ "security",
19
+ "supply-chain",
20
+ "python-wrapper"
21
+ ]
22
+ classifiers = [
23
+ "Development Status :: 4 - Beta",
24
+ "Intended Audience :: Developers",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Operating System :: OS Independent",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.8",
29
+ "Programming Language :: Python :: 3.9",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Topic :: Software Development :: Build Tools",
34
+ "Topic :: Security",
35
+ "Topic :: System :: Software Distribution",
36
+ ]
37
+ requires-python = ">=3.8"
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/Taketo-Yoda/uv-sbom"
41
+ Repository = "https://github.com/Taketo-Yoda/uv-sbom"
42
+ "Bug Tracker" = "https://github.com/Taketo-Yoda/uv-sbom/issues"
43
+
44
+ [project.scripts]
45
+ uv-sbom = "uv_sbom_bin.__main__:main"
46
+
47
+ [tool.hatch.build.targets.wheel]
48
+ packages = ["uv_sbom_bin"]
49
+
50
+ [tool.hatch.build.targets.sdist]
51
+ include = [
52
+ "uv_sbom_bin/**/*.py",
53
+ "README.md",
54
+ ]
@@ -0,0 +1,7 @@
1
+ """Python wrapper for uv-sbom CLI tool."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from .install import ensure_binary, get_binary_path
6
+
7
+ __all__ = ["ensure_binary", "get_binary_path", "__version__"]
@@ -0,0 +1,30 @@
1
+ """CLI entry point for uv-sbom."""
2
+
3
+ import subprocess
4
+ import sys
5
+
6
+ from .install import ensure_binary
7
+
8
+
9
+ def main():
10
+ """Main entry point that ensures binary is installed and runs it."""
11
+ try:
12
+ binary_path = ensure_binary()
13
+ except RuntimeError as e:
14
+ print(f"Error: {e}", file=sys.stderr)
15
+ return 1
16
+
17
+ # Run the binary with all arguments passed through
18
+ try:
19
+ result = subprocess.run(
20
+ [str(binary_path)] + sys.argv[1:],
21
+ check=False
22
+ )
23
+ return result.returncode
24
+ except Exception as e:
25
+ print(f"Error running uv-sbom: {e}", file=sys.stderr)
26
+ return 1
27
+
28
+
29
+ if __name__ == "__main__":
30
+ sys.exit(main())
@@ -0,0 +1,196 @@
1
+ """Binary installation logic for uv-sbom."""
2
+
3
+ import os
4
+ import platform
5
+ import sys
6
+ import tarfile
7
+ import zipfile
8
+ from pathlib import Path
9
+ from urllib.request import urlretrieve
10
+
11
+ # Version of uv-sbom to install
12
+ UV_SBOM_VERSION = "0.1.0"
13
+
14
+ # GitHub release URL template
15
+ RELEASE_URL_TEMPLATE = (
16
+ "https://github.com/Taketo-Yoda/uv-sbom/releases/download/"
17
+ "v{version}/uv-sbom-{platform}.{ext}"
18
+ )
19
+
20
+
21
+ def get_platform_info():
22
+ """Detect the current platform and return the appropriate binary info.
23
+
24
+ Returns:
25
+ tuple: (platform_string, file_extension)
26
+
27
+ Raises:
28
+ RuntimeError: If the platform is not supported
29
+ """
30
+ system = platform.system().lower()
31
+ machine = platform.machine().lower()
32
+
33
+ if system == "darwin":
34
+ if machine == "arm64":
35
+ return "aarch64-apple-darwin", "tar.gz"
36
+ elif machine == "x86_64":
37
+ return "x86_64-apple-darwin", "tar.gz"
38
+ else:
39
+ raise RuntimeError(f"Unsupported macOS architecture: {machine}")
40
+
41
+ elif system == "linux":
42
+ if machine == "x86_64":
43
+ return "x86_64-unknown-linux-gnu", "tar.gz"
44
+ else:
45
+ raise RuntimeError(
46
+ f"Unsupported Linux architecture: {machine}. "
47
+ "Only x86_64 is currently supported."
48
+ )
49
+
50
+ elif system == "windows":
51
+ if machine in ("amd64", "x86_64"):
52
+ return "x86_64-pc-windows-msvc", "zip"
53
+ else:
54
+ raise RuntimeError(f"Unsupported Windows architecture: {machine}")
55
+
56
+ else:
57
+ raise RuntimeError(f"Unsupported operating system: {system}")
58
+
59
+
60
+ def get_binary_path():
61
+ """Get the path where the uv-sbom binary should be installed.
62
+
63
+ Returns:
64
+ Path: Path to the binary executable
65
+ """
66
+ package_dir = Path(__file__).parent
67
+ binary_dir = package_dir / "bin"
68
+
69
+ if platform.system().lower() == "windows":
70
+ return binary_dir / "uv-sbom.exe"
71
+ else:
72
+ return binary_dir / "uv-sbom"
73
+
74
+
75
+ def download_binary(platform_str, extension, dest_dir):
76
+ """Download the binary archive for the current platform.
77
+
78
+ Args:
79
+ platform_str: Platform identifier (e.g., "x86_64-apple-darwin")
80
+ extension: File extension ("tar.gz" or "zip")
81
+ dest_dir: Destination directory for the download
82
+
83
+ Returns:
84
+ Path: Path to the downloaded archive
85
+ """
86
+ url = RELEASE_URL_TEMPLATE.format(
87
+ version=UV_SBOM_VERSION,
88
+ platform=platform_str,
89
+ ext=extension
90
+ )
91
+
92
+ archive_name = f"uv-sbom-{platform_str}.{extension}"
93
+ archive_path = dest_dir / archive_name
94
+
95
+ print(f"Downloading uv-sbom v{UV_SBOM_VERSION} for {platform_str}...")
96
+ print(f"URL: {url}")
97
+
98
+ try:
99
+ urlretrieve(url, archive_path)
100
+ print(f"Downloaded to {archive_path}")
101
+ return archive_path
102
+ except Exception as e:
103
+ raise RuntimeError(
104
+ f"Failed to download uv-sbom binary: {e}\n"
105
+ f"URL: {url}"
106
+ )
107
+
108
+
109
+ def extract_binary(archive_path, dest_dir):
110
+ """Extract the binary from the downloaded archive.
111
+
112
+ Args:
113
+ archive_path: Path to the archive file
114
+ dest_dir: Destination directory for extraction
115
+ """
116
+ print(f"Extracting {archive_path}...")
117
+
118
+ if archive_path.suffix == ".zip" or archive_path.name.endswith(".zip"):
119
+ with zipfile.ZipFile(archive_path, 'r') as zip_ref:
120
+ zip_ref.extractall(dest_dir)
121
+ else: # tar.gz
122
+ with tarfile.open(archive_path, 'r:gz') as tar_ref:
123
+ tar_ref.extractall(dest_dir)
124
+
125
+ print(f"Extracted to {dest_dir}")
126
+
127
+
128
+ def make_executable(binary_path):
129
+ """Make the binary executable on Unix-like systems.
130
+
131
+ Args:
132
+ binary_path: Path to the binary file
133
+ """
134
+ if platform.system().lower() != "windows":
135
+ os.chmod(binary_path, 0o755)
136
+ print(f"Made {binary_path} executable")
137
+
138
+
139
+ def ensure_binary():
140
+ """Ensure the uv-sbom binary is installed.
141
+
142
+ Downloads and installs the binary if not already present.
143
+
144
+ Returns:
145
+ Path: Path to the installed binary
146
+
147
+ Raises:
148
+ RuntimeError: If installation fails
149
+ """
150
+ binary_path = get_binary_path()
151
+
152
+ # Check if already installed
153
+ if binary_path.exists():
154
+ print(f"uv-sbom binary already installed at {binary_path}")
155
+ return binary_path
156
+
157
+ # Get platform info
158
+ try:
159
+ platform_str, extension = get_platform_info()
160
+ except RuntimeError as e:
161
+ print(f"Error: {e}", file=sys.stderr)
162
+ raise
163
+
164
+ # Create binary directory
165
+ binary_dir = binary_path.parent
166
+ binary_dir.mkdir(parents=True, exist_ok=True)
167
+
168
+ # Download and extract
169
+ try:
170
+ archive_path = download_binary(platform_str, extension, binary_dir)
171
+ extract_binary(archive_path, binary_dir)
172
+
173
+ # Verify the binary exists
174
+ if not binary_path.exists():
175
+ raise RuntimeError(
176
+ f"Binary not found after extraction: {binary_path}"
177
+ )
178
+
179
+ # Make executable
180
+ make_executable(binary_path)
181
+
182
+ # Clean up archive
183
+ archive_path.unlink()
184
+ print(f"Cleaned up {archive_path}")
185
+
186
+ print(f"✅ uv-sbom v{UV_SBOM_VERSION} installed successfully!")
187
+ return binary_path
188
+
189
+ except Exception as e:
190
+ print(f"❌ Installation failed: {e}", file=sys.stderr)
191
+ raise
192
+
193
+
194
+ if __name__ == "__main__":
195
+ # Allow running as: python -m uv_sbom_bin.install
196
+ ensure_binary()